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

124 commits

Author SHA1 Message Date
Loïc Hoguin
078ab340e9 Merge remote-tracking branch 'nox/improve-readme' 2011-05-07 16:16:22 +02:00
Anthony Ramine
cd737847cf Improve README 2011-05-07 16:11:06 +02:00
Loïc Hoguin
86732c76a2 Merge remote-tracking branch 'nox/atom-response-headers' 2011-05-07 12:47:16 +02:00
Loïc Hoguin
5a7b7429ff Greatly improve the README.
Forward me any more questions and I'll continue on improving it.
2011-05-07 12:46:23 +02:00
Anthony Ramine
48f7cd3a35 Allow atoms for response header names 2011-05-06 11:39:38 +02:00
Loïc Hoguin
470baff61f Add headers_huge test, demonstrating issue #3 is fixed.
The previous commit switching to raw recv + erlang:decode_packet/3
works around the OTP bug regarding headers size in http recv.
2011-05-05 17:11:27 +02:00
Loïc Hoguin
29e71cf4da Switch the HTTP protocol to use binary packets instead of lists.
The server now does a single recv (or more, but only if needed)
which is then sent to erlang:decode_packet/3 multiple times. Since
most requests are smaller than the default MTU on many platforms,
we benefit from this greatly.

In the case of requests with a body, the server usually read at
least part of the body on the first recv. This is bufferized
properly and used when later retrieving the body.

In the case of pipelined requests, we can end up reading many
requests in a single recv, which are then handled properly using
only the buffer containing the received data.
2011-05-05 14:03:39 +02:00
Loïc Hoguin
6c1f73c53c Add cowboy_http_req:port/1.
Returns the port given in the Host header if present,
otherwise the default port of 443 for HTTPS and 80 for HTTP
is returned.
2011-05-04 12:52:13 +02:00
Loïc Hoguin
cc663df5db Makefile: Add separate eunit and ct test rules. 2011-05-04 11:50:46 +02:00
Loïc Hoguin
bb800ee0d9 Use http_headers() type in cowboy_http_req:headers/1. 2011-05-04 11:29:06 +02:00
Loïc Hoguin
849ec73eb8 Merge remote-tracking branch 'nox/complete-app-file' 2011-05-03 16:03:17 +02:00
Anthony Ramine
9c155bfea7 Add cowboy_sup to the list of registered processes
Cowboy top supervisor has a name and it should be clearly stated in its
.app.src file.
2011-05-03 16:00:55 +02:00
Loïc Hoguin
0fa5f71232 Merge pull request #5 from yrashk/patch-1.
README: added a mentioning of agner dependencies mechanism
2011-04-30 13:32:37 -07:00
Loïc Hoguin
732ccf12dc Merge pull request #4 from nox/erlang-highlighting.
Use syntax highlighted code block in README.md
2011-04-30 13:31:51 -07:00
Loïc Hoguin
65048fa657 Add backlog transport option.
This fixes issues with the http_load benchmark tool. The default backlog
option from OTP only queues up to 5 connections, which is way too low for
a fast-responding server.

Issue initially found thanks to DeadZen bugging me to test cowboy with
http_load. Fix found thanks to ostinelli's misultin already having the
backlog option which was the one thing it did differently than cowboy.
2011-04-30 22:26:56 +02:00
Yurii Rashkovskii
cf6a506385 README: added a mentioning of agner dependencies mechanism 2011-04-30 12:20:36 -07:00
Anthony Ramine
2c21f0cd09 Use syntax highlighted code block in README.md
GitHub just implemented that and we should use it.
https://github.com/blog/832-rolling-out-the-redcarpet
2011-04-30 12:32:43 +02:00
Loïc Hoguin
c044fa9602 Remove the next_request function always matching its first clause. 2011-04-30 01:14:57 +02:00
Loïc Hoguin
20293be912 Fix type specs for ssl:socket.
Should fix the warnings given by the Dialyzer-current build
over at http://dialyzer.softlab.ntua.gr/current/cowboy/

