Age | Commit message (Collapse) | Author |
|
Introduces 3 low level functions and updates the existing higher
levels functions. The new primitives are has_body/1, body_length/1
and stream_body/1. In addition to that, a helper function
init_stream/4 has been added.
Streaming a body implies to decode the Transfer-Encoding and
Content-Encoding used for the body. By default, Cowboy will try
to figure out what was used and decode them properly. You can
override this if you want to disable this behavior or simply
support more encodings by calling the init_stream/4 function
before you start streaming the body.
|
|
Certain user agents send slightly invalid media types, like the
following: "text/html, image/gif, image/jpeg, ; q=.2, */; q=.2"
The user agent with which this behavior was observed presented itself
with the User-Agent string: "Mozilla/5.0 (Macintosh; U; Intel Mac OS X
10.6; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6 (FlipboardProxy/0.0.5;
+http://flipboard.com/browserproxy)"
|
|
|
|
This was initially an internal function, it has been made public
due to popular demand as it can sometimes be needed.
|
|
At the same time renaming cowboy_http:content_type_params/3 to
cowboy_http:params/2 (with a default Acc of []) as this code isn't
useful only for content types.
|
|
|
|
At the same time rename http_headers/0 to cowboy_http:headers/0.
|
|
|
|
|
|
Exported types are much better than include files.
|
|
Conflicts:
src/cowboy_http_req.erl
test/http_SUITE.erl
|
|
|
|
|
|
This is a workaround for an issue in the hipe compiler where
compilation of code matching on binaries using patterns of the
form Data = <<Char, _Ignore/bits>> fails because _Ignore is
expected to be used. Using /binary instead of /bits resolves
the issue.
We're applying this change to all binary expressions in cowboy_http
because all functions in this module process human readable text
formats which are always expected to be bytestrings.
Two uses of /bits has been changed to /binary in cowboy_http_websocket
in two clauses of a single function, websocket_data/4. This is safe
to change because the data is later passed to binary:match/2 which
will always fail with a badarg error if the input is a bitstring
instead of a bytestring.
|
|
This function complements the cowboy_http:urldecode/2
and urldecode/1 functions. We should have this encoding
covered now. urldecode is only expected to be invoked
by user code, no further changes needed to integrate this.
|
|
This change makes the dependency on quoted optional
by adding a minimal urldecode function to cowboy.
A protocol option for setting the urldecoding function
has been added to the cowboy_http_protocol module.
The default value for this option is set to be
equivalent to the default settings for quoted.
{fun cowboy_http:urldecode/2, crash}
A note has been added in the README to document
how to use quoted instead of this function.
A field to store this option value has been added
to the state record in the cowboy_http_protocol
module and the http_req record in include/http.hrl
Functions that previously used quoted:from_url/1
has been updated to require an equivalent function
in addition to the previously required arguments.
This change removes a C compiler from the build
requirements of cowboy. It also removes the requirement
to cross compile the code if the target arch/OS
is different from the arch/OS used to build it.
|
|
Considering how it must be used, a simple binary is much better
than a tag and a list of subtags. We still parse them like this
to make sure they follow the specs, though.
|
|
Spotted by devinus on IRC.
|
|
|
|
|
|
|
|
Used to parse either a token or a quoted string in parameters values.
|
|
|
|
|
|
|
|
Implementing the full HTTP-date type (RFC1123, RFC850, asctime).
|
|
Conflicts:
src/cowboy_http.erl
|
|
|
|
|
|
Sorry I apparently used an outdated RFC when I was doing this.
|
|
|
|
|
|
|
|
Rework the cowboy_http_req:parse_header/2 function while I was at it.
|
|
|
|
|
|
Introduce cowboy_http's list/2, nonempty_list/2, token/2 functions.
|
|
Replaces the 'Connection' interpretation in cowboy_http_protocol
from raw value to the parsed value, looking for a single token
matching close/keep-alive instead of the whole raw value (which
could contain more than one token, for example with Firefox 6+
using websocket).
Introduce the functions cowboy_http_req:parse_header/2 and /3
to semantically parse the header values and return a proper
Erlang term.
|