diff options
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/guide/book.asciidoc | 2 | ||||
-rw-r--r-- | doc/src/guide/broken_clients.asciidoc | 62 | ||||
-rw-r--r-- | doc/src/guide/streams.asciidoc | 7 |
3 files changed, 0 insertions, 71 deletions
diff --git a/doc/src/guide/book.asciidoc b/doc/src/guide/book.asciidoc index 063560e..3ab3cb6 100644 --- a/doc/src/guide/book.asciidoc +++ b/doc/src/guide/book.asciidoc @@ -94,6 +94,4 @@ chapters may or may not be useful. include::architecture.asciidoc[Architecture] -include::broken_clients.asciidoc[Dealing with broken clients] - include::overview.asciidoc[Overview] diff --git a/doc/src/guide/broken_clients.asciidoc b/doc/src/guide/broken_clients.asciidoc deleted file mode 100644 index 1d1a51a..0000000 --- a/doc/src/guide/broken_clients.asciidoc +++ /dev/null @@ -1,62 +0,0 @@ -[[broken_clients]] -== Dealing with broken clients - -There exists a very large number of implementations for the -HTTP protocol. Most widely used clients, like browsers, -follow the standard quite well, but others may not. In -particular custom enterprise clients tend to be very badly -written. - -Cowboy tries to follow the standard as much as possible, -but is not trying to handle every possible special cases. -Instead Cowboy focuses on the cases reported in the wild, -on the public Web. - -That means clients that ignore the HTTP standard completely -may fail to understand Cowboy's responses. There are of -course workarounds. This chapter aims to cover them. - -=== Lowercase headers - -Cowboy converts all headers it receives to lowercase, and -similarly sends back headers all in lowercase. Some broken -HTTP clients have issues with that. - -A simple way to solve this is to create an `onresponse` hook -that will format the header names with the expected case. - -[source,erlang] ----- -capitalize_hook(Status, Headers, Body, Req) -> - Headers2 = [{cowboy_bstr:capitalize_token(N), V} - || {N, V} <- Headers], - cowboy_req:reply(Status, Headers2, Body, Req). ----- - -Note that HTTP/2 clients do not have that particular issue -because the specification explicitly says all headers are -lowercase, unlike HTTP which allows any case but treats -them as case insensitive. - -=== Camel-case headers - -Sometimes it is desirable to keep the actual case used by -clients, for example when acting as a proxy between two broken -implementations. There is no easy solution for this other than -forking the project and editing the `cowboy_protocol` file -directly. - -// @todo This currently has no equivalent in Cowboy 2.0. -// === Chunked transfer-encoding -// -// Sometimes an HTTP client advertises itself as HTTP/1.1 but -// does not support chunked transfer-encoding. This is invalid -// behavior, as HTTP/1.1 clients are required to support it. -// -// A simple workaround exists in these cases. By changing the -// Req object response state to `waiting_stream`, Cowboy will -// understand that it must use the identity transfer-encoding -// when replying, just like if it was an HTTP/1.0 client. -// -// [source,erlang] -// Req2 = cowboy_req:set(resp_state, waiting_stream). diff --git a/doc/src/guide/streams.asciidoc b/doc/src/guide/streams.asciidoc index a20f748..dc38a52 100644 --- a/doc/src/guide/streams.asciidoc +++ b/doc/src/guide/streams.asciidoc @@ -3,12 +3,5 @@ Placeholder chapter. -Streams are a new feature in Cowboy 2.0 that requires -a little more tweaking before they can be generally -useful. This chapter will be made available in a future -pre-release. -Streams are meant to replace hooks. The relevant chapters -for Cowboy 1.0 were: -* xref:broken_clients[Dealing with broken clients] |