X Tutup
Skip to content

Obey RFC2616 in CONNECT request#151

Merged
qwj merged 1 commit intoqwj:masterfrom
Mervent:master
Jan 13, 2024
Merged

Obey RFC2616 in CONNECT request#151
qwj merged 1 commit intoqwj:masterfrom
Mervent:master

Conversation

@Mervent
Copy link
Contributor

@Mervent Mervent commented Mar 16, 2022

Some proxy servers requires Host header to be the same as CONNECT or they will return 400 http code on request.

RFC2616 tells us the same thing

https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html

An HTTP/1.1 proxy MUST ensure that any request message it forwards does contain an appropriate Host header field that >identifies the service being requested by the proxy. All Internet-based HTTP/1.1 servers MUST respond with a 400 (Bad >Request) status code to any HTTP/1.1 request message which lacks a Host header field.

Before the change

CONNECT ifconfig.co:443 HTTP/1.1
Host: PROXY_IP
Proxy-Authorization: Basic --base64data--

After the change

CONNECT ifconfig.co:443 HTTP/1.1
Host: ifconfig.co:443
Proxy-Authorization: Basic --base64data--

https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
An HTTP/1.1 proxy MUST ensure that any request message it forwards does contain an appropriate Host header field that identifies the service being requested by the proxy. All Internet-based HTTP/1.1 servers MUST respond with a 400 (Bad Request) status code to any HTTP/1.1 request message which lacks a Host header field.
@Mervent
Copy link
Contributor Author

Mervent commented Mar 17, 2022

Proper usage of CONNECT method is also described in updated RFC7231
https://httpwg.org/specs/rfc7231.html#CONNECT

@qwj qwj merged commit 4863477 into qwj:master Jan 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

X Tutup