http: avoid obscure http parser error on CONNECT.
Checklist
-
tests and code linting passes -
a test and/or benchmark is included -
documentation is changed or added -
the commit message follows commit guidelines
Affected core subsystem(s)
http
Description of change
Some proxies return a 403 when attempting SSL tunnelling through a port other than 443. This is reported to the HTTP client as an obscure "Parse Error" / HPE_INVALID_CONSTANT, which is difficult to troubleshoot.
This commit improves this by catching status codes >= 400 in CONNECT responses and by emitting an ECONNREFUSED error with the status code included in the error message.