aboutsummaryrefslogtreecommitdiffstats
path: root/src/cowboy_http_req.erl
AgeCommit message (Collapse)Author
2011-05-05Switch the HTTP protocol to use binary packets instead of lists.Loïc Hoguin
The server now does a single recv (or more, but only if needed) which is then sent to erlang:decode_packet/3 multiple times. Since most requests are smaller than the default MTU on many platforms, we benefit from this greatly. In the case of requests with a body, the server usually read at least part of the body on the first recv. This is bufferized properly and used when later retrieving the body. In the case of pipelined requests, we can end up reading many requests in a single recv, which are then handled properly using only the buffer containing the received data.
2011-05-04Add cowboy_http_req:port/1.Loïc Hoguin
Returns the port given in the Host header if present, otherwise the default port of 443 for HTTPS and 80 for HTTP is returned.
2011-05-04Use http_headers() type in cowboy_http_req:headers/1.Loïc Hoguin
2011-04-18Remove the include/types.hrl file.Loïc Hoguin
2011-04-18Replace port_number() by ip_port() from kernel/include/inet.hrl.Loïc Hoguin
2011-04-18Replace posix() by atom(), for now.Loïc Hoguin
The type isn't exported by OTP so we don't win much. Also, inet.erl and file.erl define posix() différently, so OTP needs to stop being so confuse in the first place before we can attempt to use it properly.
2011-04-18Move the dispatcher related types into cowboy_dispatcher.Loïc Hoguin
2011-04-17Use the inet:ip_address() type instead of the user-defined one.Loïc Hoguin
2011-04-14Fix specs for cowboy_http_req:reply/4.Loïc Hoguin
Body is iodata(), not iolist().
2011-04-14Fix a bug where dupe headers were sent in cowboy_http_req:reply/4.Loïc Hoguin
Now the server defines default headers that can be overwritten by the handler simply by passing them to the reply/4 function. Default headers include, for now, Connection and Content-Length headers. Note that it isn't enough to change the Connection header to close a keep-alive connection server-side.
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-27Fix query string related type specs in cowboy_http_req.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-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-21Introduce cowboy_http_req:body/1 to read the full request body.Loïc Hoguin
2011-03-21Skip the request body if it hasn't been read by the handler.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-18Move the reply function to cowboy_http_req.Loïc Hoguin
2011-03-17Initial commit.Loïc Hoguin