use of org.webpieces.http2translations.api.Http2ToHttp11 in project webpieces by deanhiller.
the class Http11StreamImpl method process.
@Override
public XFuture<StreamWriter> process(Http2Response headers) {
closeCheck(headers);
HttpResponse response = Http2ToHttp11.translateResponse(headers);
if (http2Request.getKnownMethod() == Http2Method.CONNECT) {
// bytes so we don't care about parsing anymore(ie. SSL or http)..
return write(response).thenApply(c -> new Http11ChunkedWriter(http1Req, http2Request));
} else if (headers.isEndOfStream()) {
validateHeader(response);
remove(headers);
return write(response).thenApply(w -> {
permitQueue.releasePermit();
return new NoWritesWriter();
});
} else if (contentLengthGreaterThanZero(headers)) {
return write(response).thenApply(w -> new ContentLengthResponseWriter(headers));
}
return write(response).thenApply(c -> new Http11ChunkedWriter(http1Req, http2Request));
}
Aggregations