aboutsummaryrefslogtreecommitdiffstats
path: root/src
AgeCommit message (Collapse)Author
2011-03-29Make the default value the last parameter of HTTP req accessorsAnthony Ramine
This makes cowboy_http_req's qs_val/3, binding/3 and header/3 behave like proplists:get_value/3.
2011-03-29Make HTTP req accessors call themselves with their default default valueAnthony Ramine
Use lists:keyfind/3 in qs_val/3, binding/3 and header/3 and make qs_val/2, binding/2 and header/2 call those.
2011-03-29Fix cowboy_http_req:body with regard to the new accessors default valueAnthony Ramine
header/2 now returns 'undefined' when the header isn't in the request.
2011-03-27Return undefined instead of failing or returning "" when a value doesn't exist.Loïc Hoguin
2011-03-27Use a more efficient variant of string:to_lower to improve performance.Loïc Hoguin
After much testing and experimentation of all kinds I find lists to be both faster and using less memory than binaries for request-line and headers handling. This is more than likely due to the fact that headers are very short and thus do not benefit from the advantages of refc binaries, meaning they're copied, just like lists. The memory usage discrepancy is still a mystery for the most part, although the hoops needed to perform operations on the binaries are probably responsible for the extra memory use. I'm thus giving up on trying to use binaries for request-line and headers. Instead, this commit improves performances even more to the lists code, making lists 5% faster than binaries. Lists are easier to work with too, so I guess it's all a big win for everyone. Of course the request body is still read as a binary, we're using the binary type where it performs best.
2011-03-27Match early in connection_to_atom for a small performance improvement.Loïc Hoguin
2011-03-27Fix query string related type specs in cowboy_http_req.Loïc Hoguin
2011-03-24Add the cowboy_http_handler behaviour.Loïc Hoguin
2011-03-22Allow Handler:init/3 to request a protocol upgrade.Loïc Hoguin
2011-03-22Forward transport and protocol name to Handler:init.Loïc Hoguin
2011-03-22Add cowboy_tcp_transport:name/0 to ease transport identification later on.Loïc Hoguin
2011-03-22Boring 80-col change.Loïc Hoguin
2011-03-22Introduce cowboy_http_req:body_qs/1 for automated urlencoded body parsing.Loïc Hoguin
2011-03-22Fix spec for cowboy_http_req:parse_qs/1.Loïc Hoguin
2011-03-22Fix spec for cowboy_http_req:body/1 and body/2.Loïc Hoguin
2011-03-22Explicitly ignore the return value of cowboy_http_req:reply in error_response.Loïc Hoguin
2011-03-21Fix spec for cowboy_tcp_transport:close/1.Loïc Hoguin
Apparently the documentation is wrong for gen_tcp:close/1, it returns only ok.
2011-03-21Fix spec for cowboy_http_req:reply/4.Loïc Hoguin
2011-03-21Fix spec for cowboy_http_req:qs_vals/1.Loïc Hoguin
2011-03-21Fix spec for cowboy_http_protocol:init/3.Loïc Hoguin
2011-03-21Fix tests for cowboy_dispatcher:split_path/1.Loïc Hoguin
2011-03-21Fix spec for cowboy_dispatcher:split_path/1.Loïc Hoguin
2011-03-21Introduce cowboy_http_req:body/1 to read the full request body.Loïc Hoguin
2011-03-21Make sure error_response always returns ok.Loïc Hoguin
2011-03-21Add specs to ensure_response and change the clauses order.Loïc Hoguin
2011-03-21Skip the request body if it hasn't been read by the handler.Loïc Hoguin
2011-03-20Ensure a response is sent when the handler doesn't reply anything.Loïc Hoguin
2011-03-20Move the error response code into a separate function.Loïc Hoguin
2011-03-20Make sure we can only reply to an HTTP request inside Handler:handle.Loïc Hoguin
Of course since requests are a record the response state can be explicitly overriden, but standard use prevents errors by making sure only one reply is sent.
2011-03-20Lazy-retrieve the peer name and port to avoid wasting time each request.Loïc Hoguin
2011-03-20Change a @todo for Handler:init possible return values.Loïc Hoguin
2011-03-20Rename a variable in cowboy_http_protocol for clarity.Loïc Hoguin
2011-03-20Allow code reloading inside the cowboy_http_protocol module during keep-alive.Loïc Hoguin
2011-03-20Default the connection to keep-alive on HTTP/1.1 and close on 1.0.Loïc Hoguin
2011-03-20Remove a dead code clause for split_path.Loïc Hoguin
2011-03-20Save the raw path string in the request.Loïc Hoguin
2011-03-19Save the raw host string in the request.Loïc Hoguin
2011-03-19Protect the calls to the handler using catch.Loïc Hoguin
* Handler:init shouldn't reply anything; send an error 500. * Handler:handle may have sent something to the client; close the socket. * Handler:terminate failed to clean itself up. Close the socket.
2011-03-19Add support for the '*' path.Loïc Hoguin
Mostly used by the following request: OPTIONS * HTTP/1.1
2011-03-19Rewrite the dispatcher to take a list of host each having a list of paths.Loïc Hoguin
* Makes more sense to parse the host only once instead of for each path. * Allows proper handling of: If the host is not a valid host on the server, the response MUST be a 400 (Bad Request) error.
2011-03-19Ignore all extra Host values sent in the request.Loïc Hoguin
2011-03-19Reply with error 501 on all non absolute path URIs for now.Loïc Hoguin
2011-03-19Reply with error 400 on all bad Request-Lines received.Loïc Hoguin
2011-03-19Ignore empty lines when expecting the Request-Line.Loïc Hoguin
In the interest of robustness, servers SHOULD ignore any empty line(s) received where a Request-Line is expected. In other words, if the server is reading the protocol stream at the beginning of a message and receives a CRLF first, it should ignore the CRLF.
2011-03-19Comparisons of host names MUST be case-insensitive.Loïc Hoguin
2011-03-19Notify the client that we're closing the connection after the error reply.Loïc Hoguin
2011-03-18Move the reply function to cowboy_http_req.Loïc Hoguin
2011-03-18Introduce Handler:terminate to cleanup the handler's state.Loïc Hoguin
2011-03-18Handler:init/2 should also return the Request in case it changed.Loïc Hoguin
2011-03-18Introduce Handler:init/2 for initializing the handler state.Loïc Hoguin
We need an init function in order to process upgrade instructions for protocols like WebSockets, but also to request an active receive mode for long-polling connections, both of which will be implemented at a later time.