http_proxy_errors: improve tls errors handling #910
Merged
Conversation
* Request completely sent off < HTTP/1.1 502 Bad Gateway < Content-Length: 214 < Content-Type: text/plain; charset=utf-8 < X-Forwarder-Error: forwarder tls: failed to verify certificate: x509: certificate signed by unknown authority < forwarder tls handshake failed for host "localhost:8080" unverified certificates: - O=Sauce Labs Inc. (issued by O=Sauce Labs Inc.)
mmatczuk
reviewed
Sep 17, 2024
http_proxy_errors.go
Outdated
|
|
||
| // ErrorHeader is the header that is set on error responses with the error message. | ||
| const ErrorHeader = "X-Forwarder-Error" | ||
| const ( |
Contributor
There was a problem hiding this comment.
I do not necessarily like the idea of grouping it, it's not related in any way.
mmatczuk
reviewed
Sep 17, 2024
http_proxy_errors.go
Outdated
|
|
||
| func tlsRecordHeaderLooksLikeHTTP(hdr [5]byte) bool { | ||
| switch string(hdr[:]) { | ||
| case "HTTP/", "GET /", "HEAD ", "POST ", "PUT /", "OPTIO": |
Contributor
There was a problem hiding this comment.
How about bytes has prefix?
Contributor
Author
There was a problem hiding this comment.
Like this?
func tlsRecordHeaderLooksLikeHTTP(hdr [5]byte) bool {
return bytes.HasPrefix(hdr[:], []byte("HTTP/")) ||
bytes.HasPrefix(hdr[:], []byte("GET /")) ||
bytes.HasPrefix(hdr[:], []byte("HEAD ")) ||
bytes.HasPrefix(hdr[:], []byte("POST ")) ||
bytes.HasPrefix(hdr[:], []byte("PUT /")) ||
bytes.HasPrefix(hdr[:], []byte("OPTIO"))
}Looks worse imo.
Contributor
There was a problem hiding this comment.
my point is that it allows not to have /.
mmatczuk
reviewed
Sep 17, 2024
The error does not implement a pointer receiver. It is passed by value. Fixes #634
162fa23 to
bdfe2bd
Compare
bdfe2bd to
e74f51d
Compare
Contributor
|
Sweet. |
mmatczuk
approved these changes
Sep 20, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #549