Age | Commit message (Collapse) | Author |
|
This can happen normally when Cowboy is restarted, for example.
Instead of failing requests when that happens, we degrade
gracefully and do a little more work to provide the current
date header.
|
|
Also {switch_handler, Module, Opts}.
Allows switching to a different handler type. This is
particularly useful for processing most of the request
with cowboy_rest and then streaming the response body
using cowboy_loop.
|
|
Unfortunately compression will be disabled for 20.1, 20.1.1
and 20.1.2. In additiona I do not recommend 20.1.3 due to
issues inflating some specific sizes.
|
|
Sending data of size 0 with the fin flag set resulted in nothing
being sent to the client and still considering the response to
be finished for HTTP/1.1.
For both HTTP/1.1 and HTTP/2, the final chunk of body that is
sent automatically by Cowboy at the end of a response that the
user did not properly terminate was not passing through stream
handlers. This resulted in issues like compression being incorrect.
Some tests still fail under 20.1.3. They are due to recent zlib
changes and should be fixed in a future patch release. Unfortunately
it does not seem to be any 20.1 version that is safe to use for
Cowboy, although some will work better than others.
|
|
|
|
|
|
|
|
The 100 continue response will only be sent if the client
has not sent the body yet (at all), if the connection is
HTTP/1.1 or above and if the user has not sent it yet.
The 100 continue response is sent when the user calls
read_body and it is cowboy_stream_h's responsibility
to send it. This means projects that don't use the
cowboy_stream_h stream handler will need to handle the
expect header themselves (but that's okay because they
might have different considerations than normal Cowboy).
|
|
User code can now send as many 1xx responses as necessary.
|
|
Another experimental stream handler. It enables tracing for
the connection process and any children processes based on
the matching of the request. It can be used to do ad-hoc
tracing by sending a specific header, path, method or other.
It is meant to be used both for tests and production. Some
configuration scenarios are NOT safe for production, beware.
It's important to understand that, at this time, tracing
is enabled on the scale of the entire connection including
any future request processes. Keep this in mind when trying
to use it in production. The only way to stop tracing is
by having the callback function exit (by calling exit/1
explicitly). This can be done after a certain number of
events for example. Tracing can generate a lot of events,
so it's a good idea to stop after a small number of events
(between 1000 and 10000 should be good) and to avoid tracing
the whole world.
Documentation will follow at a later time.
|
|
To obtain the local socket ip/port and the client TLS
certificate, respectively.
|
|
When the user code was sending a response fully without reading
the request body, the connection could get closed when receiving
DATA frames for that body. We now ask the client to stop sending
data via a NO_ERROR RST_STREAM, and linger any stream that has
been reset so that we can skip any pending frames from that
stream.
This fixes a number of intermittent failures in req_SUITE, which
now passes reliably.
In addition a small number of rfc7540_SUITE test cases have been
corrected as they were incorrect.
|
|
|
|
I broke this when fixing stream handlers earlier.
|
|
When we have to send a response before terminating a stream,
we call info. The state returned by this info call was
discarded when we called terminate after that. This commit
fixes it.
There are no tests for this, however the new metrics test
in the next commit requires the correct behavior so this
is ultimately covered.
|
|
|
|
It collects metrics and passes them to a configurable callback
once the stream terminates. It will be documented in a future
release. More tests incoming.
|
|
It is possible in some cases to move on to the next request
without waiting, but that can be done as an optimization
later on if necessary.
|
|
|
|
|
|
I have amended a lot of changes from the original commit
to make it behave as expected, including returning a 400
error. LH
|
|
|
|
|
|
Also corrects the lack of error response when HTTP/1.1 is used.
|
|
|
|
|
|
The documentation was correct, the code was not.
This should make it easier to implement new protocols. Note that
for HTTP/2 we will need to add some form of counting later on to
check for malformed requests, but we can do simpler and just
reduce from the expected length and then check if that's 0 when
IsFin=fin.
|
|
|
|
|
|
It is completely removed for connection processes, because
assuming Cowboy is written properly this should bring us
nothing anymore in 2.0.
It is reworked for request processes, there we want to
always propagate the stacktrace (including for exits)
because we will print a report to help with debugging
and proc_lib doesn't propagate it for exits.
At the same time the initial callback for connection
and request processes has been changed to connection_process
and request_process, which should help with identifying
processes when inspecting.
|
|
When the request process exits with a {request_error, Reason, Human}
exit reason, Cowboy will return a 400 status code instead of 500.
Cowboy may also return a more specific status code depending on
the error. Currently it may also return 408 or 413.
This should prove to be more solid that looking inside the stack
trace.
|
|
The header never reaches this point.
|
|
|
|
This will result in no data being sent. It's simply easier to
do this than to have to handle 0 size cases in user code.
|
|
I have decided not to include a manual page for
cowboy_stream_h at this point because it clashes
with the cowboy_stream manual page. This decision
will be revisited in the future.
|
|
|
|
|
|
My bad! Still new at this.
|
|
This should work very similar to normal supervisors,
in particular during the shutdown sequence when the
connection process goes down or switches to Websocket.
Processes that need to enforce the shutdown timeout
will be required to trap exits, just like in a supervisor.
In a vanilla Cowboy, this only matters at connection
shutdown, as Cowboy will otherwise wait for the request
process to be down before stopping the stream.
Tests are currently missing.
|
|
Cowboy was encoding the headers then decoding them when initializing
the request. The problem is that the encoding and decoding contexts
are not the same. Now, Cowboy will directly use the headers it
received in the push command for the new request. This is also
more efficient.
I am surprised it worked at all considering the issue.
|
|
|
|
|
|
|
|
|
|
These characters are not allowed in URI paths.
|
|
|
|
There are two important changes in this commit.
Constraints are now producing an error tuple. This error tuple
in turn can be provided to a function for formatting a human
readable error message. Both the error tuple and the formatting
code are controlled by and part of the constraint function.
Constraints now also implement the reverse operation.
When constraint functions only validate, the reverse operation
will be the same as the forward operation. When they also do
some conversion then the reverse operation will reverse it.
Since constraints are now performing 3 different operations
(forward, reverse and format_error), they now take the form
of a function accepting two separate arguments. The operation
is the first argument.
In addition, the return value was changed to take the form
of {ok, Value} | {error, Reason}. The value must be returned
as-is if it was not modified.
|
|
|
|
They are now cowboy:start_clear/3 and cowboy:start_tls/3.
The NumAcceptors argument can be specified via the
num_acceptor transport option. Ranch has been updated
to 1.4.0 to that effect.
|
|
Introduces the new stream_handler_SUITE test suite. More cases
will be added later on.
|