Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

POSTing empty request body over HTTPS hangs on second attempt #719

Closed
philsttr opened this issue Apr 19, 2019 · 0 comments
Closed

POSTing empty request body over HTTPS hangs on second attempt #719

philsttr opened this issue Apr 19, 2019 · 0 comments
Labels
type/bug A general bug
Milestone

Comments

@philsttr
Copy link
Contributor

philsttr commented Apr 19, 2019

If I submit two HTTPS POST requests using HttpClient, and the second request has an empty request body (content-length: 0), then the client hangs, and does not emit a response.

When I do the same over HTTP, it works. So, this appears isolated to HTTPS.
I only tried this with the JDK SSL Provider. Did not try with the OpenSSL provider.

I originally reported this against WebClient as spring-projects/spring-framework#22819, but I later determined it was related to empty request bodies (instead of empty response bodies as originally reported), and I was able to reproduce using HttpClient without using WebClient. So it appears to be reactor-netty related.

I have a created a unit test (project attached) that executes requests against an okhttp3 MockWebServer to demonstrate the issue.

The unit test has three methods that each execute two requests against the mock server

  • The HTTP test passes.
  • The HTTPS test with non-empty request bodies passes
  • The HTTPS test with empty request bodies fails with a timeout exception waiting on the second response.

Expected behavior

POST requests sent over HTTPS with empty bodies return a response.

Actual behavior

POST requests sent over HTTPS with empty bodies can hang.

If chunked encoding is used (which is what the unit test does), the request is never fully sent (and the server never responds)

If chunked encoding is not used (by explicitly providing Content-Length header), then the server will respond, but the client still doesn't emit the response.

Steps to reproduce

Execute attached unit test.

The failing test case (testHttps_emptyRequestBody) does the following:

  1. Submits a POST request over HTTPS
  2. Submits another POST request over HTTPS with an empty response body

Reactor Netty version

module version
reactor-core 3.2.8.RELEASE
reactor-netty 0.8.6.RELEASE
netty 4.1.34.Final

JVM version (e.g. java -version)

Reproduced on both 1.8.0_172 and 11.0.2

OS version (e.g. uname -a)

Windows 10 Version 1709

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants