{"action":"created","issue":{"url":"https://api.github.com/repos/eclipse/vert.x/issues/2184","repository_url":"https://api.github.com/repos/eclipse/vert.x","labels_url":"https://api.github.com/repos/eclipse/vert.x/issues/2184/labels{/name}","comments_url":"https://api.github.com/repos/eclipse/vert.x/issues/2184/comments","events_url":"https://api.github.com/repos/eclipse/vert.x/issues/2184/events","html_url":"https://github.com/eclipse/vert.x/issues/2184","id":267206022,"number":2184,"title":"[BUG] 3.5.0 - HTTP - Connection: close","user":{"login":"leobispo","id":1667961,"avatar_url":"https://avatars1.githubusercontent.com/u/1667961?v=4","gravatar_id":"","url":"https://api.github.com/users/leobispo","html_url":"https://github.com/leobispo","followers_url":"https://api.github.com/users/leobispo/followers","following_url":"https://api.github.com/users/leobispo/following{/other_user}","gists_url":"https://api.github.com/users/leobispo/gists{/gist_id}","starred_url":"https://api.github.com/users/leobispo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leobispo/subscriptions","organizations_url":"https://api.github.com/users/leobispo/orgs","repos_url":"https://api.github.com/users/leobispo/repos","events_url":"https://api.github.com/users/leobispo/events{/privacy}","received_events_url":"https://api.github.com/users/leobispo/received_events","type":"User","site_admin":false},"labels":[{"id":288937350,"url":"https://api.github.com/repos/eclipse/vert.x/labels/Invalid","name":"Invalid","color":"207de5","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":48,"created_at":"2017-10-20T15:04:37Z","updated_at":"2017-10-27T07:32:32Z","closed_at":null,"author_association":"NONE","body":"Hi all,\r\n\r\nFirst of all, Thank you for the amazing work with vertx.\r\n\r\nI am testing the Version 3.5.0 with an nginx reverse proxy.\r\n\r\nIf I turn off the keep-alive functionality, the HttpServerResponseImpl is not answering anything.\r\n\r\nYou can test using the following HTTP requests:\r\n\r\n# Not working\r\n\r\n```\r\nGET / HTTP/1.0.\r\nHost: my-server.com\r\nX-Real-IP: 127.0.0.1.\r\nX-Forwarded-For: 127.0.0.1.\r\nConnection: close.\r\nCache-Control: max-age=0.\r\nUpgrade-Insecure-Requests: 1.\r\nUser-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.79 Safari/537.36.\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8.\r\nAccept-Encoding: gzip, deflate.\r\nAccept-Language: pt-BR,pt;q=0.8,en-US;q=0.6,en;q=0.4.\r\n.\r\n```\r\n\r\n# Working\r\n\r\n```\r\nGET / HTTP/1.1.\r\nHost: my-server.com\r\nX-Real-IP: 127.0.0.1.\r\nX-Forwarded-For: 127.0.0.1.\r\nCache-Control: max-age=0.\r\nUpgrade-Insecure-Requests: 1.\r\nUser-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.79 Safari/537.36.\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8.\r\nAccept-Encoding: gzip, deflate.\r\nAccept-Language: pt-BR,pt;q=0.8,en-US;q=0.6,en;q=0.4.\r\n.\r\n```\r\n\r\nThis is because of the `Connection: close`\r\n\r\nAfter a debug, I found that if HttpServerResponseImpl line 442 keepAlive is false, it is working as expected\r\n\r\n```JAVA\r\n    if (!keepAlive) {\r\n      closeConnAfterWrite();\r\n      closed = true;\r\n    }\r\n```\r\n\r\nSo I suspect that the closeConnAfterWrite is not working as expected.\r\n\r\nI would appreciate if you can take a look on it.\r\n"},"comment":{"url":"https://api.github.com/repos/eclipse/vert.x/issues/comments/339895929","html_url":"https://github.com/eclipse/vert.x/issues/2184#issuecomment-339895929","issue_url":"https://api.github.com/repos/eclipse/vert.x/issues/2184","id":339895929,"user":{"login":"vietj","id":225674,"avatar_url":"https://avatars2.githubusercontent.com/u/225674?v=4","gravatar_id":"","url":"https://api.github.com/users/vietj","html_url":"https://github.com/vietj","followers_url":"https://api.github.com/users/vietj/followers","following_url":"https://api.github.com/users/vietj/following{/other_user}","gists_url":"https://api.github.com/users/vietj/gists{/gist_id}","starred_url":"https://api.github.com/users/vietj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vietj/subscriptions","organizations_url":"https://api.github.com/users/vietj/orgs","repos_url":"https://api.github.com/users/vietj/repos","events_url":"https://api.github.com/users/vietj/events{/privacy}","received_events_url":"https://api.github.com/users/vietj/received_events","type":"User","site_admin":false},"created_at":"2017-10-27T07:32:32Z","updated_at":"2017-10-27T07:32:32Z","author_association":"CONTRIBUTOR","body":"I see internally this happening when the connection close header is sent\r\n\r\n```\r\nio.netty.handler.codec.EncoderException: java.lang.IllegalStateException: unexpected message type: io.netty.handler.codec.http.DefaultHttpContent (expected: HttpResponse)\r\n\tat io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:106)\r\n\tat io.netty.handler.codec.MessageToMessageCodec.write(MessageToMessageCodec.java:116)\r\n\tat io.vertx.core.http.impl.HttpChunkContentCompressor.write(HttpChunkContentCompressor.java:36)\r\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:738)\r\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:730)\r\n\tat io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:816)\r\n\tat io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:723)\r\n\tat io.netty.handler.stream.ChunkedWriteHandler.doFlush(ChunkedWriteHandler.java:304)\r\n\tat io.netty.handler.stream.ChunkedWriteHandler.flush(ChunkedWriteHandler.java:137)\r\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeFlush0(AbstractChannelHandlerContext.java:776)\r\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeFlush(AbstractChannelHandlerContext.java:768)\r\n\tat io.netty.channel.AbstractChannelHandlerContext.flush(AbstractChannelHandlerContext.java:749)\r\n\tat io.vertx.core.net.impl.ConnectionBase.endReadAndFlush(ConnectionBase.java:88)\r\n\tat io.vertx.core.impl.ContextImpl.lambda$wrapTask$2(ContextImpl.java:342)\r\n\tat io.vertx.core.impl.ContextImpl.executeFromIO(ContextImpl.java:200)\r\n\tat io.vertx.core.net.impl.VertxHandler.channelReadComplete(VertxHandler.java:140)\r\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelReadComplete(AbstractChannelHandlerContext.java:398)\r\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelReadComplete(AbstractChannelHandlerContext.java:380)\r\n\tat io.netty.channel.AbstractChannelHandlerContext.fireChannelReadComplete(AbstractChannelHandlerContext.java:373)\r\n\tat io.netty.channel.ChannelInboundHandlerAdapter.channelReadComplete(ChannelInboundHandlerAdapter.java:97)\r\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelReadComplete(AbstractChannelHandlerContext.java:398)\r\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelReadComplete(AbstractChannelHandlerContext.java:380)\r\n\tat io.netty.channel.AbstractChannelHandlerContext.fireChannelReadComplete(AbstractChannelHandlerContext.java:373)\r\n\tat io.netty.channel.ChannelInboundHandlerAdapter.channelReadComplete(ChannelInboundHandlerAdapter.java:97)\r\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelReadComplete(AbstractChannelHandlerContext.java:398)\r\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelReadComplete(AbstractChannelHandlerContext.java:380)\r\n\tat io.netty.channel.AbstractChannelHandlerContext.fireChannelReadComplete(AbstractChannelHandlerContext.java:373)\r\n\tat io.netty.handler.codec.ByteToMessageDecoder.channelReadComplete(ByteToMessageDecoder.java:324)\r\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelReadComplete(AbstractChannelHandlerContext.java:398)\r\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelReadComplete(AbstractChannelHandlerContext.java:380)\r\n\tat io.netty.channel.AbstractChannelHandlerContext.fireChannelReadComplete(AbstractChannelHandlerContext.java:373)\r\n\tat io.netty.channel.DefaultChannelPipeline$HeadContext.channelReadComplete(DefaultChannelPipeline.java:1364)\r\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelReadComplete(AbstractChannelHandlerContext.java:398)\r\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelReadComplete(AbstractChannelHandlerContext.java:380)\r\n\tat io.netty.channel.DefaultChannelPipeline.fireChannelReadComplete(DefaultChannelPipeline.java:941)\r\n\tat io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:139)\r\n\tat io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:645)\r\n\tat io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:580)\r\n\tat io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:497)\r\n\tat io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:459)\r\n\tat io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858)\r\n\tat java.lang.Thread.run(Thread.java:748)\r\nCaused by: java.lang.IllegalStateException: unexpected message type: io.netty.handler.codec.http.DefaultHttpContent (expected: HttpResponse)\r\n\tat io.netty.handler.codec.http.HttpContentEncoder.ensureHeaders(HttpContentEncoder.java:240)\r\n\tat io.netty.handler.codec.http.HttpContentEncoder.encode(HttpContentEncoder.java:96)\r\n\tat io.netty.handler.codec.http.HttpContentEncoder.encode(HttpContentEncoder.java:51)\r\n\tat io.netty.handler.codec.MessageToMessageCodec$1.encode(MessageToMessageCodec.java:67)\r\n\tat io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:88)\r\n\t... 41 more\r\n```"}}
{"actor":{"display_login":"vietj"}}