On Wed, 30 Aug 2023 09:23:34 GMT, Vyom Tewari <[email protected]> wrote:

> With the current implementation of HttpURLConnection  if server rejects the  
> “Expect 100-continue” then there will be ‘java.net.ProtocolException’ will be 
> thrown from 'expect100Continue()' method. 
> 
> After the exception thrown, If we call any other method on the same instance 
> (ex getHeaderField(), or getHeaderFields()). They will internally call 
> getOuputStream() which invokes writeRequests(), which make the actual server 
> call.
> 
> The code change will sets the existing variable ‘rememberedException’ when 
> there is exception and getOutputStream0() will re-throw ‘rememberedException’ 
>  if the ‘rememberedException’ is not null. 
> 
> Note: getOutputStream0() also call’s  ‘expect100Continue()’  if 
> ‘expectContinue’ is true.

This pull request has now been integrated.

Changeset: 460ebcd9
Author:    Vyom Tewari <[email protected]>
URL:       
https://git.openjdk.org/jdk/commit/460ebcd9cb94867608e22e07092bd1cf33228700
Stats:     268 lines in 2 files changed: 268 ins; 0 del; 0 mod

8314978: Multiple server call from connection failing with expect100 in 
getOutputStream

Reviewed-by: dfuchs

-------------

PR: https://git.openjdk.org/jdk/pull/15483

Reply via email to