File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -63,7 +63,11 @@ func removeExtraHTTPHostPort(req *http.Request) {
6363// parseBasicProxyAuthorization parse header Proxy-Authorization and return base64-encoded credential
6464func parseBasicProxyAuthorization (request * http.Request ) string {
6565 value := request .Header .Get ("Proxy-Authorization" )
66- if ! strings .HasPrefix (value , "Basic " ) {
66+ const prefix = "Basic "
67+ // According to RFC7617, the scheme should be case-insensitive.
68+ // In practice, some implementations do use different case styles, causing authentication to fail
69+ // eg: https://github.com/algesten/ureq/blob/381fd42cfcb80a5eb709d64860aa0ae726f17b8e/src/unversioned/transport/connect.rs#L118
70+ if len (value ) < len (prefix ) || ! strings .EqualFold (value [:len (prefix )], prefix ) {
6771 return ""
6872 }
6973
You can’t perform that action at this time.
0 commit comments