You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Oleg Kalnichevski (JIRA)" <ji...@apache.org> on 2018/12/28 12:53:00 UTC

[jira] [Commented] (HTTPASYNC-146) Can't handle the response for the remote server send response and close connection

    [ https://issues.apache.org/jira/browse/HTTPASYNC-146?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16730253#comment-16730253 ] 

Oleg Kalnichevski commented on HTTPASYNC-146:
---------------------------------------------

bq. The AbstractMessageParser#parse will return null.

This is clearly not the case.
{code:java}
@Test
public void testHTTPASYNC_146() throws Exception {
    final SessionInputBuffer inbuf = new SessionInputBufferImpl(1024, 128, Consts.ASCII);

    final NHttpMessageParser<HttpResponse> messageParser = new DefaultHttpResponseParser(inbuf);
    final ReadableByteChannel channel = newChannel("HTTP/1.1 301 Moved\r\nLocation: /redirect\r\n");
    messageParser.fillBuffer(channel);
    messageParser.fillBuffer(channel);
    final HttpResponse response = messageParser.parse();
    Assert.assertThat(response, CoreMatchers.notNullValue());
    Assert.assertThat(response.getStatusLine().getStatusCode(), CoreMatchers.equalTo(301));
    final Header[] headers = response.getAllHeaders();
    Assert.assertThat(headers.length, CoreMatchers.equalTo(1));
    Assert.assertThat(headers[0].getName(), CoreMatchers.equalTo("Location"));
}
{code}

> Can't handle the response for the remote server send response and close connection
> ----------------------------------------------------------------------------------
>
>                 Key: HTTPASYNC-146
>                 URL: https://issues.apache.org/jira/browse/HTTPASYNC-146
>             Project: HttpComponents HttpAsyncClient
>          Issue Type: Bug
>    Affects Versions: 4.1.3
>            Reporter: Eric Lan
>            Priority: Major
>
> When the server return response, such as HTTP 301 for redirect,  and close the connection. 
> The AbstractMessageParser#parse will return null.
> {code}
> HTTP/1.1 301 Moved\r\nLocation: /redirect\r\n
> {code}
> *Notice: there is no last \r\n to mark there is no more headers but the server close the connection*



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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