jech / polipo

The Polipo caching HTTP proxy
http://www.pps.jussieu.fr/~jch/software/polipo/
MIT License
1.81k stars 355 forks source link

Dropping "CONNECT" request instead of 401 when auth is required #93

Open zsoltm opened 8 years ago

zsoltm commented 8 years ago

I found a strange behaviour while handling CONNECT requests when authentication is enabled. If the client does not provide credentials the connection is just simply closed instead of responding with 401 and demanding (basic) authentication as it happens with regular proxy req's.

Could be tested easily:

CONNECT test.service:14442 HTTP/1.1
Host: test.service
Connection: keep-alive

Connection closed by foreign host.

... whereas:

CONNECT test.service:14442 HTTP/1.1
Host: test.service
Connection: keep-alive
Proxy-Authorization: Basic cHJveHk6dGVzdA==

HTTP/1.1 200 Tunnel established

Non-tunneling requests does it correctly:

GET http://test.service:14142/ HTTP/1.1
Host: test.service
Connection: keep-alive

HTTP/1.1 407 Proxy authentication required
Proxy-Authenticate: Basic realm="proxy-auth"