ext.auth: return nil
instead of OkConnect
#542
Merged
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.
This allows falling through to a next
ConnectHandler
is authentication succeeds making if easier to combine with otherConnectHandler
s.Before this change the following code would not running the proxy in MITM mode, but instead directly connect to the remote host.
@elazarl Another problem with the example above is that the
AlwaysMitm
applies all request handlers when roundtripping including theauth.Basic
handler. This means that for aCONNECT
request the authentication will be checked twice, once by theauth.BasicConnect
handler (good) and again by theauth.Basic
one (bad). Somehow theauth.Basic
handler should only be applied if there was no previousCONNECT
. I'm not sure what the best way is to implement that. I've used theUserData
field in some application code, like the example below, but perhaps there is a better way. In any case it would be great if the goproxy library made implementing basic authentication a bit easier. What do you think?