Age | Commit message (Collapse) | Author |
|
The formatted date is generated and kept up to date regularly
by a gen_server process storing it in the cowboy_clock ets table.
Then it is retrieved by other processes simply by reading the table.
|
|
Limits the number of parallel requests processed at once.
Waiting requests are kept in the accept queue.
The limit is not explicitly observed, but it should be
around the given value at any time. Defaults to 1024.
Thanks to ostinelli's benchmark to point out the issue hopefully
solved by this and the previous commit.
|
|
Improves reliability under heavy load.
|
|
Send the status line and headers using
cowboy_http_req:chunked_reply/3, and
individual chunks with cowboy_http_req:chunk/2.
|
|
|
|
|
|
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.
|
|
Returns the port given in the Host header if present,
otherwise the default port of 443 for HTTPS and 80 for HTTP
is returned.
|
|
|
|
Cowboy top supervisor has a name and it should be clearly stated in its
.app.src file.
|
|
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.
|
|
|
|
Should fix the warnings given by the Dialyzer-current build
over at http://dialyzer.softlab.ntua.gr/current/cowboy/
Thanks Kostis for the help.
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Thought it was already there, but I guess not. Anyway it's here now
so everything is back to normal. ;)
|
|
|
|
|
|
Body is iodata(), not iolist().
|
|
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.
|
|
Added it while debugging an issue, so why not keep it?
|
|
That way we can support active mode without having to hardcode the atoms
for each transports available.
|
|
|
|
Defaults to 5. Prevents someone from indefinitely sending empty lines.
|
|
|
|
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.
|
|
|
|
Fixes a bug reported by evaxsoftware on IRC.
|
|
Code is working but hasn't been benchmarked yet.
|
|
|
|
Moved the Transport:listen call to cowboy_acceptors_sup. This make it
depend on a child of cowboy_listener_sup instead of cowboy_sup, which
isn't getting shut down when calling cowboy:stop_listener/1 and thus
didn't close the listening socket.
|
|
As requested by many people on IRC Cowboy is now a proper OTP application
to support soft code upgrades. It should also be easier to start and stop
listeners now using cowboy:start_listener/6 and cowboy:stop_listener/1.
|
|
* Cowboy isn't an OTP application anymore; just a supervisor.
* All processes started by Cowboy are now anonymous.
* All processes related to a listener are now part of its supervision tree.
|
|
This makes cowboy_http_req's qs_val/3, binding/3 and header/3 behave like
proplists:get_value/3.
|
|
Use lists:keyfind/3 in qs_val/3, binding/3 and header/3 and make qs_val/2,
binding/2 and header/2 call those.
|
|
header/2 now returns 'undefined' when the header isn't in the request.
|
|
|
|
After much testing and experimentation of all kinds I find lists to be both
faster and using less memory than binaries for request-line and headers
handling. This is more than likely due to the fact that headers are very
short and thus do not benefit from the advantages of refc binaries, meaning
they're copied, just like lists. The memory usage discrepancy is still a
mystery for the most part, although the hoops needed to perform operations
on the binaries are probably responsible for the extra memory use.
I'm thus giving up on trying to use binaries for request-line and headers.
Instead, this commit improves performances even more to the lists code,
making lists 5% faster than binaries. Lists are easier to work with too,
so I guess it's all a big win for everyone.
Of course the request body is still read as a binary, we're using the
binary type where it performs best.
|
|
|
|
|
|
|
|
|