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

871 commits

Author SHA1 Message Date
Christopher Adams
59c32506c0
Fix if_modified_since match of last_modified
Correct expected return type from `no_call` to `undefined` in
if_modified_since when last_modified callback is not defined. Add an
http_SUITE test to catch regressions.
2016-10-18 10:43:47 +02:00
Loïc Hoguin
c750dd76b4 Send many frames in one TCP send
Includes refactoring of the related code to avoid repetition.
2016-08-15 20:04:37 +02:00
Loïc Hoguin
1d01d0fc06 Allow websocket_init/1 to reply/close/hibernate 2016-08-15 19:21:38 +02:00
Loïc Hoguin
af88442610 Modernize the Websocket test suite 2016-08-15 18:06:16 +02:00
Loïc Hoguin
d1b65a67cf Remove Req from the Websocket interface
After the switch to Websocket, we are no longer in a request/response
scenario, therefore a lot of the cowboy_req functions do not apply
anymore.

Any data required from the request will need to be taken from Req
in init/2 and saved in the handler's state.
2016-08-12 19:27:23 +02:00
Loïc Hoguin
b63b6ef865 Add missing specs to an internal cowboy_req function 2016-08-12 18:06:45 +02:00
Loïc Hoguin
e44ac98c83 Merge branch 'master' of https://github.com/camshaft/cowboy 2016-08-12 17:26:28 +02:00
Loïc Hoguin
97986df276 Fix Websocket compression
The option for enabling Websocket compression has been
renamed. Previously it was shared with HTTP compression,
now it's specific to Websocket. The new option is named
'websocket_compress'.
2016-08-12 16:56:08 +02:00
Loïc Hoguin
5cb2b544b7 Use cow_http_hd:parse_host directly
Removes some duplicate code from cowboy_http.
2016-08-11 16:45:52 +02:00
Loïc Hoguin
b75b0a6d4d Use integer_to_binary when possible 2016-08-11 11:53:05 +02:00
Loïc Hoguin
e2d5c268aa Fix timer-sent events in the websocket example 2016-08-11 11:06:03 +02:00
Loïc Hoguin
5fa5ba8ca4 Add specs for the cowboy_req:push/3,4 functions 2016-08-10 17:52:44 +02:00
Loïc Hoguin
83aa3f1b9c Use binary_to_integer instead of to list and back 2016-08-10 17:50:28 +02:00
Loïc Hoguin
9966df9ad4 Let the stream handler take care of crash handling and logging 2016-08-10 17:45:28 +02:00
Loïc Hoguin
e30d120bd8 Make reply functions return Req 2016-08-10 17:15:02 +02:00
Loïc Hoguin
aa6f2ab5a4 Update the multipart reading interface
Now named read_part/read_part_body, with a verb indicating action.
2016-08-10 15:09:04 +02:00
Loïc Hoguin
00f3ae7d20 Remove logic to always send a response in cowboy_loop
This is taken care of at the protocol level now.
2016-08-10 13:55:35 +02:00
Loïc Hoguin
3a057683af Add a lot of todos 2016-08-10 11:52:41 +02:00
Loïc Hoguin
ae0dd61673 Add tests for responses and request body reading
This is a large commit. The cowboy_req interface has largely
changed, and will change a little more. It's possible that
some examples or tests have not been converted to the new
interface yet. The documentation has not yet been updated.
All of this will be fixed in smaller subsequent commits.

Gotta start somewhere...
2016-08-10 11:49:31 +02:00
Cameron Bytheway
e09a856805 send resp_headers with websocket responses 2016-06-27 11:33:25 -06:00
Loïc Hoguin
4657d7bbbe Remove cowboy_req:get and set 2016-06-22 11:27:32 +02:00
Loïc Hoguin
8905cc44f2 Remove cowboy_req:append_buffer/2 2016-06-22 11:22:34 +02:00
Loïc Hoguin
0e68b2a3f5 Remove unused local function in cowboy_req 2016-06-22 10:54:22 +02:00
Loïc Hoguin
2201b7e423 Remove cowboy_req:set_bindings/4 2016-06-22 10:44:24 +02:00
Loïc Hoguin
7e84719095 Remove cowboy_req:lock/1 2016-06-22 10:42:43 +02:00
Loïc Hoguin
34e5f5853a Remove cowboy_req:to_list/1 2016-06-22 10:35:20 +02:00
Loïc Hoguin
bcff1262d0 Remove the meta functions from cowboy_req
Now that we have a public map they are pretty much pointless.
2016-06-21 22:43:29 +02:00
Loïc Hoguin
19468d0503 Add cowboy_req:uri/1,2
Along with more cowboy_req tests.

