Fixed NullPointerException during HTTP/1.1 -> HTTP/2 upgrades.

The upgrade could happen in the context of a HttpParser.parseNext()
call, which eventually upgrades the EndPoint, passing what remains in
the NetworkBuffer to the new Connection and releasing the NetworkBuffer.

The messageComplete() parser callback was still returning false even
if the response was 101, causing the HTTP/1.1 parser to continue, but
now the NetworkBuffer was null, producing the NullPointerException.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
Simone Bordet 2020-11-27 13:50:09 +01:00
parent ce4bb35e97
commit 963ea59e75
1 changed files with 4 additions and 1 deletions

View File

@ -371,7 +371,10 @@ public class HttpReceiverOverHTTP extends HttpReceiver implements HttpParser.Res
complete = true;
}
return !responseSuccess(exchange);
boolean stopParsing = !responseSuccess(exchange);
if (status == HttpStatus.SWITCHING_PROTOCOLS_101)
stopParsing = true;
return stopParsing;
}
@Override