diff options
Diffstat (limited to 'doc/src/manual/cowboy_stream.asciidoc')
-rw-r--r-- | doc/src/manual/cowboy_stream.asciidoc | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/doc/src/manual/cowboy_stream.asciidoc b/doc/src/manual/cowboy_stream.asciidoc index 65bd06e..25a9cf9 100644 --- a/doc/src/manual/cowboy_stream.asciidoc +++ b/doc/src/manual/cowboy_stream.asciidoc @@ -52,11 +52,11 @@ HTTP/1.1 will initialize a stream only when the request-line and all headers have been received. When errors occur before that point Cowboy will call the callback `early_error/5` with a partial request, the error reason and the response -Cowboy intends to send. All other events go throuh the +Cowboy intends to send. All other events go through the stream handler using the normal callbacks. HTTP/2 will initialize the stream when the `HEADERS` block has -been fully received and decoded. Any protocol error occuring +been fully received and decoded. Any protocol error occurring before that will not result in a response being sent and will therefore not go through the stream handler. In addition Cowboy may terminate streams without sending an HTTP response @@ -84,6 +84,13 @@ the `early_error/5` callback must return a response command. // @todo The logger option and the {log, Level, Format, Args} // options need to be documented and tested. +The order in which the commands are given matters. For example, +when sending a response and at the same time creating a new child +process, the first command should be the `spawn` and the second the +`response`. The reason for that is that the sending of the response +may result in a socket error which leads to the termination of +the connection before the rest of the commands are executed. + The following commands are defined: [[inform_command]] @@ -236,6 +243,8 @@ will end successfully as far as the client is concerned. To indicate that an error occurred, either use `error_response` before stopping, or use `internal_error`. +No other command can be executed after the `stop` command. + === internal_error Stop the stream with an error. @@ -278,7 +287,7 @@ This can also be used to override stream handler options. For example this is supported by link:man:cowboy_compress_h(3)[cowboy_compress_h(3)]. -Not all options can be overriden. Please consult the +Not all options can be overridden. Please consult the relevant option's documentation for details. == Predefined events @@ -335,7 +344,7 @@ fin() :: fin | nofin ---- Used in commands and events to indicate that this is -the end of the stream. +the end of a direction of a stream. === partial_req() |