aboutsummaryrefslogtreecommitdiffstats
path: root/src/cowboy_req.erl
AgeCommit message (Collapse)Author
2013-05-31Don't crash on empty Cookie headerLoïc Hoguin
It's not allowed, however a heavily deployed client (Flash player) can send such an empty header, therefore we make a special condition for it and return an empty list when it happens.
2013-05-30Add experimental and incomplete SPDY supportLoïc Hoguin
The SPDY connection processes are also supervisors. Missing: * sendfile support * request body reading support
2013-05-16Move cowboy_protocol:onresponse_fun() to cowboy:onresponse_fun()Loïc Hoguin
2013-05-16Move cowboy_http:status() to cowboy:http_status()Loïc Hoguin
2013-05-16Move cowboy_http:headers() to cowboy:http_headers()Loïc Hoguin
2013-05-16Move cowboy_http:version() to cowboy:http_version()Loïc Hoguin
2013-05-16Improve the specs for cowboy_req:init_stream/4Loïc Hoguin
2013-05-16Make the HTTP version type more practicalLoïc Hoguin
Now instead of {1, 1} we have 'HTTP/1.1', and instead of {1, 0} we have 'HTTP/1.0'. This is more efficient, easier to read in crash logs, and clearer in the code.
2013-05-15Remove cowboy_req:fragment/1Loïc Hoguin
Clients do not send it. We skip the value if we receive it now, as it shouldn't happen, and won't for all the mainstream clients.
2013-05-15Fix two incorrect comments in cowboy_reqLoïc Hoguin
2013-05-15The cookie value can only be binary()Loïc Hoguin
2013-05-15The return value of cowboy_req:peer/1 is never undefinedLoïc Hoguin
2013-04-26Add chunked response body funJames Fish
Adds a new type of streaming response fun. It can be set in a similar way to a streaming body fun with known length: Req2 = cowboy_req:set_resp_body_fun(chunked, StreamFun, Req) The fun, StreamFun, should accept a fun as its single argument. This fun, ChunkFun, is used to send chunks of iodata: ok = ChunkFun(IoData) ChunkFun should not be called with an empty binary or iolist as this will cause HTTP 1.1 clients to believe the stream is over. The final (0 length) chunk will be sent automatically - even if it has already been sent - assuming no exception is raised. Also note that the connection will close after the last chunk for HTTP 1.0 clients.
2013-04-26Merge branch 'range_header' of git://github.com/Egobrain/cowboyLoïc Hoguin
2013-04-26Added range header parserEgobrain
2013-04-26Removed asserts from unit testsEgobrain
2013-04-22Fix an outdated commentLoïc Hoguin
2013-04-11Remove cowboy_req:peer_addr/1Loïc Hoguin
This kind of function is highly dependent on the proxy used, therefore parsing was added for x-forwarded-for instead and we just let users write the function that works for them. The code can be easily extracted if anyone was using the function.
2013-04-11Parse the x-forwarded-for header as a list of tokensLoïc Hoguin
2013-04-11Shorten the parse_header clausesLoïc Hoguin
2013-04-11No need for fully qualified call to the same moduleLoïc Hoguin
2013-04-09Switch the arguments to cowboy_req:stream_body/2Loïc Hoguin
Make them consistent with the rest of the module.
2013-04-02Replace init_stream/5 with stream_body/2Loïc Hoguin
This allows us to change the max chunk length on a per chunk basis instead of for the whole stream. It's also much easier to use this way even if we don't want to change the chunk size.
2013-03-06Check the length before reading the body in body/1 and body_qs/1rambocoder
2013-03-05Make streamed chunk size configurableLoïc Hoguin
Defaults to a maximum of 1000000 bytes. Also standardize the te_identity and te_chunked decoding functions. Now they both try to read as much as possible (up to the limit), making body reading much faster when not using chunked encoding.
2013-03-05Handle identity transfer-encoding when determining body lengthLoïc Hoguin
2013-02-21Added warn compile options. Fixed compile warnings.Egobrain
2013-02-14cowbot_req:has_body:/1 improved0xAX
2013-02-12Fix connection state being ignored for unknown length streamingLoïc Hoguin
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