aboutsummaryrefslogtreecommitdiffstats
path: root/src/cowboy_http.erl
AgeCommit message (Collapse)Author
2013-02-12Make cowboy_http.erl compile with +nativeAdam Cammack
Worked until 27da092
2013-02-06Strip whitespaces when authorization type is unknownLoïc Hoguin
2013-01-29Merge branch 'feature_basic_auth' of https://github.com/ivlis/cowboyLoïc Hoguin
2013-01-30Implement authorization header parsingIvan Lisenkov
Basic HTTP authorization according to RFC 2617 is implemented. Added an example of its usage with REST handler.
2013-01-29Fix chunked streaming of request body and improve speedLoïc Hoguin
2013-01-04Hello 2013Loïc Hoguin
2012-12-20We accept iodata() when setting cookies; fix thatLoïc Hoguin
2012-12-20Fix parsing of the Cookie headerLoïc Hoguin
This should be equivalent to what we do in Set-Cookie. Real-world testing is needed to confirm it works as intended.
2012-12-17Fix cowboy_http:cookie_to_iodata/3Loïc Hoguin
No more trying to quote, this is still completely broken everywhere.
2012-12-13Add missing quotes to quoting for cookie valuesLoïc Hoguin
2012-12-07Make cookies use universal time instead of local timeLoïc Hoguin
Includes: * cowboy_clock:rfc2109/1 now expects UTC datetime * Rewrite of the cookie code to cowboy_http * Removal of cowboy_cookies * Add type cowboy_req:cookie_opts/0 Cookies should now be set using cowboy_req:set_resp_cookie/3. Code calling cowboy_cookies directly will need to be updated.
2012-09-29Remove the urldecode cowboy_protocol optionLoïc Hoguin
This allows inconsistent behavior and is not used enough to be supported.
2012-09-27Optimize Connection header parsingLoïc Hoguin
Still optimizing the critical path. Removes cowboy_http:connection_to_atom/1.
2012-09-26Optimize cowboy_protocolLoïc Hoguin
* #state{} changes are avoided where possible * #state{} is now smaller and use less memory * the Req object is created only after the whole request is parsed * parsing makes use of a single binary match context * external calls are avoided in the critical path * URL fragment is now extracted properly (retrieval API next commit) * argument orders to local functions modified to avoid extra operations * dispatching waits as long as possible before tokenizing host/path * handler opts are no longer shown in the error messages except in init The code may not look as beautiful as it was before. But it really is, for parsing code. The parsing section of the file may be skipped if your eyes start to burn.
2012-09-23Use binary:match/2 instead of binary:split/2 in cowboy_httpLoïc Hoguin
Also fix a bug introduced in a previous commit.
2012-09-21Don't use decode_packet/3 for parsing the headersLoïc Hoguin
Header names are now binaries. Since header names are case insensitive they are all converted to lowercase. For example: <<"content-length">>. The max_line_length option was removed. Three new options have been added instead: * max_request_line_length (defaults to 4096) * max_header_name_length (defaults to 64) * max_header_value_length (defaults to 4096)
2012-09-21Don't use decode_packet/3 for parsing the request-lineLoïc Hoguin
First step in making all methods and header names binaries to get rid of many inconsistencies caused by decode_packet/3. Methods are all binary now. Note that since they are case sensitive, the usual methods become <<"GET">>, <<"POST">> and so on.
2012-09-17Replace many proplists:get_value/{2,3} calls by BIFsLoïc Hoguin
Originally suggested by Roberto Ostinelli.
2012-09-17Include the eunit file only if TEST is definedLoïc Hoguin
2012-08-27Have only one -export and -export_type per lineLoïc Hoguin
This should make easier spotting additions and removals in commits.
2012-05-23Update version to 0.6.00.6.0Loïc Hoguin
Also update the CHANGELOG and copyright years.
2012-05-21Merge branch 'fix/relax-conneg-parsing' of https://github.com/tillitech/cowboyLoïc Hoguin
2012-04-29Fix and rework the HTTP test suiteLoïc Hoguin
Use a proper HTTP client to run all tests. This client is currently undocumented and should not be used. Includes a few fixes: * Fix a bug in the max_keepalive test * Fix a bug with max_keepalive handling * Fix a bug in stream_body/1 where data was lost under some conditions The tests now run quite faster than before. All the tests now run twice: once for TCP, once for SSL.
2012-04-08Make charsets parsing more relaxedAli Sabil
Certain user agents send invalid Accept-Charset headers, like the following: "ISO-8859-1;utf-8;q=0.7,*;q=0.7" The user agent with which this behavior was observed presented itself with the User-Agent string: "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9) Gecko/2008052906 Firefox/3.0" Although this doesn't appear to be correct. The request might have been mangled by a transparent proxy.
2012-04-01Add chunked transfer encoding support and rework the body reading APILoïc Hoguin
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.
2012-03-09Make media type parsing more relaxedAli Sabil
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)"
2012-02-27Remove the redundant include/ from -include("http.hrl")Loïc Hoguin
2012-02-23Add cowboy_http:x_www_form_urlencoded/2Loïc Hoguin
This was initially an internal function, it has been made public due to popular demand as it can sometimes be needed.
2012-02-20Add 'Expect' header parsingLoïc Hoguin
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.
2012-01-23Rename the type http_status/0 to cowboy_http:status/0Loïc Hoguin
2012-01-23Rename the type http_header/0 to cowboy_http:header/0Loïc Hoguin
At the same time rename http_headers/0 to cowboy_http:headers/0.
2012-01-23Rename the type http_version/0 to cowboy_http:version/0Loïc Hoguin
2012-01-23Rename the type http_uri/0 to cowboy_http:uri/0Loïc Hoguin
2012-01-23Rename the type http_method/0 to cowboy_http:method/0Loïc Hoguin
Exported types are much better than include files.
2012-01-23Merge branch 'multipart' of https://github.com/nox/cowboyLoïc Hoguin
Conflicts: src/cowboy_http_req.erl test/http_SUITE.erl
2012-01-23Add multipart supportAnthony Ramine
2011-12-12Merge branch 'hipe-compilation-fix' of github.com:klaar/cowboyLoïc Hoguin
2011-12-10update /bits in binary expressions to /binaryMagnus Klaar
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.
2011-12-09add cowboy_http:urlencode/2 and urlencode/1Magnus Klaar
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.
2011-12-07replace quoted:from_url with cowboy_http:urldecodeMagnus Klaar
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.
2011-12-01Change the returned value for language_range parsingLoïc Hoguin
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.
2011-11-28Weekdays are binaries and not listsLoïc Hoguin
Spotted by devinus on IRC.
2011-11-24Fix specs for cowboy_http:language_range_ret/3Loïc Hoguin
2011-11-10Support 'Content-Type' in parse_header/2Anthony Ramine
2011-11-10Introduce cowboy_http:media_type/2Anthony Ramine
2011-11-10Introduce cowboy_http:word/2Anthony Ramine
Used to parse either a token or a quoted string in parameters values.
2011-11-09Add 'If-Match' and 'If-None-Match' to parse_header/2Loïc Hoguin
2011-11-07Add 'Accept-Language' to cowboy_http_req:parse_header/2Loïc Hoguin
2011-11-05Remove the IS_DIGIT macroLoïc Hoguin
2011-11-05Add 'If-Modified-Since' and 'If-Unmodified-Since' to parse_header/2Loïc Hoguin
Implementing the full HTTP-date type (RFC1123, RFC850, asctime).