[
https://issues.apache.org/jira/browse/HTTPCLIENT-2118?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17205648#comment-17205648
]
Michael Osipov commented on HTTPCLIENT-2118:
--------------------------------------------
{noformat}
$ JAVA_VERSION=11 mvn package -V
Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe;
2018-06-17T20:33:14+02:00)
Maven home: /usr/local/apache-maven-3.5.4
Java version: 11.0.8, vendor: OpenJDK BSD Porting Team, runtime:
/usr/local/openjdk11
Default locale: de_DE, platform encoding: UTF-8
OS name: "freebsd", version: "12.2-stable", arch: "amd64", family: "unix"
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------------------< demo:demo >------------------------------
[INFO] Building demo 1.0.0
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ demo ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ demo ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @
demo ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ demo
---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ demo ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running demo.HttpClientTests
2020-10-01 18:08:18.889 INFO [main] demo.HttpClientTests :
# Testing HttpClient 4
2020-10-01 18:08:19.188 INFO [main] demo.HttpClientTests :
Link:
https://github.com/notepad-plus-plus/notepad-plus-plus/releases/download/v7.9/npp.7.9.Installer.x64.exe
2020-10-01 18:08:19.474 WARN [main] o.a.h.c.protocol.ResponseProcessCookies :
Invalid cookie header: "Set-Cookie: _octo=GH1.1.381107936.1601568499; Path=/;
Domain=github.com; Expires=Fri, 01 Oct 2021 16:08:19 GMT; Secure;
SameSite=Lax". Invalid 'expires' attribute: Fri, 01 Oct 2021 16:08:19 GMT
2020-10-01 18:08:19.475 WARN [main] o.a.h.c.protocol.ResponseProcessCookies :
Invalid cookie header: "Set-Cookie: logged_in=no; Path=/; Domain=github.com;
Expires=Fri, 01 Oct 2021 16:08:19 GMT; HttpOnly; Secure; SameSite=Lax". Invalid
'expires' attribute: Fri, 01 Oct 2021 16:08:19 GMT
2020-10-01 18:08:19.992 INFO [main] demo.HttpClientTests :
Status: 304
2020-10-01 18:08:19.996 INFO [main] demo.HttpClientTests :
Link: https://nginx.org/download/nginx-1.19.3.zip
2020-10-01 18:08:20.513 INFO [main] demo.HttpClientTests :
Status: 200
2020-10-01 18:08:20.513 INFO [main] demo.HttpClientTests :
Link: https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
2020-10-01 18:08:20.733 INFO [main] demo.HttpClientTests :
Status: 304
2020-10-01 18:08:20.733 INFO [main] demo.HttpClientTests :
Link: https://winscp.net/eng/download.php
2020-10-01 18:08:20.837 INFO [main] demo.HttpClientTests :
Status: 200
2020-10-01 18:08:20.837 INFO [main] demo.HttpClientTests :
Link: https://curl.haxx.se/windows/
2020-10-01 18:08:20.949 INFO [main] demo.HttpClientTests :
Status: 304
2020-10-01 18:08:20.949 INFO [main] demo.HttpClientTests :
Link:
https://github.com/git-for-windows/git/releases/download/v2.28.0.windows.1/Git-2.28.0-64-bit.exe
2020-10-01 18:08:20.968 WARN [main] o.a.h.c.protocol.ResponseProcessCookies :
Invalid cookie header: "Set-Cookie: _octo=GH1.1.1127395529.1601568500; Path=/;
Domain=github.com; Expires=Fri, 01 Oct 2021 16:08:20 GMT; Secure;
SameSite=Lax". Invalid 'expires' attribute: Fri, 01 Oct 2021 16:08:20 GMT
2020-10-01 18:08:20.969 WARN [main] o.a.h.c.protocol.ResponseProcessCookies :
Invalid cookie header: "Set-Cookie: logged_in=no; Path=/; Domain=github.com;
Expires=Fri, 01 Oct 2021 16:08:20 GMT; HttpOnly; Secure; SameSite=Lax". Invalid
'expires' attribute: Fri, 01 Oct 2021 16:08:20 GMT
2020-10-01 18:08:21.089 INFO [main] demo.HttpClientTests :
Status: 304
2020-10-01 18:08:21.090 INFO [main] demo.HttpClientTests :
2020-10-01 18:08:21.105 INFO [main] demo.HttpClientTests :
# Testing HttpClient 5
2020-10-01 18:08:21.217 INFO [main] demo.HttpClientTests :
Link:
https://github.com/notepad-plus-plus/notepad-plus-plus/releases/download/v7.9/npp.7.9.Installer.x64.exe
2020-10-01 18:08:21.854 INFO [main] demo.HttpClientTests :
Status: 304
2020-10-01 18:08:21.854 INFO [main] demo.HttpClientTests :
Link: https://nginx.org/download/nginx-1.19.3.zip
2020-10-01 18:08:22.351 INFO [main] demo.HttpClientTests :
Status: 200
2020-10-01 18:08:22.351 INFO [main] demo.HttpClientTests :
Link: https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
2020-10-01 18:08:22.560 INFO [main] demo.HttpClientTests :
Status: 304
2020-10-01 18:08:22.560 INFO [main] demo.HttpClientTests :
Link: https://winscp.net/eng/download.php
2020-10-01 18:08:22.661 INFO [main] demo.HttpClientTests :
Status: 200
2020-10-01 18:08:22.661 INFO [main] demo.HttpClientTests :
Link: https://curl.haxx.se/windows/
2020-10-01 18:08:22.739 INFO [main] demo.HttpClientTests :
Status: 304
2020-10-01 18:08:22.740 INFO [main] demo.HttpClientTests :
Link:
https://github.com/git-for-windows/git/releases/download/v2.28.0.windows.1/Git-2.28.0-64-bit.exe
2020-10-01 18:08:22.875 INFO [main] demo.HttpClientTests :
Status: 304
2020-10-01 18:08:22.875 INFO [main] demo.HttpClientTests :
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 4.199 s
- in demo.HttpClientTests
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ demo ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.054 s
[INFO] Finished at: 2020-10-01T18:08:23+02:00
[INFO] ------------------------------------------------------------------------
{noformat}
Same with 8 and 14.
What now?
> Difference in behavior between 4.5.x and 5.0.x - CloseableHttpClient returns
> 403 after NoHttpResponseException
> --------------------------------------------------------------------------------------------------------------
>
> Key: HTTPCLIENT-2118
> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2118
> Project: HttpComponents HttpClient
> Issue Type: Bug
> Components: HttpClient (classic), HttpClient (Windows)
> Affects Versions: 5.0.2
> Environment: Microsoft Windows 10 version 2004 [10.0.19041.508]
> Oracle JDK 11.0.8
> Reporter: Michael Lee
> Priority: Major
> Attachments: demo.zip, headers.log, test_output.txt
>
>
> My application reuses an instance of CloseableHttpClient to retrieve the
> content from a list of URLs. After upgrading HttpClient from 4.5.x to 5.0.2
> (also 5.0 and 5.0.1), it always gets a NoHttpResponseException followed by a
> response code of 403 for a particular URL in the list. When using 4.5.x, it
> always gets a 200 or 304 for that particular URL.
> The behavior may be different if the order of the URLs in the list is changed.
> To illustrate the problem, I have extracted code from my application into the
> sample Maven project attached. In the JUnit test, testHttpClient4() will get
> either 200 or 304 for all the URLs. On the other hand, testHttpClient5()
> always gets 403 for the last URL in the list. In this project, I
> intentionally added a If-Modified-Since header with the value being current
> time minus 1 minute so that we should get a 304 from most of the URLs.
> Can you investigate if this is really an obscure bug or an undocumented
> behavior change related to how CloseableHttpClient handles redirects?
> Thanks.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]