Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #865 Remove HttpToH2Operations in favour of Http2StreamFrameToHttpObjectCodec #874

Merged
merged 1 commit into from
Oct 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import io.netty.handler.codec.http2.DefaultHttp2DataFrame;
import io.netty.handler.codec.http2.DefaultHttp2HeadersFrame;
import io.netty.handler.codec.http2.Http2DataFrame;
import io.netty.handler.codec.http2.Http2FrameStream;
import io.netty.handler.codec.http2.Http2Headers;
import io.netty.handler.codec.http2.Http2HeadersFrame;
import io.netty.handler.codec.http2.Http2StreamChannel;
Expand Down Expand Up @@ -77,23 +78,26 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception
.orElse(((SocketChannel) ctx.channel().parent()).remoteAddress());
}
if (msg instanceof Http2HeadersFrame) {
Http2HeadersFrame headersFrame = (Http2HeadersFrame)msg;
Http2HeadersFrame headersFrame = (Http2HeadersFrame) msg;
Http2FrameStream stream = headersFrame.stream();
int id = stream == null ? 0 : stream.id();

HttpRequest request;
if (headersFrame.isEndStream()) {
request = HttpConversionUtil.toFullHttpRequest(-1,
request = HttpConversionUtil.toFullHttpRequest(id,
headersFrame.headers(),
ctx.channel().alloc(),
false);
}
else {
request = HttpConversionUtil.toHttpRequest(-1,
request = HttpConversionUtil.toHttpRequest(id,
headersFrame.headers(),
false);
}
HttpToH2Operations ops = new HttpToH2Operations(Connection.from(ctx.channel()),
HttpServerOperations ops = new HttpServerOperations(Connection.from(ctx.channel()),
listener,
null,
request,
headersFrame.headers(),
ConnectionInfo.from(ctx.channel().parent(),
readForwardHeaders,
request,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
import io.netty.handler.codec.http.cookie.Cookie;
import io.netty.handler.codec.http.cookie.ServerCookieDecoder;
import io.netty.handler.codec.http.cookie.ServerCookieEncoder;
import io.netty.handler.codec.http2.HttpConversionUtil;
import io.netty.util.AsciiString;
import io.netty.util.ReferenceCountUtil;
import org.reactivestreams.Publisher;
Expand Down Expand Up @@ -236,6 +237,10 @@ public boolean isWebsocket() {
return get(channel()) instanceof WebsocketServerOperations;
}

boolean isHttp2() {
return requestHeaders().contains(HttpConversionUtil.ExtensionHeaderNames.SCHEME.text());
}

@Override
public HttpServerResponse keepAlive(boolean keepAlive) {
HttpUtil.setKeepAlive(nettyResponse, keepAlive);
Expand Down Expand Up @@ -449,6 +454,9 @@ protected void onInboundNext(ChannelHandlerContext ctx, Object msg) {
}
if (msg instanceof FullHttpRequest) {
super.onInboundNext(ctx, msg);
if (isHttp2()) {
onInboundComplete();
}
}
return;
}
Expand Down
87 changes: 0 additions & 87 deletions src/main/java/reactor/netty/http/server/HttpToH2Operations.java

This file was deleted.