2016-09-07 16:39 GMT+08:00 Simone Bordet <sbor...@webtide.com>:

> Hi,
>
> On Wed, Sep 7, 2016 at 7:56 AM, John Jiang <john.sha.ji...@gmail.com>
> wrote:
> > But I still found something interesting.
> > In my webapp, /body is a pretty simple Servlet, which just print
> something.
>
> Your servlet does one important thing: it calls
> request.getInputStream(), which triggers the send of the 100 Continue
> response.
>
> > If using a static file, like https://localhost:9021/index, namely,
> > curl -k --http2 -H "Expect: 100-continue" -d "body"
> > https://localhost:9021/index
> > it looks no error.
> > But if add -v option for curl, namley
> > curl -vk --http2 -H "Expect: 100-continue" -d "body"
> > https://localhost:9021/index
> > I met: curl: (92) HTTP/2 stream 1 was not closed cleanly: CANCEL (err 8)
> >
> > I tried several times.
> > 1. If accessing a Servlet, there is no error.
> > 2. If accessing a static page, the following error raised: curl: (92)
> HTTP/2
> > stream 1 was not closed cleanly: CANCEL (err 8)
> >
> > Is it a problem?
>
> What happens is that Jetty's DefaultServlet, which serves static
> content, does not read the request body (because it does not expect
> one).
> Because it does not read the request body, it does not send the 100
> Continue response to the client.
> DefaultServlet generates a 200 OK response with the static file
> content as the response body.
> Jetty then sees that the request is not finished, but nobody will ever
> read the request body, so it generates a reset with code CANCEL to
> tell the client to not send the content.
> In HTTP/1.1 the server would have closed the connection.
>
> What you see is the right behavior.
>
Tested the same cases with Apache 2.4.17, but no such message found.
It looks Apache uses NO_ERROR.
And for HTTP/1.1, Apache doesn't send "Connection: close"

I didn't try other server implementations.


> --
> Simone Bordet
> ----
> http://cometd.org
> http://webtide.com
> Developer advice, training, services and support
> from the Jetty & CometD experts.
> _______________________________________________
> jetty-users mailing list
> jetty-users@eclipse.org
> To change your delivery options, retrieve your password, or unsubscribe
> from this list, visit
> https://dev.eclipse.org/mailman/listinfo/jetty-users
>
_______________________________________________
jetty-users mailing list
jetty-users@eclipse.org
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users

Reply via email to