support non-preemptive authentication
Non-preemptive authentication means that the Proxy-Authorization will not be actively sent when the tunnel is established, and this authentication will be brought after receiving the 407 response. The server will now directly close the connection when the proxy verification fails, and the client will still send a request on this connection without knowing it, causing the client to report an error. Therefore, you should explicitly return close when closing the connection. In [rfc7230#Connection](https://tools.ietf.org/html/rfc7230#section-6.1) > A server that does not support persistent connections MUST send the "close" connection option in every response message that does not have a 1xx (Informational) status code. 
This commit is contained in:
parent
b23548eeff
commit
062e04d856
@ -231,6 +231,7 @@ func removeProxyHeaders(req *http.Request) {
|
|||||||
func getBadResponse() *http.Response {
|
func getBadResponse() *http.Response {
|
||||||
header := make(map[string][]string)
|
header := make(map[string][]string)
|
||||||
header["Proxy-Authenticate"] = []string{"Basic"}
|
header["Proxy-Authenticate"] = []string{"Basic"}
|
||||||
|
header["Connection"] = []string{"close"}
|
||||||
res := &http.Response{
|
res := &http.Response{
|
||||||
Status: "407 Not authorized",
|
Status: "407 Not authorized",
|
||||||
StatusCode: 407,
|
StatusCode: 407,
|
||||||
|
Loading…
Reference in New Issue
Block a user