From 1bb95a639cc90500014c4783db4416c2898e5166 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Sun, 23 Jul 2017 19:59:12 +0200 Subject: Update the Cowboy 2.0 docs --- docs/en/cowboy/2.0/guide/broken_clients/index.html | 203 --------------------- 1 file changed, 203 deletions(-) delete mode 100644 docs/en/cowboy/2.0/guide/broken_clients/index.html (limited to 'docs/en/cowboy/2.0/guide/broken_clients/index.html') diff --git a/docs/en/cowboy/2.0/guide/broken_clients/index.html b/docs/en/cowboy/2.0/guide/broken_clients/index.html deleted file mode 100644 index 41e8d59f..00000000 --- a/docs/en/cowboy/2.0/guide/broken_clients/index.html +++ /dev/null @@ -1,203 +0,0 @@ - - - - - - - - - - - - Nine Nines: Dealing with 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.

-
-
-
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.

-
-
- - - - - - - - - - - - -
- -
- - -

- Cowboy - 2.0 - - User Guide -

- - - -

Navigation

- -

Version select

- - -
-
-
-
- - - - - - - - - -- cgit v1.2.3