Fixes #4764 - HTTP2 Jetty Server does not send back content-length.

Fixed InterleavingTest that was using the wrong MetaData.Response constructor.
Fixed handling of HEAD methods in HttpTransportOverHTTP2.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
Simone Bordet 2020-04-14 13:05:24 +02:00
parent 3e96bf8621
commit 0e30d6b751
2 changed files with 3 additions and 3 deletions

View File

@ -111,7 +111,7 @@ public class InterleavingTest extends AbstractTest
Stream serverStream1 = serverStreams.get(0);
Stream serverStream2 = serverStreams.get(1);
MetaData.Response response1 = new MetaData.Response(HttpVersion.HTTP_2, HttpStatus.OK_200, new HttpFields(), 0);
MetaData.Response response1 = new MetaData.Response(HttpVersion.HTTP_2, HttpStatus.OK_200, new HttpFields());
serverStream1.headers(new HeadersFrame(serverStream1.getId(), response1, null, false), Callback.NOOP);
Random random = new Random();
@ -120,7 +120,7 @@ public class InterleavingTest extends AbstractTest
byte[] content2 = new byte[2 * ((ISession)serverStream2.getSession()).updateSendWindow(0)];
random.nextBytes(content2);
MetaData.Response response2 = new MetaData.Response(HttpVersion.HTTP_2, HttpStatus.OK_200, new HttpFields(), 0);
MetaData.Response response2 = new MetaData.Response(HttpVersion.HTTP_2, HttpStatus.OK_200, new HttpFields());
serverStream2.headers(new HeadersFrame(serverStream2.getId(), response2, null, false), new Callback()
{
@Override

View File

@ -119,7 +119,7 @@ public class HttpTransportOverHTTP2 implements HttpTransport
{
info.setContentLength(realContentLength);
}
else if (contentLength != realContentLength)
else if (hasContent && contentLength != realContentLength)
{
callback.failed(new BadMessageException(HttpStatus.INTERNAL_SERVER_ERROR_500, String.format("Incorrect Content-Length %d!=%d", contentLength, realContentLength)));
return;