[
https://issues.apache.org/jira/browse/HTTPCLIENT-2310?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17791641#comment-17791641
]
Marian commented on HTTPCLIENT-2310:
------------------------------------
[~olegk], I can't reproduce intercepting a connect request using the branch you
mentioned. I rechecked it with the released version (5.2.2) and intercepted the
connect request, but it isn't working anymore with the fix.
It seems like the fix works fine.
IMHO, I think it's a good idea to have the possibility to intercept any
requests, even the connect. If I want to modify a request before sending it
(like adding extra headers, cookies, etc), I could create a new one (it's a
cheap operation), and this is related to regular requests like GET, POST, and
so on. Therefore, I don't need to intercept something for these requests.
However, I can't create a connect request due to an exception, and there is no
reason to do so. I can't add extra headers to this request, and a simple
example is a "Proxy-Authorization" header to avoid 407 status code from a proxy
server and re-creating a new connect request with the needed header. Or any
other additional information to communicate with some specific servers. I guess
it is a powerful tool, but its potential isn't full if we can only intercept
requests that we can easily modify due to a re-creation, and at that moment, we
can't do anything with the connection process (through proxy-server or
directly).
It would be a rare situation but could still be usable in some exceptional
cases.
> Async client incorrectly pipes CONNECT requests through the main request
> protocol chain
> ---------------------------------------------------------------------------------------
>
> Key: HTTPCLIENT-2310
> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2310
> Project: HttpComponents HttpClient
> Issue Type: Bug
> Components: HttpClient (classic)
> Affects Versions: 5.2.2, 5.2.1
> Reporter: Marian
> Priority: Minor
> Fix For: 5.3-alpha2
>
> Attachments: image-2023-11-28-15-12-04-268.png,
> image-2023-11-28-15-12-20-327.png
>
> Time Spent: 10m
> Remaining Estimate: 0h
>
> HttpRequestInterceptor can be added to both CloseableHttpClient and
> CloseableHttpAsyncClient, but a CONNECT request can be caught only with
> CloseableHttpAsyncClient.
> Even if I use the following examples: [for
> async|https://github.com/apache/httpcomponents-client/blob/5.2.x/httpclient5/src/test/java/org/apache/hc/client5/http/examples/AsyncClientInterceptors.java]
> or [for
> classic|https://github.com/apache/httpcomponents-client/blob/5.2.x/httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientInterceptors.java]
> from GitHub.
> Could it be possible to fix this issue and cover the "connect" request in
> CloseableHttpClient's request interceptor?
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]