-
Notifications
You must be signed in to change notification settings - Fork 595
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
Using half-closed connections in Http().serverLayer #94
Comments
Comment by jrudolph @Quizzie you rely on a half-closed TCP connection (or stream in your case) to work with HTTP. This is currently not supported by akka-http. I.e. it will not work to close the input byte stream before having received the response. |
Comment by MichaelZinsmaier After reading more about half-closed TCP and HTTP related Akka Client Ticket, 2001 W3C post, ... => maybe its not a bug its a feature request (-: justificationtldr. a type A HTTP server is more defensive and standalone usage of the serverLayer would benefit From a HTTP perspectiveIf there are major HTTP server implementations that treat half close as abort client implementations should not depend on it (they should be type 2 like the Akka HTTP client)
From a stream perspective:The docs state that: "... [the server Layer] can be useful ... to "run" the HTTP layer (and, potentially, higher-layers) against data that do not come from the network but rather some other source. Potential scenarios where this might be useful include tests, debugging or low-level event-sourcing (e.g by replaying network traffic)." Ok lets assume I record HTTP requests into files and want to replay them later on. The problem is that there is no client application and thus no out of band knowledge about the number of responses I expect.
=> I suggest either implementing the serverLayer as type A server or having a more low level API that splits up parsing and HTTP protocol handling (to be able to inject some custom code) aside from that having a type B server is proably just fine in most cases (-: Best Michael |
Comment by jrudolph I don't disagree with your assessment. I guess one reason we disabled it at some point is that figuring out closing conditions correctly is often quite hard and it's easy to create leaks this way. |
Comment by ktoso In any case – removing bug marker that that's cleared out. |
Comment by Quizzie Alright, let's consider this issue to be a feature request. |
Comment by ktoso FYI, half closed stuff again @johanandren - WDYT? |
Comment by johanandren Not sure I have an opinion, seems hard to get right, and this one in particular probably won't cause problems for many people. Maybe just make sure to document that this is how it works, unless someone wants to contribute a solution? |
More relevant upstream discussion: httpwg/http-core#22 |
Issue by Quizzie
Thursday Jan 07, 2016 at 12:55 GMT
Originally opened as akka/akka#19373
In Akka HTTP version 2.0.1 the
Http().serverLayer
doesn't work correctly. If one sends an HTTP request through theHttp().serverLayer
and then an HTTP response in the other direction, the stream completes before the response is passed through.A demonstration is shown in this project: https://github.com/Quizzie/server-layer-bug
The
bug.serverlayer.ServerLayerTest
is a test which uses theHttp().serverLayer
as an HTTP parser.The test in the
master
branch shows that it works correctly in Akka HTTP version 1.0.The test in the
version-2.0.1
branch shows that it breaks in Akka HTTP version 2.0.1 (the test fails).The text was updated successfully, but these errors were encountered: