You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Nitish Chitta <nc...@tibco.com.INVALID> on 2021/09/23 07:21:32 UTC

Not able to handle early response for large payload in a POST request

When I try to hit the server with the wrong credentials for basic
authentication, I am getting a *socket-write exception* which should
ideally return a 401 status code. The server is closing the connection
immediately after it finds the credentials incorrect while the client is
still sending the body.

This is happening when the payload in the POST request is a large one.
There is no issue with the request that has correct credentials.

Is there is any possible solution for this? or is it a limitation on the
client due to blocking IO?

Appreciate any help! Thanks!

Re: Not able to handle early response for large payload in a POST request

Posted by Nitish Chitta <nc...@tibco.com.INVALID>.
Thanks for the response, Oleg!

Regards,
Nitish

On Thu, Sep 23, 2021 at 2:12 PM Oleg Kalnichevski <ol...@apache.org> wrote:

>
>
> On 9/23/2021 9:21 AM, Nitish Chitta wrote:
> > When I try to hit the server with the wrong credentials for basic
> > authentication, I am getting a *socket-write exception* which should
> > ideally return a 401 status code. The server is closing the connection
> > immediately after it finds the credentials incorrect while the client is
> > still sending the body.
> >
> > This is happening when the payload in the POST request is a large one.
> > There is no issue with the request that has correct credentials.
> >
> > Is there is any possible solution for this? or is it a limitation on the
> > client due to blocking IO?
> >
> > Appreciate any help! Thanks!
> >
>
>
> This is indeed a limitation of the classic (blocking) i/o.
>
> As of version 5.1 one can use ResponseOutOfOrderStrategy to monitor HTTP
> connections for out of sequence responses. This, however, involves a
> certain performance penalty for SSL/TLS connections.
>
> Oleg
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>

Re: Not able to handle early response for large payload in a POST request

Posted by Nitish Chitta <nc...@tibco.com.INVALID>.
Hi Micheal,

We have tried using expect continue as well. But that doesn't seem to work.
As mentioned by Oleg, we need to upgrade to HttpCore 5.1 to get this API
working right?

Thanks,
Nitish

On Fri, Sep 24, 2021 at 11:52 PM Michael Osipov <mi...@apache.org> wrote:

> Am 2021-09-23 um 10:42 schrieb Oleg Kalnichevski:
> >
> >
> > On 9/23/2021 9:21 AM, Nitish Chitta wrote:
> >> When I try to hit the server with the wrong credentials for basic
> >> authentication, I am getting a *socket-write exception* which should
> >> ideally return a 401 status code. The server is closing the connection
> >> immediately after it finds the credentials incorrect while the client is
> >> still sending the body.
> >>
> >> This is happening when the payload in the POST request is a large one.
> >> There is no issue with the request that has correct credentials.
> >>
> >> Is there is any possible solution for this? or is it a limitation on the
> >> client due to blocking IO?
> >>
> >> Appreciate any help! Thanks!
> >>
> >
> >
> > This is indeed a limitation of the classic (blocking) i/o.
> >
> > As of version 5.1 one can use ResponseOutOfOrderStrategy to monitor HTTP
> > connections for out of sequence responses. This, however, involves a
> > certain performance penalty for SSL/TLS connections.
>
> What a nice coincedence! Oleg, me and other committers worked hard on
> this Strategy. It should what you need. Please search the mailing lists
> for my indepth analysis of the problem and our solution for this.
>
> If your server is not able to handle expect continue, you must use this
> to avoid exceptions. Try expect continue first.
>
> M
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>

Re: Not able to handle early response for large payload in a POST request

Posted by Michael Osipov <mi...@apache.org>.
Am 2021-09-23 um 10:42 schrieb Oleg Kalnichevski:
> 
> 
> On 9/23/2021 9:21 AM, Nitish Chitta wrote:
>> When I try to hit the server with the wrong credentials for basic
>> authentication, I am getting a *socket-write exception* which should
>> ideally return a 401 status code. The server is closing the connection
>> immediately after it finds the credentials incorrect while the client is
>> still sending the body.
>>
>> This is happening when the payload in the POST request is a large one.
>> There is no issue with the request that has correct credentials.
>>
>> Is there is any possible solution for this? or is it a limitation on the
>> client due to blocking IO?
>>
>> Appreciate any help! Thanks!
>>
> 
> 
> This is indeed a limitation of the classic (blocking) i/o.
> 
> As of version 5.1 one can use ResponseOutOfOrderStrategy to monitor HTTP 
> connections for out of sequence responses. This, however, involves a 
> certain performance penalty for SSL/TLS connections.

What a nice coincedence! Oleg, me and other committers worked hard on 
this Strategy. It should what you need. Please search the mailing lists 
for my indepth analysis of the problem and our solution for this.

If your server is not able to handle expect continue, you must use this 
to avoid exceptions. Try expect continue first.

M

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


Re: Not able to handle early response for large payload in a POST request

Posted by Oleg Kalnichevski <ol...@apache.org>.

On 9/23/2021 9:21 AM, Nitish Chitta wrote:
> When I try to hit the server with the wrong credentials for basic
> authentication, I am getting a *socket-write exception* which should
> ideally return a 401 status code. The server is closing the connection
> immediately after it finds the credentials incorrect while the client is
> still sending the body.
> 
> This is happening when the payload in the POST request is a large one.
> There is no issue with the request that has correct credentials.
> 
> Is there is any possible solution for this? or is it a limitation on the
> client due to blocking IO?
> 
> Appreciate any help! Thanks!
> 


This is indeed a limitation of the classic (blocking) i/o.

As of version 5.1 one can use ResponseOutOfOrderStrategy to monitor HTTP 
connections for out of sequence responses. This, however, involves a 
certain performance penalty for SSL/TLS connections.

Oleg

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