Folks,

I have continued to fiddle a bit more with the redirector in HttpClient 5.0. I have modified my servlet code to respond with 307 from within a Tomcat valve which immediately kicks in after "Expect: 100-continue".

There seems to be a bug in RedirectExec:

[main] DEBUG org.apache.hc.client5.http.headers - http-outgoing-0 >> PUT 
/bb/repo/my.file HTTP/1.1
[main] DEBUG org.apache.hc.client5.http.headers - http-outgoing-0 >> 
Accept-Encoding: gzip, x-gzip, deflate
[main] DEBUG org.apache.hc.client5.http.headers - http-outgoing-0 >> 
Content-Length: 15
[main] DEBUG org.apache.hc.client5.http.headers - http-outgoing-0 >> 
Content-Type: application/octet-stream
[main] DEBUG org.apache.hc.client5.http.headers - http-outgoing-0 >> Host: 
localhost:8080
[main] DEBUG org.apache.hc.client5.http.headers - http-outgoing-0 >> 
Connection: keep-alive
[main] DEBUG org.apache.hc.client5.http.headers - http-outgoing-0 >> 
User-Agent: Apache-HttpClient/5.0-beta7-SNAPSHOT (Java/1.7.0_252)
[main] DEBUG org.apache.hc.client5.http.headers - http-outgoing-0 >> Expect: 
100-continue
[main] DEBUG org.apache.hc.client5.http.wire - http-outgoing-0 >> "PUT 
/bb/repo/my.file HTTP/1.1[\r][\n]"
[main] DEBUG org.apache.hc.client5.http.wire - http-outgoing-0 >> "Accept-Encoding: 
gzip, x-gzip, deflate[\r][\n]"
[main] DEBUG org.apache.hc.client5.http.wire - http-outgoing-0 >> "Content-Length: 
15[\r][\n]"
[main] DEBUG org.apache.hc.client5.http.wire - http-outgoing-0 >> "Content-Type: 
application/octet-stream[\r][\n]"
[main] DEBUG org.apache.hc.client5.http.wire - http-outgoing-0 >> "Host: 
localhost:8080[\r][\n]"
[main] DEBUG org.apache.hc.client5.http.wire - http-outgoing-0 >> "Connection: 
keep-alive[\r][\n]"
[main] DEBUG org.apache.hc.client5.http.wire - http-outgoing-0 >> "User-Agent: 
Apache-HttpClient/5.0-beta7-SNAPSHOT (Java/1.7.0_252)[\r][\n]"
[main] DEBUG org.apache.hc.client5.http.wire - http-outgoing-0 >> "Expect: 
100-continue[\r][\n]"
[main] DEBUG org.apache.hc.client5.http.wire - http-outgoing-0 >> "[\r][\n]"
[main] DEBUG org.apache.hc.client5.http.wire - http-outgoing-0 << "HTTP/1.1 307 
[\r][\n]"
[main] DEBUG org.apache.hc.client5.http.wire - http-outgoing-0 << "Location: 
/bb/redirected/repo/my.file[\r][\n]"
[main] DEBUG org.apache.hc.client5.http.wire - http-outgoing-0 << "Content-Length: 
0[\r][\n]"
[main] DEBUG org.apache.hc.client5.http.wire - http-outgoing-0 << "Date: Mon, 17 Feb 
2020 20:22:32 GMT[\r][\n]"
[main] DEBUG org.apache.hc.client5.http.wire - http-outgoing-0 << "Connection: 
close[\r][\n]"
[main] DEBUG org.apache.hc.client5.http.wire - http-outgoing-0 << "[\r][\n]"
[main] DEBUG org.apache.hc.client5.http.headers - http-outgoing-0 << HTTP/1.1 307 [main] DEBUG org.apache.hc.client5.http.headers - http-outgoing-0 << Location: /bb/redirected/repo/my.file
[main] DEBUG org.apache.hc.client5.http.headers - http-outgoing-0 << 
Content-Length: 0
[main] DEBUG org.apache.hc.client5.http.headers - http-outgoing-0 << Date: Mon, 
17 Feb 2020 20:22:32 GMT
[main] DEBUG org.apache.hc.client5.http.headers - http-outgoing-0 << 
Connection: close
[main] DEBUG org.apache.hc.client5.http.wire - http-outgoing-0 >> "I am a 
checksum"
[main] DEBUG 
org.apache.hc.client5.http.impl.io.DefaultManagedHttpClientConnection - 
http-outgoing-0: close connection IMMEDIATE
[main] DEBUG org.apache.hc.client5.http.impl.classic.InternalHttpClient - 
ep-00000000: endpoint closed
[main] DEBUG org.apache.hc.client5.http.impl.classic.InternalHttpClient - 
ep-00000000: discarding endpoint
[main] DEBUG 
org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager - 
ep-00000000: releasing endpoint
[main] DEBUG org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager 
- ep-00000000: connection released [route: {}->http://localhost:8080][total 
available: 0; route allocated: 0 of 5; total allocated: 0 of 25]
[main] DEBUG org.apache.hc.client5.http.impl.classic.ProtocolExec - 
ex-00000001: Cannot retry non-repeatable request
[main] DEBUG org.apache.hc.client5.http.impl.classic.HttpRequestRetryExec - 
ex-00000001: cannot retry non-repeatable request
[main] DEBUG org.apache.hc.client5.http.impl.classic.RedirectExec - 
ex-00000001: cannot redirect non-repeatable request
[main] DEBUG 
org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager - 
Shutdown connection pool GRACEFUL
[main] DEBUG 
org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager - 
Connection pool shut down

The client is sending the body "I am a checksum" also 100 has not been issued, but 307. I have expected the client to follow the redirect and retry. The request fails at the end because the HTTP entity has already been consumed.

Ideas?

Michael

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
For additional commands, e-mail: httpclient-users-h...@hc.apache.org

Reply via email to