Firefly v4.6.4 is released

10 Dec 2017, Alvin Qiu

Firefly v4.6.4 is a patch release. It fixes the HTTP server receives body data error when it uses HTTP2 protocol. The HTTP2 uses DATA frames to carry message payloads. The chunked transfer encoding defined in Section 4.1 of [RFC7230] MUST NOT be used in the HTTP2.

If the client can not know the data size and sends stream data that does not contain Content-Length header, the HTTPBodyHandler cannot process this case correctly. We add a compatibility method to fix this problem. Such as:

public boolean isChunked(SimpleRequest request) {
    String transferEncoding = request.getFields().get(HttpHeader.TRANSFER_ENCODING);
    return HttpHeaderValue.CHUNKED.asString().equals(transferEncoding)
            || (request.getHttpVersion() == HttpVersion.HTTP_2 && request.getContentLength() < 0);
}