This commit also removes cowboy_req:url/1 and cowboy_req:host_url/1
in favor of the much more powerful new set of functions.
2016-06-21 19:04:52 +02:00
Loïc Hoguin
3a7643782e Remove cowboy_req:new/14
This internal function is no longer necessary.
2016-06-21 19:03:18 +02:00
Loïc Hoguin
26c75b57b1 Add cowboy_req:scheme/1 2016-06-20 17:29:53 +02:00
Loïc Hoguin
c33b4cec96 Properly parse the host/port in HTTP/2 2016-06-20 17:29:25 +02:00
Loïc Hoguin
4fed8637b6 Fix cowboy_req:peer/1 2016-06-20 17:28:59 +02:00
Loïc Hoguin
44f16f3b1e Make sure a response is always sent with HTTP/2
Previously only DATA was sent, with missing HEADERS.
2016-06-16 19:46:57 +02:00
Loïc Hoguin
b82bb92f7e Fix streaming HTTP/2 responses
Error reporting for connection processes has been improved,
using a similar proc_lib hack as was done for the stream
processes.
2016-06-13 16:00:17 +02:00
Loïc Hoguin
1470f88319 Fix request body reading in HTTP/2 2016-06-08 23:09:14 +02:00
Loïc Hoguin
f14c45151d Escape reserved filename characters
Note that this commit has currently only been tested on Linux.
It might be incomplete for other platforms.
2016-06-06 17:39:06 +02:00
Loïc Hoguin
a82495fa5c Static: Fix status code returned with empty path_info 2016-06-06 17:38:39 +02:00
Loïc Hoguin
c9f5603650 Router: properly handle path segments
The path segments . and .. are now removed according to the
rules found in RFC3986.

The path segments are now percent-decoded using the correct
algorithm (the one in RFC3986 and not the "query string" one).
2016-06-06 17:35:48 +02:00
Loïc Hoguin
493794145e REST: Ignore If...Since if If...Match header exists
The If-Modified-Since and If-Unmodified-Since headers are
only used when If-None-Match or If-Match were not found,
respectively. The latter are preferred by the standard
and the former is only there for compatibility with older
clients.
2016-06-06 17:33:46 +02:00
Loïc Hoguin
6d63557235 REST: If-None-Match uses weak Etag comparison
Was badly implemented previously.
2016-06-06 17:33:03 +02:00
Loïc Hoguin
68c57430da REST: If-Match uses strong Etag comparison
Weak Etag never matches.
2016-06-06 17:32:04 +02:00
Loïc Hoguin
84b3b61b39 Remove the environment from cowboy_rest crash reports
It only serves to pollute logs.
2016-06-06 17:30:13 +02:00
Loïc Hoguin
725bdb9774 HTTP/2: Separate path and query components 2016-06-06 17:28:56 +02:00
Loïc Hoguin
8e9196215d HTTP/2: Handle internal errors 2016-06-06 17:28:35 +02:00
Loïc Hoguin
61e9f29279 HTTP/2: add support for sending files 2016-06-06 17:27:48 +02:00
Loïc Hoguin
7603518ed0 HTTP/1.1: Don't send 500 errors twice
The stream handler is responsible for sending errors.
The protocol should only send errors when no responses
were sent (this might not work yet).
2016-06-06 17:26:13 +02:00
Loïc Hoguin
327e8db623 Report request process crashes 2016-06-06 17:20:30 +02:00
Loïc Hoguin
d19134b02e Use the correct process type for clear connections 2016-06-06 16:13:51 +02:00
Loïc Hoguin
3969c31824 Fix most remaining HTTP/2 handshake tests
One category of tests involving the SETTINGS ack still fails.
It is probably wise to leave these until more SETTINGS related
tests are written.
2016-03-13 23:14:57 +01:00
Loïc Hoguin
2620d65fde Fix more HTTP/2 handshake test cases 2016-03-13 11:26:26 +01:00