0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-14 20:30:23 +00:00
Commit graph

1967 commits

Author SHA1 Message Date
Loïc Hoguin
245434a54d Add R14B04 to the travis-ci configuration file 2011-10-06 13:21:15 +02:00
Loïc Hoguin
fe41f2944b Merge branch 'hybi-framing-fix' of https://github.com/smarkets/cowboy 2011-10-06 13:01:27 +02:00
Loïc Hoguin
8e835bce9f Close the connection when the application sends Connection: close
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-06 12:40:04 +02:00
Loïc Hoguin
237b468f42 Fix hixi76_location/5 when transport is tcp and port is 443
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-06 01:20:10 +02:00
Loïc Hoguin
97460a5993 Fix a crash in websocket_handshake when cowboy_http_req:compact/1 is used
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-06 01:07:49 +02:00
Loïc Hoguin
c2be0f2073 Remove the 'HEAD' chunked_reply/3 clause
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-05 18:30:23 +02:00
Loïc Hoguin
8eb7af0a0b Skip deps when generating docs 2011-10-05 16:06:50 +02:00
Loïc Hoguin
bf5c2717bc Parse 'Connection' headers as a list of tokens
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-05 13:32:20 +02:00
Loïc Hoguin
9a775cce3c Move a few binary string handling functions to cowboy_bstr 2011-10-04 18:34:14 +02:00
Loïc Hoguin
ee77ecec92 Remove the connection information from the HTTP protocol state
Use the Req connection information instead.
2011-10-04 13:09:57 +02:00
Loïc Hoguin
547107cfb9 Close connection on all errors
And use a proper cowboy_http_req:reply/4 call for the 204 response.
2011-10-04 12:37:19 +02:00
Loïc Hoguin
148fb949c5 Small doc clarification 2011-10-04 11:27:04 +02:00
Loïc Hoguin
d25c30790c Do not send a 408 response if the Request-Line wasn't fully received
The server should not send a response if there wasn't at least
the beginning of a request sent (the Request-Line).
2011-10-04 10:54:30 +02:00
Hunter Morris
6250b22384 Fix byte-by-byte Websocket handling
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.
2011-10-03 14:58:12 +01:00
Loïc Hoguin
986630d9ad Get rid of a binary construct in cowboy_http_websocket
Thanks to @nivertech for pointing it out in ticket #61.
2011-10-01 19:08:32 +02:00
Loïc Hoguin
b79e9fbeb4 Get rid of a binary construct in cowboy_http_req
Thanks to @klaar for pointing it out in ticket #59.
2011-10-01 18:54:43 +02:00
Loïc Hoguin
ce26d7090b Rename the type cowboy_dispatcher:path_tokens/0 to :tokens/0 2011-10-01 02:32:20 +02:00
Loïc Hoguin
6572d4d374 Merge branch 'path-split-doc' of https://github.com/klaar/cowboy 2011-10-01 02:24:38 +02:00
Loïc Hoguin
76f855ebd0 Merge branch 'master' of https://github.com/hakvroot/cowboy 2011-10-01 02:10:10 +02:00
Michiel Hakvoort
d8e841c8a2 Add cowboy_protocol behaviour 2011-09-30 08:49:58 +02:00
Magnus Klaar
973e67a53c add note to split_path/1 and path/1 on escaped / 2011-09-29 23:13:00 +02:00
Loïc Hoguin
eff9477201 Improve the error message for HTTP handlers
Making it look more like the websocket handler error messages.
2011-09-28 18:01:35 +02:00
Loïc Hoguin
0e84e7f920 Merge remote-tracking branch 'smarkets/cacertfile' 2011-09-28 15:02:08 +02:00
Steven Gravell
ea5780b7cd add cacertfile configuration 2011-09-28 13:40:09 +01:00
Loïc Hoguin
b675fb2ab1 Merge remote-tracking branch 'nivertech/master' 2011-09-26 19:59:44 +02:00
Ori Bar
3715df5bd4 Fix handshake for when querystring is needed 2011-09-26 19:57:46 +02:00
Loïc Hoguin
d0f711a61d Add a test for websocket hibernate + timeout and fix this use case
The issue was that we were calling erlang:hibernate before a
receive .. after .. end call. Erlang hibernates the process before
reaching the receive instruction and we therefore couldn't enter
the after clause when hibernating.

This is now fixed by using erlang:send_after instead and receiving
that message instead of using an after clause.
2011-09-22 23:15:54 +02:00
Loïc Hoguin
04f55eb3c9 Allow websocket handlers to hibernate from the websocket_init/3 function
Also improve the documentation about hibernate.
2011-09-15 23:20:02 +02:00
Loïc Hoguin
89ae3c8cad 'Host' header is optional in HTTP/1.0
Krishnamurthy, Kristol, Mogul: "Key Differences between HTTP/1.0
and HTTP/1.1", "Internet address conservation".
http://www8.org/w8-papers/5c-protocols/key/key.html

Fixes issue #35 reported by Alex Kropivny.
2011-09-14 01:45:12 +02:00
Loïc Hoguin
b669b1b5a3 Reset the max number of empty lines between keepalive requests
Fixes issue #47.
2011-09-13 23:41:34 +02:00
Loïc Hoguin
961526d704 Improve the Cowboy definition in the README 2011-09-13 23:10:41 +02:00
Loïc Hoguin
55ba8dc4da Merge pull request #46 from tillitech/master
Fix the handling of HEAD requests
2011-09-06 03:24:53 -07:00
Ali Sabil
bb469f6c3d Fix the handling of the HEAD requests
Responses to the HEAD requests used to include an response body.
2011-09-06 12:11:44 +02:00
Loïc Hoguin
8bb7472fb0 Update version to 0.3.0 to continue with development 2011-09-05 15:51:53 +02:00
Loïc Hoguin
009ad4c9eb Update version to 0.2.0 2011-09-05 15:45:19 +02:00
Loïc Hoguin
2a25ad6c24 Update AUTHORS file 2011-09-05 15:41:13 +02:00
Loïc Hoguin
a1d6c2e66f Tweak the .travis.yml file
We want to run 'make tests' and not that rebar command.
Also remove R14B as quoted doesn't work with it.
2011-09-05 14:22:36 +02:00
Loïc Hoguin
24f3981377 Add .travis.yml file 2011-09-05 14:14:30 +02:00
Loïc Hoguin
2374aa7e07 Add WebSocket drafts 7, 8, 9 and 10 implementation
The implementation is only partial for now but should work for
all browsers implementing it.
2011-08-23 23:49:58 +02:00
Loïc Hoguin
24bf2c54d0 Ensure header names are handled in a case insensitive manner
To this end we are formatting the header names just like OTP does
except we do it for names of up to 32 characters, as there are
widely used header names of more than 20 characters, the limit that
OTP follows currently. An example of such header name would be
Sec-Websocket-Version.

The formatting itself is fairly simple: an uppercase character at
the start and after dashes, everything else lowercase.
2011-08-23 16:20:53 +02:00
Loïc Hoguin
d858153fce Use cowboy_clock types in cowboy_cookies instead of calendar
Until calendar exports them at least.
2011-08-11 10:24:50 +02:00
Loïc Hoguin
cd06efeba3 Add Transport:setopts/2 note for writing protocols 2011-08-11 09:46:39 +02:00
Loïc Hoguin
43d14b52cd Give the ListenerPid to the protocol on startup
Also sends a message 'shoot' that can be received by the protocol
to make sure Cowboy has had enough time to fully initialize the
socket. This message should be received before any socket-related
operations are performed.

WebSocket request connections are now moved from the pool 'default'
to the pool 'websocket', meaning we can have a lot of running
WebSockets despite having a low 'max_connections' setting.
2011-08-10 20:28:30 +02:00
Loïc Hoguin
56369d5c1a Introduce cowboy_listener for managing a listener
Currently only supports limiting the maximum number of
connections by managing connection pools.
2011-08-10 16:43:59 +02:00
Loïc Hoguin
6138901465 Fix cookie tests and specs 2011-07-26 17:39:41 +02:00
Loïc Hoguin
528d0ebffd Small cosmetic changes and doc update to the cookie patch 2011-07-26 13:58:48 +02:00
Tom Burdick
b75859e075 Fail early in cookie-related API functions 2011-07-26 13:53:52 +02:00
Tom Burdick
5bd936db66 Implement cookies in cowboy_http_req 2011-07-26 13:53:31 +02:00
Tom Burdick
a29ccb070b Add cowboy_cookies for cookie creation and parsing
Based on Mochi Media, Inc.'s work in Mochiweb.

Conflicts:

	rebar.config
2011-07-26 13:52:21 +02:00
Loïc Hoguin
acc5f50ab5 Update quoted to 1.0.3 to fix outstanding issues
Magnus Klaar updated the PropEr tests and it should be fine now.
2011-07-26 12:36:35 +02:00