[ 
https://issues.apache.org/jira/browse/HTTPCLIENT-2310?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17791720#comment-17791720
 ] 

Marian commented on HTTPCLIENT-2310:
------------------------------------

[~olegk], I tested only with a simple realization like the one I pasted before, 
but everything looks ok.

'CredentialsProvider' works well; the point here isn't about something wrong 
but about resources. It's not free to use proxies, and of course, it's not very 
expensive (in most cases), but if we do millions of requests daily, we would 
like to reduce some expenses (even 1-2%). 
A similar situation is with opening a TCP connection: I'd rather decline some 
invalid connections to the server (throw 503 if missing some extra data, 
whatever) than open a connection (that is not lightweight) and validate some 
tokens in headers after TCP is opened.

As I mentioned before, these cases are really rare, but they are dependent on a 
load. The need to interfere with the connection process should not be the norm, 
but if one wants to do so, one must understand the risks of misusing the 
specification.

Of course, these reasons are not enough to intercept a "connect" request, and 
it's an example of when I'd like to use this functionality.

> 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: dev-unsubscr...@hc.apache.org
For additional commands, e-mail: dev-h...@hc.apache.org

Reply via email to