aboutsummaryrefslogtreecommitdiffstats
path: root/src
AgeCommit message (Collapse)Author
2011-11-09Add 'If-Match' and 'If-None-Match' to parse_header/2Loïc Hoguin
2011-11-07Fix reading the request body when Length < byte_size(Buffer)Loï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).
2011-11-04Merge branch 'parse_header-content-length' of https://github.com/nox/cowboyLoïc Hoguin
Conflicts: src/cowboy_http.erl
2011-11-04Support 'Content-Length' in parse_header/2Anthony Ramine
2011-11-04Remove unneeded whitespaces according to the HTTP specLoïc Hoguin
2011-11-04Rename cowboy_http:charset/2 to conneg/2 and use it for Accept-EncodingLoïc Hoguin
Sorry I apparently used an outdated RFC when I was doing this.
2011-11-01Merge branch 'chrome-15' of https://github.com/puzza007/cowboyLoïc Hoguin
2011-11-01Set the cowboy_listener process priority to highLoïc Hoguin
See comment added with it for more information.
2011-10-30update record spec for version 13Paul Oliver
2011-10-29Fix cowboy_http_req:chunk/2 specPaul Oliver
2011-10-28fix supervisor spec for non dynamic modulesSteven Gravell
a release upgrade on a vm running cowboy where any other appup includes an {update, Mod, {advanced, Extra}} instruction will hang forever due to these child specs being wrong. The gen_servers should be [Mod] and the non gen_server needs to be [] since there is no callback to handle this.
2011-10-26Add 'Accept-Charset' to cowboy_http_req:parse_header/2Loïc Hoguin
2011-10-26Rename private function quality/2 into qvalue/2Loïc Hoguin
2011-10-26cowboy_http:media_range/2 should expect to not have whitespace before itLoïc Hoguin
2011-10-26Add 'Accept-Encoding' to cowboy_http_req:parse_header/2Loïc Hoguin
2011-10-26Add 'Accept' header parsingLoïc Hoguin
Rework the cowboy_http_req:parse_header/2 function while I was at it.
2011-10-25Rewrite list/tokens parsing with an added whitespace functionLoïc Hoguin
2011-10-24Make sure the correct callback name is displayed in websocket errorsLoïc Hoguin
2011-10-24Accept Sec-WebSocket-Version: 13 header on Chrome 15 through 17Paul Oliver
2011-10-24We don't need to retrieve the Origin header for hybi-7+ websocket draftsLoïc Hoguin
2011-10-20Parse Connection header tokens in a case-insensitive mannerLoïc Hoguin
2011-10-20Add a cowboy_http_req:upgrade_reply/3 function and use it for websocketsLoïc Hoguin
This function doesn't try to add any additional header besides the Connection: Upgrade header. It also doesn't accept a body. It should be used for the intermediate reply to an upgrade process, before the real reply is sent (if any, for example when using TLS).
2011-10-20"websocket" must be treated in a case insensitive manner for upgradesLoïc Hoguin
Fixed according to the websocket draft specs.
2011-10-20Make sure the hixie-76 websocket code works properly with proxiesLoïc Hoguin
2011-10-19Add a max_line_length to the HTTP protocolLoïc Hoguin
Allows to limit the size of request and header lines, thus preventing Cowboy from infinitely reading from the socket and never finding an end of line. Defaults to 4096 bytes.
2011-10-17Rewrite the token list parsing into separate, modulable functionsLoïc Hoguin
Introduce cowboy_http's list/2, nonempty_list/2, token/2 functions.
2011-10-13Add shortcuts to reply functionsLoïc Hoguin
New functions are reply/2, reply/3, chunked_reply/2 in cowboy_http_req.
2011-10-13Rename a variable from Code to StatusLoïc Hoguin
2011-10-11Fix a misnamed variable for {loop, ...} returns in init/3Loïc Hoguin
2011-10-11Fix specs after erlang:hibernate/3 calls were addedLoïc Hoguin
This however does not fix the related Dialyzer warnings. I have no idea what the warnings are about nor how to fix them, so feel free to work on it and submit a patch!
2011-10-10Add support for loops in standard HTTP handlersLoïc Hoguin
Now init/3 can return one of the following values to enable loops: - {loop, Req, State} - {loop, Req, State, hibernate} - {loop, Req, State, Timeout} - {loop, Req, State, Timeout, hibernate} Returning one of these tuples will activate looping in the HTTP handler. When looping, handle/2 is never called. Instead, Cowboy will listen for Erlang messages and forward them to the info/3 function of the handler. If a timeout is defined, Cowboy will also close the connection when no message has been received for Timeout milliseconds. The info/3 function is defined as info(Msg, Req, State). It can return either of the following tuples: - {ok, Req, State} - {loop, Req, State} - {loop, Req, State, hibernate} The first one ends the connection, calling terminate/2 before closing. The others continue the loop. Loops are useful when writing long-polling handlers that need to wait and don't expect to receive anything. Therefore it is recommended to set a timeout to close the connection if nothing arrives after a while and to enable hibernate everywhere. Normal HTTP handlers shouldn't need to use this and as such info/3 was made optional.
2011-10-10Add {shutdown, Req} to websocket_init/3 to fail a websocket upgradeLoïc Hoguin
This change allows application developers to refuse websocket upgrades by returning {shutdown, Req}. The application can also send a reply with a custom error before returning from websocket_init/3, otherwise an error 400 is sent. Note that right now Cowboy closes the connection immediately. Also note that neither terminate/3 nor websocket_terminate/3 will be called when the connection is shutdown by websocket_init/3.
2011-10-10Add cowboy:child_spec/6Jesper Louis Andersen
This new exported function returns a Child Spec suitable for embedding cowboy in another applications supervisor structure. While here, implement `start_listener/6` in terms of it.
2011-10-07Fix a crash in response_connection when Name is an atom =/= 'Connection'Loïc Hoguin
2011-10-06Allow HTTP handlers to skip the handle/2 step in init/3Loïc Hoguin
You can now return {shutdown, Req, State} from Handler:init/3 to skip the handle/2 step. Also allow init/3 function to send responses.
2011-10-06Merge branch 'hybi-framing-fix' of https://github.com/smarkets/cowboyLoïc Hoguin
2011-10-06Close the connection when the application sends Connection: closeLoïc Hoguin
Now Cowboy checks headers sent to the client for the 'Connection' header value, parses it, and checks whether it contains a 'close' or 'keep-alive' value. It makes sure to close or keep the connection alive depending on the value found there, if any. Also change chunked replies to not close the connection by default unless the application requests it.
2011-10-06Fix hixi76_location/5 when transport is tcp and port is 443Loïc Hoguin
I know it is unlikely to use plain TCP on port 443, where SSL is usually used, but a bug is still a bug, and as such it should be fixed. Now the port will be probably appended to the location when port 443 is used without SSL.
2011-10-06Fix a crash in websocket_handshake when cowboy_http_req:compact/1 is usedLoïc Hoguin
Also add a call to compact/1 in the websocket test handler so we may catch bugs related to it faster later on.
2011-10-05Remove the 'HEAD' chunked_reply/3 clauseLoïc Hoguin
From the RFC: The HEAD method is identical to GET except that the server MUST NOT return a message-body in the response. The metainformation contained in the HTTP headers in response to a HEAD request SHOULD be identical to the information sent in response to a GET request.
2011-10-05Parse 'Connection' headers as a list of tokensLoïc Hoguin
Replaces the 'Connection' interpretation in cowboy_http_protocol from raw value to the parsed value, looking for a single token matching close/keep-alive instead of the whole raw value (which could contain more than one token, for example with Firefox 6+ using websocket). Introduce the functions cowboy_http_req:parse_header/2 and /3 to semantically parse the header values and return a proper Erlang term.
2011-10-04Move a few binary string handling functions to cowboy_bstrLoïc Hoguin
2011-10-04Remove the connection information from the HTTP protocol stateLoïc Hoguin
Use the Req connection information instead.
2011-10-04Close connection on all errorsLoïc Hoguin
And use a proper cowboy_http_req:reply/4 call for the 204 response.
2011-10-04Small doc clarificationLoïc Hoguin
2011-10-04Do not send a 408 response if the Request-Line wasn't fully receivedLoïc Hoguin
The server should not send a response if there wasn't at least the beginning of a request sent (the Request-Line).
2011-10-03Fix byte-by-byte Websocket handlingHunter Morris
If the websocket frame handling code in cowboy_http_websocket receives only 1 byte at a time, it fails with a badmatch in cowboy_http_websocket:websocket_data/4. This commit fixes the problem and introduces a test of the correct behaviour.