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

23 commits

Author SHA1 Message Date
Andrew Thompson
d916d739d4 Make the arguments to error_logger more consistent
The purpose of this patch is to make the arguments cowboy passes to
error_logger more consistent. With this patch there's only 3 variations
on the error_logger argument list; a 5 element list, an 8 element list
and a 10 element list. In all cases, the first 3 arguments are the
Module, Function and Arity of the function being called and the
second-to-last argument is always the Request. Additionally, for lists
longer than 5 elements, the last argument is always the stack-trace.

The added consistency of the argument ordering makes it much easier to
write code in lager's error_logger handler to catch these messages and
write a pretty one-liner (while writing the full message to the
crash.log).
2012-12-13 03:38:38 -05:00
Loïc Hoguin
6d4e15705f Add {close, StatusCode, Payload} and fix {close, Payload} 2012-12-08 19:11:56 +01:00
Loïc Hoguin
d2ccd2e090 Merge branch 'websocket_terminate_not_called' of git://github.com/dergraf/cowboy 2012-12-07 16:35:40 +01:00
Andre Graf
ae2a6cfb68 call websocket_terminate in case of a handshake error 2012-12-06 23:02:15 +01:00
Loïc Hoguin
db6b1596ae Make a few more missing headers lowercase 2012-12-05 13:43:25 +01:00
Loïc Hoguin
067958abd2 Add more frame types available in websocket replies
We can now reply empty close, ping and pong frames, or close
frames with a payload.

This means that we can send a frame and then close the connection
in a single operation.

If a close packet is sent, the connection is closed immediately,
even if there was frames that remained to be sent. Cowboy will
silently drop any extra frames in the list given as a reply.
2012-12-02 21:37:24 +01:00
Loïc Hoguin
45dd67741f Clarify error reports indicating they come from Cowboy 2012-11-28 18:30:53 +01:00
Ali Sabil
9b0049fdd7 Check for errors when calling Transport:send in the websocket protocol
In some situations, the underlying socket might become "half-open" in
which case the websocket will stay in a waiting state indefinitely. The
detection of this state requires checking for errors when calling send.
2012-11-27 13:45:25 +01:00
Loïc Hoguin
09914c4693 Allow websocket handlers to reply more than one frame
Instead of returning {text, Data}, you can now return
[{text, Data}, {text, Data2}, ...].
2012-10-11 21:46:43 +02:00
Loïc Hoguin
aeb86e70c1 Add crypto into the required applications
As suggested by @prof3ta.
2012-10-11 20:13:23 +02:00
Loïc Hoguin
34021666cb Don't use decode_packet/3 for parsing the headers
Header names are now binaries. Since header names are case insensitive
they are all converted to lowercase. For example: <<"content-length">>.

The max_line_length option was removed. Three new options have been
added instead:

 *  max_request_line_length (defaults to 4096)
 *  max_header_name_length (defaults to 64)
 *  max_header_value_length (defaults to 4096)
2012-09-21 09:18:56 +02:00
Loïc Hoguin
8d5f8db90a Improve consistency of return types for cowboy_req API
The signature of parse_header, body_qs, multipart_data and
the set_resp_* functions has changed.

See the cowboy_req module edoc for more details.
2012-09-17 13:56:58 +02:00
Loïc Hoguin
9ef94fb64e Introduce cowboy_req:set_meta/3 to set request metadata 2012-09-15 22:51:37 +02:00
Loïc Hoguin
0aaa717575 Remove duplicate code for ensure_response 2012-09-15 22:19:39 +02:00
Loïc Hoguin
27d591180c Add cowboy_req:url/1 to return the full request URL
Use it in cowboy_websocket for hixie76, replacing http by ws.
2012-09-15 22:03:00 +02:00
Loïc Hoguin
cd54214def Avoid a duplicate HTTP reply in cowboy_websocket:upgrade_error/1
Do this by checking whether we received the resp_sent message.
2012-09-15 21:18:53 +02:00
Loïc Hoguin
35ebe0b108 Put socket and transport into cowboy_websocket's #state{}
As part of the work to make cowboy_req:req() opaque.
2012-09-15 21:09:12 +02:00
Loïc Hoguin
bb4bd9ac96 Add a cowboy_req:to_list/1 function
Removes a lot of duplicate code when printing error messages.
2012-09-15 20:33:57 +02:00
Loïc Hoguin
9b5cbb5000 Remove two unneeded Req modifications 2012-09-15 12:56:45 +02:00
Loïc Hoguin
d9e76d59a1 Change type #http_req{} to cowboy_req:req()
This removes cowboy_static's dependency on http.hrl.
2012-09-15 01:31:51 +02:00
Loïc Hoguin
79839b7bb5 Replace cowboy_req:path/1 with cowboy_req:raw_path/1
The latter is much more useful than the former, which ends up
being removed.
2012-09-10 12:26:04 +02:00
Loïc Hoguin
6fa734b487 Replace cowboy_req:host/1 with cowboy_req:raw_host/1
The latter is much more useful than the former, which ends up
being removed.
2012-09-10 12:25:57 +02:00
Loïc Hoguin
0e3adf1fee Rename cowboy_http_websocket to cowboy_websocket 2012-08-27 14:00:28 +02:00
Renamed from src/cowboy_http_websocket.erl (Browse further)