diff options
author | Loïc Hoguin <[email protected]> | 2023-12-12 12:05:54 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2023-12-12 15:05:33 +0100 |
commit | efb681d74982dd048638b00c3c275091ba1d4a2a (patch) | |
tree | 1e2c4dba8002471ca3427471306da362d7c045da /doc/src | |
parent | 3f5f326b732e3dbd1c335b854e78f5927f2f48fa (diff) | |
download | cowboy-efb681d74982dd048638b00c3c275091ba1d4a2a.tar.gz cowboy-efb681d74982dd048638b00c3c275091ba1d4a2a.tar.bz2 cowboy-efb681d74982dd048638b00c3c275091ba1d4a2a.zip |
Handle socket errors in HTTP/1.1 and HTTP/2
Doing so will let us notice when the connection is gone instead
of waiting for timeouts, at least in the cases where the remote
socket was closed properly. Timeouts are still needed in case
of TCP half-open problems.
This change means that the order of stream handler commands is
more important than before because socket errors may occur
during the processing of commands.
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/manual/cowboy_stream.asciidoc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/doc/src/manual/cowboy_stream.asciidoc b/doc/src/manual/cowboy_stream.asciidoc index 148c23e..bdc56f2 100644 --- a/doc/src/manual/cowboy_stream.asciidoc +++ b/doc/src/manual/cowboy_stream.asciidoc @@ -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. |