aboutsummaryrefslogtreecommitdiffstats
path: root/src/cowboy_req.erl
AgeCommit message (Collapse)Author
2013-02-11Better handle socket closing with loop handlersLoïc Hoguin
We now read from the socket to be able to detect errors or TCP close events, and buffer the data if any. Once the data receive goes over a certain limit, which defaults to 5000 bytes, we simply close the connection with an {error, overflow} reason.
2013-02-06Fix crashes when creating the requestLoïc Hoguin
We now obtain the peer address before creating the Req object. If an error occurs, then something went wrong, we close the connection nicely directly.
2013-02-06Merge branch 'master' of git://github.com/tsloughter/cowboyLoïc Hoguin
2013-02-01add guards on set_resp_body_fun for streamlen and streamfunTristan Sloughter
2013-01-30Make sure the peer name is always availableLoï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-22Remove cowboy_dispatcherLoïc Hoguin
Types and code are moved to cowboy_router. The match/3 export from cowboy_dispatcher isn't available anymore as it is called internally.
2013-01-20Fix an issue for replies in onresponse mishandling headersLoïc Hoguin
Reported and fixed over email by Adrian Roe.
2013-01-20Add missing clause to cowboy_req:has_resp_body/1Loïc Hoguin
2013-01-19Make cowboy_req:has_body/1 return boolean()Loïc Hoguin
This makes it similar to the other has_* functions.
2013-01-18Remove a few old @todo commentsLoïc Hoguin
2013-01-14Add Sec-Websocket-Protocol header parsingLoïc Hoguin
2013-01-07Add optional automatic response body compressionLoïc Hoguin
This behavior can be enabled with the `compress` protocol option. See the `compress_response` example for more details. All tests are now ran with and without compression for both HTTP and HTTPS.
2013-01-05Add cowboy_req:set_resp_body_fun/2Loïc Hoguin
This allows streaming a body without knowing the length in advance. Also allows {stream, StreamFun} response body in the REST code.
2013-01-05Remove cowboy_req:transport/1Loïc Hoguin
It was added to help with response body streaming functions. But it was a clumsy solution that we discarded in favor of passing socket and transport to said function. It was also very odd compared to the rest of the cowboy_req interface. If you used this function before, worry not, here's its proper equivalent. [Socket, Transport] = cowboy_req:get([socket, transport], Req)
2013-01-05Change the response body streaming fun interfaceLoïc Hoguin
Before we were required to get the socket and transport ourselves, now they're passed to the function.
2013-01-04Hello 2013Loïc Hoguin
2012-12-26Remove cowboy_req:body/2Loïc Hoguin
This function was badly thought out and would cause more harm than good if used at all. Recommendation will be for people who need to limit body length to check it beforehand or when not possible to use the stream_body API.
2012-12-23Revert "Use lists:keyreplace/4 instead of lists:keydelete/3 + cons"Loïc Hoguin
This reverts commit cc65a723d70bb078b048bab81eeb8a4bd7ed39ce.
2012-12-22Merge branch 'undefined_url' of git://github.com/treetopllc/cowboyLoïc Hoguin
2012-12-22Use lists:keyreplace/4 instead of lists:keydelete/3 + consLoïc Hoguin
2012-12-17Fix cowboy_http:cookie_to_iodata/3Loïc Hoguin
No more trying to quote, this is still completely broken everywhere.
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-11-27url and host_url may return undefinedTom Burdick
this can happen when the request parsing fails and onresponse needs the url, its perfectly possible that the url has not yet been defined
2012-11-27Do not try to keep-alive when using HTTP/1.0Loïc Hoguin
2012-10-11Do not remove duplicated Set-Cookie entriesJosé Valim
This commit closes #195, closes #199, closes #246.
2012-10-11Cleanup cowboy_req:parse_header/3Loïc Hoguin
As suggested by @yrashk.
2012-10-04The onresponse hook now receives 4 arguments, including the bodyLoïc Hoguin
We do not always provide the body however. It is not available when using chunked replies, or when using set_resp_body_fun.
2012-10-04Fix the parsing of the Connection headerLoïc Hoguin
2012-09-29Remove a redundant functionLoïc Hoguin
2012-09-29Merge pull request #254 from billiob/masterLoïc Hoguin
fix typo in doc
2012-09-29Fix a small edoc issueLoïc Hoguin
2012-09-29Remove the urldecode cowboy_protocol optionLoïc Hoguin
This allows inconsistent behavior and is not used enough to be supported.
2012-09-29Add cowboy_req:get/2 and :set/2 private functionsLoïc Hoguin
They should not be used unless you have a very special need, which generally involves interacting with the internals of Cowboy.
2012-09-27Optimize Connection header parsingLoïc Hoguin
Still optimizing the critical path. Removes cowboy_http:connection_to_atom/1.
2012-09-27Add cowboy_req:fragment/1Loïc Hoguin
Allows retrieving the request URI fragment (the #fragment part).
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-26Use a single Transport:send/2 call to send the reply if possibleLoïc Hoguin
This gives a huge boost in performance when replies are small.
2012-09-24Remove a '++' use when replyingLoïc Hoguin
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-17fix typo in docBoris Faure
2012-09-17Add types for onrequest and onresponse funsLoïc Hoguin
2012-09-17Rename cowboy_req:raw_qs/1 to cowboy_req:qs/1Loïc Hoguin
2012-09-17Include the eunit file only if TEST is definedLoïc Hoguin
2012-09-17Make cowboy_req:req() opaqueLoïc Hoguin
Remove http.hrl in the process. If you feel furious about this change after reaching this commit, don't worry! You probably just need a few access or modification functions to be added in cowboy_req for your needs. Problem is, I don't know these. I'll be very thankful if you can open a ticket and tell me all about it so the best solution can be swiftly implemented to make you happy again.
2012-09-17Add the private get_connection/1 function used by cowboy_protocolLoïc Hoguin
This removes cowboy_protocol's dependency on http.hrl!
2012-09-17Add the private get_buffer/1 function used by cowboy_protocolLoïc Hoguin
2012-09-17Add the private get_resp_state/1 function used by cowboy_protocolLoïc Hoguin