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

Any HTTP/1.1 request causes an NPE when using HTTP11 and H2C protocols and access logging is enabled #1610

Closed
wilkinsona opened this issue Apr 24, 2021 · 0 comments · Fixed by #1611
Assignees
Labels
type/bug A general bug
Milestone

Comments

@wilkinsona
Copy link

Expected Behavior

Access logging should work.

Actual Behavior

Enabling access logging causes a NullPointerException in AccessLogHandlerH1.write.

Steps to Reproduce

import reactor.core.publisher.Mono;
import reactor.netty.DisposableServer;
import reactor.netty.http.HttpProtocol;
import reactor.netty.http.server.HttpServer;

public class AccessLoggingApplication {

	public static void main(String[] args) {
		System.setProperty("reactor.netty.http.server.accessLogEnabled", "true");
		DisposableServer server = HttpServer.create().port(8080).protocol(HttpProtocol.HTTP11, HttpProtocol.H2C)
				.handle((request, response) -> response.sendString(Mono.just("hello"))).bindNow();
		server.onDispose().block();
	}

}

Run the above and make an HTTP/1.1 request to localhost:8080 such as curl localhost:8080. It also fails when attempting an upgrade to HTTP/2 such as curl --http2 localhost:8080. It works when assuming prior knowledge and using HTTP/2 from the outset such as curl --http2-prior-knowledge localhost:8080.

Your Environment

  • Reactor version(s) used: Reactor Netty 1.0.6, Reactor 3.4.5
  • Other relevant libraries versions (eg. netty, ...): Netty 4.1.63
  • JVM version (java -version): openjdk version "1.8.0_282"
  • OS and version (eg. uname -a): macOS 10.15.7
@wilkinsona wilkinsona added status/need-triage A new issue that still need to be evaluated as a whole type/bug A general bug labels Apr 24, 2021
@violetagg violetagg removed the status/need-triage A new issue that still need to be evaluated as a whole label Apr 26, 2021
@violetagg violetagg self-assigned this Apr 26, 2021
@violetagg violetagg added this to the 1.0.7 milestone Apr 26, 2021
violetagg added a commit that referenced this issue Apr 26, 2021
… HTTP server supports both HTTP/1.1 and HTTP/2 clear text

Remove the extra HTTP/1.1 handlers from the pipeline when upgrading from HTTP/1.1 to HTTP/2 clear text

Fixes #1610
violetagg added a commit that referenced this issue Apr 26, 2021
… HTTP server supports both HTTP/1.1 and HTTP/2 clear text (#1611)

Remove the extra HTTP/1.1 handlers from the pipeline when upgrading from HTTP/1.1 to HTTP/2 clear text

Fixes #1610
@wilkinsona wilkinsona changed the title Any HTTP/1.1 request causes an NPE when using HTTP11 and H2C protocols and accessing logging is enabled Any HTTP/1.1 request causes an NPE when using HTTP11 and H2C protocols and access logging is enabled Apr 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug A general bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants