0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-15 12:40:25 +00:00
Commit graph

402 commits

Author SHA1 Message Date
Loïc Hoguin
36a6823e50 Do not send chunked Transfer-Encoding replies for HTTP/1.0
Fixes compatibility issue #140 reported by @majek.
2012-03-13 03:00:05 +01:00
Loïc Hoguin
e87f51e542 Merge branch 'content-type-accepted-asterisk-atom' of https://github.com/dysinger/cowboy
Added a comment explaining the '*' always matching.
2012-03-13 01:43:15 +01:00
Loïc Hoguin
133564d028 Merge branch 'fix/relax-media-type-parsing' of https://github.com/tillitech/cowboy 2012-03-12 22:57:47 +01:00
Loïc Hoguin
3885912d9b Rename inet:ip_port() to inet:port_number()
Thanks go to @superbobry for pointing it out.
2012-03-12 21:57:07 +01:00
Loïc Hoguin
5d46ad0e58 Merge branch 'cookie-expire-fix' of https://github.com/klaar/cowboy 2012-03-09 22:22:37 +01:00
Magnus Klaar
3376b7295e Fix issue #157 relating to daylight savings time. 2012-03-09 20:42:12 +01:00
Ali Sabil
32a46f898a Make media type parsing more relaxed
Certain user agents send slightly invalid media types, like the
following: "text/html, image/gif, image/jpeg, ; q=.2, */; q=.2"

