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

Jesery client sends a request twice when using Expect header and server returns with non-100 response #4587

Closed
skunjuma opened this issue Oct 1, 2020 · 1 comment

Comments

@skunjuma
Copy link

skunjuma commented Oct 1, 2020

I was trying to use the Expect header while uploading data. I noticed that Jersey client sends the same request twice when server returns back with a non-100 response. Debugging further into this revealed that HTTPURLConnection throws ProtocolException with "Server rejected operation" message and does not read the full response body or store the headers. HttpUrlConnector._apply method tries to set the headers to ClientResponse using HTTPURLConnection.getHeaderFields. getHeaderFields method first tries to getInputStream which in turn call getOutputStream. This results in sending the request again since both streams are null due the the ProtocolException.

I have a PR: #4588 which will solve this issue.

@senivam
Copy link
Contributor

senivam commented Mar 4, 2021

the issue shall be fixed by #4613 and is already available in the 2.33 version of Jersey. Please consider update to the version 2.33.

@senivam senivam closed this as completed Mar 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants