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

Do not retrieve the headers when request was rejected by server when using Expect header #4588

Closed

Conversation

skunjuma
Copy link

@skunjuma skunjuma commented Oct 1, 2020

HTTPURLConnection throws ProtocolException with "Server rejected operation" message when a non-100 response is received 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. Get the header fields only when exception is not ProtocolException and the message is not "Server rejected operation".

…using Expect header

HTTPURLConnection throws ProtocolException with "Server rejected operation" message when a non-100 response is received 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. Get the header fields only when exception is not ProtocolException and the message is not "Server rejected operation".
@jansupol
Copy link
Contributor

jansupol commented Dec 7, 2020

This should be fixed by #4613.

@senivam
Copy link
Contributor

senivam commented Mar 4, 2021

closing in favor of #4613

@senivam senivam closed this 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

Successfully merging this pull request may close these issues.

None yet

3 participants