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

Oleg Kalnichevski commented on HTTPCLIENT-2342:
-----------------------------------------------

Just ran the latest HttpClient build. `Content-Type` is fine.  [~ctabin] Please 
note one should _never_ rely on `Content-Type` of a response.  One _must_ use 
`Content-Type` of the response entity.

Oleg

{noformat}
2024-09-20 14:59:31,447 DEBUG 
[main][org.apache.hc.client5.http.impl.classic.InternalHttpClient] 
ex-0000000001 preparing request execution
2024-09-20 14:59:31,479 DEBUG 
[main][org.apache.hc.client5.http.impl.classic.ProtocolExec] ex-0000000001 
target auth state: UNCHALLENGED
2024-09-20 14:59:31,480 DEBUG 
[main][org.apache.hc.client5.http.impl.classic.ProtocolExec] ex-0000000001 
proxy auth state: UNCHALLENGED
2024-09-20 14:59:31,483 DEBUG 
[main][org.apache.hc.client5.http.impl.classic.ConnectExec] ex-0000000001 
acquiring connection with route {}->[http://httpbin.org:80]
2024-09-20 14:59:31,484 DEBUG 
[main][org.apache.hc.client5.http.impl.classic.InternalHttpClient] 
ex-0000000001 acquiring endpoint (3 MINUTES)
2024-09-20 14:59:31,487 DEBUG 
[main][org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager] 
ex-0000000001 endpoint lease request (3 MINUTES) [route: 
{}->[http://httpbin.org:80]][total available: 0; route allocated: 0 of 5; total 
allocated: 0 of 25]
2024-09-20 14:59:31,496 DEBUG 
[main][org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager] 
ex-0000000001 endpoint leased [route: {}->[http://httpbin.org:80]][total 
available: 0; route allocated: 1 of 5; total allocated: 1 of 25]
2024-09-20 14:59:31,513 DEBUG 
[main][org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager] 
ex-0000000001 acquired ep-0000000001
2024-09-20 14:59:31,513 DEBUG 
[main][org.apache.hc.client5.http.impl.classic.InternalHttpClient] 
ex-0000000001 acquired endpoint ep-0000000001
2024-09-20 14:59:31,513 DEBUG 
[main][org.apache.hc.client5.http.impl.classic.ConnectExec] ex-0000000001 
opening connection {}->[http://httpbin.org:80]
2024-09-20 14:59:31,514 DEBUG 
[main][org.apache.hc.client5.http.impl.classic.InternalHttpClient] 
ep-0000000001 connecting endpoint (null)
2024-09-20 14:59:31,516 DEBUG 
[main][org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager] 
ep-0000000001 connecting endpoint to http://httpbin.org:80 (3 MINUTES)
2024-09-20 14:59:31,518 DEBUG 
[main][org.apache.hc.client5.http.impl.io.DefaultHttpClientConnectionOperator] 
httpbin.org resolving remote address
2024-09-20 14:59:31,525 DEBUG 
[main][org.apache.hc.client5.http.impl.io.DefaultHttpClientConnectionOperator] 
httpbin.org resolved to [httpbin.org/34.237.204.224, httpbin.org/34.231.0.251]
2024-09-20 14:59:31,526 DEBUG 
[main][org.apache.hc.client5.http.impl.io.DefaultHttpClientConnectionOperator] 
http://httpbin.org:80 connecting null->httpbin.org/34.237.204.224:80 (3 MINUTES)
2024-09-20 14:59:31,711 DEBUG 
[main][org.apache.hc.client5.http.impl.io.DefaultHttpClientConnectionOperator] 
http-outgoing-0 http://httpbin.org:80 connected 
/192.168.76.83:55060->httpbin.org/34.237.204.224:80
2024-09-20 14:59:31,711 DEBUG 
[main][org.apache.hc.client5.http.impl.io.DefaultManagedHttpClientConnection] 
http-outgoing-0 set socket timeout to 3 MINUTES
2024-09-20 14:59:31,711 DEBUG 
[main][org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager] 
ep-0000000001 connected http-outgoing-0
2024-09-20 14:59:31,711 DEBUG 
[main][org.apache.hc.client5.http.impl.classic.InternalHttpClient] 
ep-0000000001 endpoint connected
2024-09-20 14:59:31,713 DEBUG 
[main][org.apache.hc.client5.http.impl.classic.MainClientExec] ex-0000000001 
executing GET /get HTTP/1.1
2024-09-20 14:59:31,714 DEBUG 
[main][org.apache.hc.client5.http.protocol.RequestUpgrade] Connection is 
upgradable: protocol version = HTTP/1.1
2024-09-20 14:59:31,714 DEBUG 
[main][org.apache.hc.client5.http.protocol.RequestUpgrade] Connection is 
upgradable to TLS: method = GET
2024-09-20 14:59:31,714 DEBUG 
[main][org.apache.hc.client5.http.protocol.RequestAddCookies] ex-0000000001 
Cookie spec selected: strict
2024-09-20 14:59:31,730 DEBUG 
[main][org.apache.hc.client5.http.impl.classic.InternalHttpClient] 
ep-0000000001 start execution ex-0000000001
2024-09-20 14:59:31,732 DEBUG 
[main][org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager] 
ep-0000000001 executing exchange ex-0000000001 over http-outgoing-0
2024-09-20 14:59:31,733 DEBUG [main][org.apache.hc.client5.http.headers] 
http-outgoing-0 >> GET /get HTTP/1.1
2024-09-20 14:59:31,734 DEBUG [main][org.apache.hc.client5.http.headers] 
http-outgoing-0 >> Accept-Encoding: gzip, x-gzip, deflate, br
2024-09-20 14:59:31,734 DEBUG [main][org.apache.hc.client5.http.headers] 
http-outgoing-0 >> Host: httpbin.org:80
2024-09-20 14:59:31,734 DEBUG [main][org.apache.hc.client5.http.headers] 
http-outgoing-0 >> Connection: keep-alive
2024-09-20 14:59:31,734 DEBUG [main][org.apache.hc.client5.http.headers] 
http-outgoing-0 >> User-Agent: Apache-HttpClient/5.4.1-SNAPSHOT (Java/1.8.0_342)
2024-09-20 14:59:31,734 DEBUG [main][org.apache.hc.client5.http.headers] 
http-outgoing-0 >> Upgrade: TLS/1.2
2024-09-20 14:59:31,735 DEBUG [main][org.apache.hc.client5.http.headers] 
http-outgoing-0 >> Connection: Upgrade
2024-09-20 14:59:31,922 DEBUG [main][org.apache.hc.client5.http.headers] 
http-outgoing-0 << HTTP/1.1 200 OK
2024-09-20 14:59:31,922 DEBUG [main][org.apache.hc.client5.http.headers] 
http-outgoing-0 << Date: Fri, 20 Sep 2024 12:59:31 GMT
2024-09-20 14:59:31,922 DEBUG [main][org.apache.hc.client5.http.headers] 
http-outgoing-0 << Content-Type: application/json
2024-09-20 14:59:31,922 DEBUG [main][org.apache.hc.client5.http.headers] 
http-outgoing-0 << Content-Length: 350
2024-09-20 14:59:31,922 DEBUG [main][org.apache.hc.client5.http.headers] 
http-outgoing-0 << Connection: keep-alive
2024-09-20 14:59:31,923 DEBUG [main][org.apache.hc.client5.http.headers] 
http-outgoing-0 << Server: gunicorn/19.9.0
2024-09-20 14:59:31,923 DEBUG [main][org.apache.hc.client5.http.headers] 
http-outgoing-0 << Access-Control-Allow-Origin: *
2024-09-20 14:59:31,923 DEBUG [main][org.apache.hc.client5.http.headers] 
http-outgoing-0 << Access-Control-Allow-Credentials: true
2024-09-20 14:59:31,928 DEBUG 
[main][org.apache.hc.client5.http.impl.classic.MainClientExec] ex-0000000001 
connection can be kept alive for 3 MINUTES
----------------------------------------
GET /get->HTTP/1.1 200 OK
2024-09-20 14:59:31,937 DEBUG 
[main][org.apache.hc.client5.http.impl.classic.InternalHttpClient] 
ep-0000000001 releasing valid endpoint
2024-09-20 14:59:31,937 DEBUG 
[main][org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager] 
ep-0000000001 releasing endpoint
2024-09-20 14:59:31,938 DEBUG 
[main][org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager] 
ep-0000000001 connection http-outgoing-0 can be kept alive for 3 MINUTES
2024-09-20 14:59:31,939 DEBUG 
[main][org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager] 
ep-0000000001 connection released [route: {}->[http://httpbin.org:80]][total 
available: 1; route allocated: 1 of 5; total allocated: 1 of 25]
Content-Type: application/json
2024-09-20 14:59:31,940 DEBUG 
[main][org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager] 
Shutdown connection pool GRACEFUL
2024-09-20 14:59:31,941 DEBUG 
[main][org.apache.hc.client5.http.impl.io.DefaultManagedHttpClientConnection] 
http-outgoing-0 close connection GRACEFUL
2024-09-20 14:59:31,942 DEBUG 
[main][org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager] 
Connection pool shut down
{noformat}

> Regression: Content-Type header not returned anymore
> ----------------------------------------------------
>
>                 Key: HTTPCLIENT-2342
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2342
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpClient (classic)
>    Affects Versions: 5.4-beta1
>            Reporter: Cedric Tabin
>            Priority: Major
>
> Hello,
> We just upgraded today to httpclient5 version 5.4. It seems that the header 
> `Content-Type` is not returned anymore by the API, even when listing all the 
> headers.
> {code:java}
> client.execute(httpRequest, r -> {
>     //does not print Content-Type header 
>     for(Header h : r.getHeaders()) {
>         System.out.println("## "+h.getName()+": "+h.getValue());
>     }
>     System.out.flush();
>     return null;
> });
> {code}
> We can ensure that the `Content-Type` header is well set by the server by 
> browsing to the same URL and inspecting the network.
> Our code didn't change and with the version 5.3.1, the Content-Type is 
> correctly received.



--
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