aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/socket.html26
1 files changed, 23 insertions, 3 deletions
diff --git a/docs/socket.html b/docs/socket.html
index 983f1c9..570f6d5 100644
--- a/docs/socket.html
+++ b/docs/socket.html
@@ -65,13 +65,33 @@ whenever the field name is sent out.
65</p> 65</p>
66 66
67<p> 67<p>
68You can obtain the <tt>headers</tt> namespace if case run-time 68If a lowercase field name is not present as a key,
69modifications are required by running: 69<tt>socket.headers.canonic</tt> automatically derives a
70capitalization by uppercasing the first letter of each
71hyphen-separated word (e.g. <tt>x-request-id</tt> becomes
72<tt>X-Request-Id</tt>), and caches the result for later lookups.
73A small set of headers whose canonic capitalization is
74irregular (such as <tt>ETag</tt>, <tt>Content-MD5</tt>,
75<tt>MIME-Version</tt> and <tt>WWW-Authenticate</tt>) are kept as
76explicit entries in the table and are not affected by this rule.
77Because of this, <tt>pairs(socket.headers.canonic)</tt> only
78shows the irregular entries plus any field name already looked
79up or added &mdash; it is not an exhaustive list of every header
80name the library knows how to capitalize.
81</p>
82
83<p>
84You can register a custom canonic capitalization &mdash; for a
85header the automatic rule would not reproduce, such as a custom
86all-caps acronym &mdash; with <tt>socket.headers.setcanonic</tt>:
70</p> 87</p>
71 88
72<pre class="example"> 89<pre class="example">
73-- loads the headers module 90-- loads the headers module
74local headers = require("headers") 91local headers = require("socket.headers")
92
93-- register a custom capitalization
94headers.setcanonic("X-Request-ID")
75</pre> 95</pre>
76 96
77 97