Thanks Kostis for the help.
2011-04-29 11:34:32 +02:00
Loïc Hoguin
e8286e18e6 Remove the include/types.hrl file. 2011-04-18 13:56:38 +02:00
Loïc Hoguin
63a92df14e Replace port_number() by ip_port() from kernel/include/inet.hrl. 2011-04-18 13:52:32 +02:00
Loïc Hoguin
731d839323 Replace posix() by atom(), for now.
The type isn't exported by OTP so we don't win much.
Also, inet.erl and file.erl define posix() différently,
so OTP needs to stop being so confuse in the first place
before we can attempt to use it properly.
2011-04-18 13:32:35 +02:00
Loïc Hoguin
db7833f5e8 Move the type application_start_type() into cowboy_app. 2011-04-18 13:27:42 +02:00
Loïc Hoguin
2beb5c8206 Move the dispatcher related types into cowboy_dispatcher. 2011-04-18 13:24:27 +02:00
Loïc Hoguin
6712eaa5c8 Rename match() into match_rule(). 2011-04-18 12:20:52 +02:00
Loïc Hoguin
ef2673b61e Rename dispatch() into dispatch_rules(). 2011-04-18 12:14:13 +02:00
Loïc Hoguin
ecf117b375 Rename dispatch_rules() into dispatch_rule(). 2011-04-18 12:06:53 +02:00
Loïc Hoguin
02d825e003 Move HTTP types definitions to include/http.hrl (for now). 2011-04-18 00:25:04 +02:00
Loïc Hoguin
61d755f8cc Move the opaque type sslsocket() out of include/types.hrl. 2011-04-18 00:09:12 +02:00
Loïc Hoguin
15dc645596 Use the inet:socket() type instead of the user-defined one. 2011-04-18 00:06:26 +02:00
Loïc Hoguin
9ad32386c0 Use the inet:ip_address() type instead of the user-defined one. 2011-04-17 23:57:30 +02:00
Loïc Hoguin
734f57aa8a ct: Throw garbage at the server then check if it's still up.
Basically:
cat /dev/urandom | nc host port

Only run this test if cat and nc are available.
2011-04-17 13:36:51 +02:00
Loïc Hoguin
8f818d79df Add an accept timeout for code reloading.
Thought it was already there, but I guess not. Anyway it's here now
so everything is back to normal. ;)
2011-04-16 13:59:30 +02:00
Loïc Hoguin
d4985dd72b SSL transport uses sslsocket(), not plain socket(). 2011-04-14 23:42:03 +02:00
Loïc Hoguin
cb60d18e82 Initial draft-hixie-thewebsocketprotocol-76 support. 2011-04-14 21:21:17 +02:00
Loïc Hoguin
7f35f693fc Fix specs for cowboy_http_req:reply/4.
Body is iodata(), not iolist().
2011-04-14 14:13:26 +02:00
Loïc Hoguin
c32db277c8 Fix a bug where dupe headers were sent in cowboy_http_req:reply/4.
Now the server defines default headers that can be overwritten by the
handler simply by passing them to the reply/4 function. Default headers
include, for now, Connection and Content-Length headers. Note that it isn't
enough to change the Connection header to close a keep-alive connection
server-side.
2011-04-14 01:32:02 +02:00
Loïc Hoguin
4048499af2 Add a test case for cowboy_dispatcher:match/3.
Added it while debugging an issue, so why not keep it?
2011-04-14 01:10:57 +02:00
Loïc Hoguin
bc99200bae Add a Transport:messages/0 function to obtain the atoms sent in active mode.
That way we can support active mode without having to hardcode the atoms
for each transports available.
2011-04-12 16:27:44 +02:00
Loïc Hoguin
aab91c044b Don't enable binary optimization warnings by default.
It's problematic: both doing it right and doing it wrong trigger a warning
and we treat warnings as errors.
2011-04-12 16:23:52 +02:00
Loïc Hoguin
73b120b68e Fix a pattern matching bug in cowboy_http_protocol:handler_init/2. 2011-04-12 16:22:46 +02:00
Loïc Hoguin
0ef66b78f7 ct: Add a test for requests pipelining. 2011-04-10 02:43:30 +02:00
Loïc Hoguin
f05953516b ct: Add a test for \n which throws an error 400. 2011-04-09 15:45:25 +02:00
Loïc Hoguin
6ec20b736e Limit the number of empty lines to allow before the request-line.
Defaults to 5. Prevents someone from indefinitely sending empty lines.
2011-04-09 15:28:41 +02:00
Loïc Hoguin
c79df567be ct: Add tests for incomplete requests leading to a timeout. 2011-04-09 13:53:22 +02:00
Loïc Hoguin
21dc1cc546 ct: Add raw tests to check that errors are properly handled. 2011-04-09 12:59:53 +02:00
Loïc Hoguin
3a776b146e Initial work on a ct test suite for the HTTP protocol.
Handles two basic tests for both HTTP and HTTPS.
Also renames 'make test' into 'make tests'.
2011-04-08 16:30:37 +02:00
Loïc Hoguin
4cbba84a00 Discard the port from the host before tokenizing it. 2011-04-08 12:12:46 +02:00
Loïc Hoguin
0fad6c6fde Don't crash on errors while receiving headers; throw an error 500 instead.
The server shouldn't crash the request process when we have an error
while receiving headers. A case where this could happen is if the header
line is too long.

See also bfrog's report on ticket #3 on github.
2011-04-07 00:54:32 +02:00
Loïc Hoguin
d8a2fcf258 Don't automatically retrieve the peer information for the 'OPTIONS' method. 2011-04-05 20:09:49 +02:00