Age | Commit message (Collapse) | Author |
|
https://tools.ietf.org/html/draft-ietf-hybi-permessage-compression-19
This also fixes some previously unknown issues with UTF-8
handling and simplifies the interface for parsing frames.
|
|
|
|
Code extracted from Cowboy and generalized. There are no tests
in this file: the code is tested with Autobahntestsuite through
the Cowboy test suite.
There currently is no function to build a masked frame.
|
|
|
|
About the same except for functions with tons of tests per clauses,
like parse_content_language/1.
|
|
Also rename the macros for inline lowercasing to ?LOWER,
and move the type detection macros to cow_parse.hrl.
|
|
|
|
|
|
From RFC7235.
See cow_http_hd:parse_www_authenticate/1.
|
|
From RFC7235, RFC2617 and RFC6750.
Features an attempt at simplifying the code using ?IS_WS macro.
|
|
From RFC7235.
See cow_http_hd:parse_authorization/1.
|
|
Supports Basic, Digest and Bearer schemes only.
From RFC7235, RFC2617 and RFC6750.
|
|
|
|
From thin air.
|
|
From RFC7230 and RFC3986.
The new function now validates that the characters are correct,
but does not go as far as validate segment sizes or number of
segments. Its main purpose is still to split host and port.
|
|
We go for an exact <<"no-cache">> match because this is the only
directive that was ever defined, because the header is only kept
for backward compatible reasons with HTTP/1.0 caches, and because
for all other uses the cache-control header is preferred.
|
|
Negative number.
|
|
From RFC7233.
|
|
From RFC7233.
|
|
From RFC7233.
|
|
From RFC7233.
|
|
|
|
From RFC7231.
|
|
|
|
We now ensure that the tokens are made of token characters only.
|
|
From RFC7231.
|
|
From RFC7234.
|
|
From RFC7231.
|
|
|
|
|
|
Follow-up from the change that ensured we don't get any
extra whitespace following the value. We can now call
binary_to_integer/1 which is more efficient.
|
|
From RFC6455.
Ho ho ho!
|
|
From RFC6455.
|
|
|
|
From RFC6455.
These base64 values are expected to be matched directly in the
first case, or hashed to generate a new base64 value, therefore
no parsing or validation is required.
|
|
|
|
From RFC7230.
|
|
We now expect Cowboy or any other application to remove it before
calling the header parse function.
|
|
From RFC7234.
|
|
We limit input to 50 items maximum.
|
|
|
|
From RFC7230.
|
|
|
|
|
|
From RFC7231 and RFC5646.
The ABNF for language tags is terrible. It makes parsing efficiently
a big challenge and the result is this huge ugly set of functions.
Thankfully triq allows us to make sure the implementation is correct.
A large number of examples has also been extracted from both RFCs.
The various ?IS_ALPHA(C), ?IS_TOKEN(C) and so on have received a
change: they now use 'orelse' instead of ';'. This is because in
this new code we need to check more than one character per clause.
The compilation time for this module increased dramatically.
Apparently happens because the guards are too big. Using ranges
($a =< C =< $z) instead of the current solution makes compilation
much faster, but the function executes twice as slow which is not
acceptable.
|
|
From RFC7231.
|
|
|
|
From RFC6455.
This function is about 3 times faster than the current Cowboy code.
|
|
|
|
From RFC6455.
The code is slower than a plain binary_to_integer(Version),
because it enforces that the value is in the 0..255 range as
per the specification, and that the input binary is no longer
than 3 characters.
It is however better to enforce this because the client could
also send a huge integer and we don't really want to convert it
and waste resources.
|