Improve exceptions thrown when an error happens during proxy CONNECT
#2721
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.
Motivation:
ProxyResponseException
is marked asRetryableException
. However, not all response statuses are retryable. For example, it doesn't make sense to auto-retry if proxy responds with 4xx (proxy auth required, bad request, etc.).Also, because proxy-related exceptions live in
servicetalk-http-netty
, gprc-api can not access them for better mapping into gRPC status code.Modifications:
ProxyConnectException
fromhttp-netty
tohttp-api
;ProxyResponseException
, introduceProxyConnectResponseException
instead inhttp-api
;ProxyConnectResponseException
only for specific status codes from a proxy server are are intended to be retryable;ProxyConnectException
;GrpcStatusException
to recognizeProxyConnectResponseException
;HttpResponseStatus
->GrpcStatusCode
mapping intoGrpcUtils.fromHttpStatus(...)
utility, add support forPROXY_AUTHENTICATION_REQUIRED
status;Results:
ProxyResponseException
andProxyConnectResponseException
are part ofhttp-api
now.http-netty
is careful when proxy related exceptions should be marked asRetryableException
and when not.ProxyConnectResponseException
and infers better grpc-status instead of always usingUNKNOWN
.