The user agent with which this behavior was observed presented itself
with the User-Agent string: "Mozilla/5.0 (Macintosh; U; Intel Mac OS X
10.6; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6 (FlipboardProxy/0.0.5;
+http://flipboard.com/browserproxy)"
2012-03-09 12:13:30 +01:00
Tim Dysinger
21cd61cb38 If we have a mapping to '*' then use it as the default catch all accept 2012-03-08 03:17:55 -10:00
Loïc Hoguin
c6c2b31695 Merge branch 'rest-etag-fixes' of https://github.com/klaar/cowboy 2012-03-02 19:25:35 +01:00
Magnus Klaar
9922de6d9e Tests and fixes for the generate_etag/2 callback
The return value from the generate_etag/2 callback is expected to be a
binary tagged with either weak or strong. This binary is quoted, and
may be prefixed with W/ before it is set as the value of the ETag header
in the response.

For backwards compatibility with older handlers where the return value
was expected to be a quoted binary a function has been added to parse any
return values that are untagged binaries. All untagged binaries are expected
to be a valid value for the ETag header.
2012-02-29 22:32:37 +01:00
Loïc Hoguin
8f0a78f52f Add a roadmap 2012-02-27 09:54:16 +01:00
Loïc Hoguin
d9212c21dd Remove the redundant include/ from -include("http.hrl") 2012-02-27 08:07:03 +01:00
Loïc Hoguin
ac1424fd6a Remove a completed @todo comment 2012-02-27 08:06:27 +01:00
Loïc Hoguin
f7884475a5 Merge pull request #146 from ostinelli/f3de0869801d3909cc5a5d5dbee81941481a0c2e
Polish dialyzer warnings on supervisor init/1
2012-02-24 08:09:28 -08:00
Loïc Hoguin
5f5d410541 Add an empty ebin/ folder to fix a rebar/edoc issue
When missing rebar couldn't build docs because it expects the ebin/
folder to exist before it runs edoc. This commit allows users to
build docs without first having to run make.
2012-02-24 12:36:52 +01:00
Loïc Hoguin
a7264a1af3 Add cowboy_http:x_www_form_urlencoded/2
This was initially an internal function, it has been made public
due to popular demand as it can sometimes be needed.
2012-02-23 20:56:11 +01:00
Roberto Ostinelli
f3de086980 polished dialyzer warnings on supervisor init/1 specs 2012-02-20 21:25:19 -08:00
Loïc Hoguin
db382d4d39 Check for upgrades on accept timeout
Otherwise acceptors will not be upgraded properly until after the
next request comes in.

Thanks to DeadZen for pointing it out.
2012-02-20 09:31:22 +01:00
Loïc Hoguin
811d11a1a2 Merge branch 'ssl-password-cacert' of https://github.com/DeadZen/cowboy 2012-02-20 08:48:06 +01:00
Loïc Hoguin
9baf3e2ae9 Add an examples/ directory containing a link to cowboy_examples 2012-02-20 08:42:45 +01:00
Loïc Hoguin
f6cf731011 REST: Only send 201 when a new resource is created on POST 2012-02-20 08:33:54 +01:00
Loïc Hoguin
f51493ee37 Add 'Expect' header parsing
At the same time renaming cowboy_http:content_type_params/3 to
cowboy_http:params/2 (with a default Acc of []) as this code isn't
useful only for content types.
2012-02-20 08:25:05 +01:00
DeadZen
e67d839154 Add CA support and make SSL certificate password optional 2012-02-08 15:14:02 -05:00
David Kelly
e7b6e2a402 Added absoluteURI support
If requests go through a proxy, they will have the original uri in the
request, i.e. : GET http://proxy.server.uri/some/query/string  HTTP 1.1 ...

That was problematic -- cowboy_http_protocol:request didn't know what to
to with the result of decode_packet applied to this, which would be something
like:

``` erlang
{http_request,'GET',{absoluteURI,http,<<"proxy.server.uri">>,
	undefined,<<"/some/query/string">>},{1,1}}
```

So, I just ignore the host, grab the path and pass into

``` erlang
cowboy_http_protocol:request({http_request, Method, {abs_path, Path},
	Version}, State)
```

Seems to do the trick without much effort.
2012-02-02 20:25:23 +01:00
Loïc Hoguin
062db95653 Apply a trick to the erlang:hibernate calls to suppress dialyzer warnings
Initially recommended by Magnus Klaar, the trick is to add a catch
instruction before the erlang:hibernate/3 call so that Dialyzer
thinks it will return, followed by the expected return value
('ok' for HTTP, 'closed' for websockets).

This should be good enough until a real solution is found.
2012-02-02 20:04:06 +01:00
Loïc Hoguin
096f40bf08 Fix a typo that prevented protocol options upgrades 2012-02-01 19:04:26 +01:00
Loïc Hoguin
2c0c85cd2f Merge branch 'remove-queue-len-call' of https://github.com/puzza007/cowboy 2012-01-31 21:11:42 +01:00
Paul Oliver
697170b496 Remove call to queue:len/1
queue:len/1 is O(len(Q))
queue:out/1 is O(1) amortized, O(len(Q)) worst case

Replace with a pattern match
2012-01-31 19:29:56 +00:00
Loïc Hoguin
0c3cf802b4 Removing travis-ci from the cowboy development toolkit
We've been having many recurring issues, some which were fixed,
only to have other things broken again. Can't rely on a service
that breaks all the time.
2012-01-31 12:39:05 +01:00
Loïc Hoguin
9823450cc3 Merge branch 'autobahn-suite' of https://github.com/klaar/cowboy
This needs python2 to be the default python in /usr/bin/python.
2012-01-31 12:17:29 +01:00
Loïc Hoguin
21802d2767 Use queue() for managing wait queues in cowboy_listener
The previous solution was retrieving the last put connection
and wasn't a real queue, so this solution should improve the
overall latency under load.
2012-01-31 09:45:44 +01:00
Loïc Hoguin
42bf0ea57d Refactor cowboy_listener for more consistency 2012-01-31 09:25:23 +01:00
Loïc Hoguin
e927a8228b Pass --no_native option to dialyzer to improve dialyzing times
Goes from 36s to 24s on my laptop.
2012-01-31 08:49:25 +01:00
Loïc Hoguin
e5aef5c1d7 Add cowboy:get_protocol_options/1 and cowboy_set_protocol_options/2
This allows any application to upgrade the protocol options without
having to restart the listener. This is most useful to update the
dispatch list of HTTP servers, for example.

The upgrade is done at the acceptor level, meaning only new connections
receive the new protocol options.
2012-01-31 08:49:15 +01:00
Loïc Hoguin
830cfc002e Move max_connections check directly inside cowboy_listener
This is a big change in the internal cowboy API. This should not
have any impact on existing applications as only the acceptor is
expected to use these API calls.

The function cowboy_listener:wait/3 has been removed. max_connections
checking now occurs directly in cowboy_listener:add_connection/3.
If the pool is full and the acceptor has to wait, then it doesn't
return, waiting for a free space to be available.

To accomodate these changes, it is now cowboy_listener that will
inform the new connection that it is ready by sending {shoot, self()}.
This should be a great improvement to the latency of responses as
there is one less message to wait for before the request process
can do its work.

Overall the performance under heavy load should also be improved as
we greatly reduce the number of messages sent between the acceptor
and the listener process.
2012-01-30 08:09:33 +01:00
Loïc Hoguin
bb08cf85e3 Remove a leftover ct:print 2012-01-26 23:27:34 +01:00
Loïc Hoguin
9d73160942 Merge branch 'rest_delete_no_call' of https://github.com/bfrog/cowboy 2012-01-26 18:25:45 +01:00
Tom Burdick
ca42ea1620 Handle delete better when no delete_resource function is implemented 2012-01-26 18:21:20 +01:00
Magnus Klaar
8808825173 Add Autobahn test suite for websockets
We're using the existing test suite for websocket servers from the
Autobahn project to verify that out websockets implementation is
sane. A CT test suite and python module wrapping the test suite has
been added. The test suite is run when the 'make inttests' target
is executed.
2012-01-25 12:10:05 +01:00
Loïc Hoguin
4b93c2d19a Fix a case where request body wouldn't get cleaned up on keepalive
The body was still in the buffer that's being used for the next
request and was thus used as a request, causing errors.
2012-01-23 21:57:54 +01:00
Loïc Hoguin
dd08a90568 Merge branch 'master' of https://github.com/bfrog/cowboy 2012-01-23 21:57:20 +01:00
Tom Burdick
62de899c95 added test for posting to a rest controller where forbidden returns true on a keep alive socket 2012-01-23 12:42:04 -06:00
Loïc Hoguin
7b359352d4 Remove http_resp_body/0, inline it directly in the record definition 2012-01-23 09:46:40 +01:00
Loïc Hoguin
16d3cb76c7 Rename the type http_status/0 to cowboy_http:status/0 2012-01-23 09:43:26 +01:00
Loïc Hoguin
67e5713b2b Remove http_cookies/0, inline it directly in the record definition 2012-01-23 09:39:17 +01:00
Loïc Hoguin
a297d5e42b Rename the type http_header/0 to cowboy_http:header/0
At the same time rename http_headers/0 to cowboy_http:headers/0.
2012-01-23 09:36:59 +01:00
Loïc Hoguin
8622dff906 Rename the type http_version/0 to cowboy_http:version/0 2012-01-23 09:28:29 +01:00
Loïc Hoguin
314483a0b6 Rename the type http_uri/0 to cowboy_http:uri/0 2012-01-23 09:23:58 +01:00
Loïc Hoguin
9f40167487 Rename the type http_method/0 to cowboy_http:method/0
Exported types are much better than include files.
2012-01-23 09:21:33 +01:00
Loïc Hoguin
3667ec9451 Fix typespecs for calendar:datetime/0 in cowboy_http_static 2012-01-23 09:20:46 +01:00