Age | Commit message (Collapse) | Author |
|
|
|
This feature is currently experimental. It will become the
preferred way to use Websocket handlers once it becomes
documented.
A commands-based interface enables adding commands without
having to change the interface much. It mirrors the interface
of stream handlers or gen_statem. It will enable adding
commands that have been needed for some time but were not
implemented for fear of making the interface too complex.
|
|
|
|
|
|
|
|
If content-length is set in the response headers
we can skip chunked transfer-encoding.
|
|
|
|
We now flush messages that are specific to cowboy_http only.
Stream handlers should also flush their own specific messages
if necessary, although timeouts will be flushed regardless
of where they originate from.
Also renames the http_SUITE to old_http_SUITE to distinguish
new tests from old tests. Most old tests need to be removed
or converted eventually as they're legacy tests from Cowboy 1.0.
|
|
|
|
There's already tests failing and quite some refactoring to be
done to make some things easier to test or fix issues.
|
|
The miscount occurred because of a faulty iolist split function.
The bug should now be corrected, a PropEr test has been added
and a regression test has also been added.
|
|
|
|
The option controls how much body we accept to skip for HTTP/1.1
connections when the user code did not consume the body fully.
It defaults to 1MB.
|
|
Support for these was broken during the development
of Cowboy 2.0. It is now fixed and better handled
than it ever was.
|
|
|
|
In some cases we were sending a response faster than h2spec
was sending us the test case data, resulting in the request
being processed successfully instead of failing as expected.
|
|
Found more bugs! Unfortunately no fix for them in this commit.
|
|
Bad chunk sizes used to be accepted and could result in
a badly parsed body or a timeout. They are now properly
rejected.
Chunk extensions now have a hard limit of 129 characters.
I haven't heard of anyone using them and Cowboy does not
provide an interface for them, but we can always increase
or make configurable if it ever becomes necessary (but
I honestly doubt it).
Also a test from the old http suite could be removed. Yay!
|
|
|
|
|
|
|
|
This depends on changes in Cowlib that are only available on
master.
|
|
|
|
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.
|
|
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.
|
|
|
|
Also fix a test group to use h2 instead of HTTP/1.1.
|
|
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.
|
|
Also corrects the lack of error response when HTTP/1.1 is used.
|
|
|
|
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.
|
|
|
|
Introduces the new stream_handler_SUITE test suite. More cases
will be added later on.
|
|
This option allows customizing the compacting of the Req object
when using Websocket. By default it will keep most public fields
excluding headers of course, since those can be large.
|
|
This fixes the connection being dropped because of request_timeout
despite there being some active streams.
|
|
The Opts value is put last, to be more consistent with the
rest of the cowboy_req module.
Additionally a test handler was fixed which reduced the number
of errors in http_SUITE.
|
|
Before this commit we had an issue where configuring a
Websocket connection was simply not possible without
doing magic, adding callbacks or extra return values.
The init/2 function only allowed setting hibernate
and timeout options.
After this commit, when switching to a different
type of handler you can either return
{module, Req, State}
or
{module, Req, State, Opts}
where Opts is any value (as far as the sub protocol
interface is concerned) and is ultimately checked
by the custom handlers.
A large protocol like Websocket would accept only
a map there, with many different options, while a
small interface like loop handlers would allow
passing hibernate and nothing else.
For Websocket, hibernate must be set from the
websocket_init/1 callback, because init/2 executes
in a separate process.
Sub protocols now have two callbacks: one with the
Opts value, one without.
The loop handler code was largely reworked and
simplified. It does not need to manage a timeout
or read from the socket anymore, it's the job of
the protocol code. A lot of unnecessary stuff was
therefore removed.
Websocket compression must now be enabled from
the handler options instead of per listener. This
means that a project can have two separate Websocket
handlers with different options. Compression is
still disabled by default, and the idle_timeout
value was changed from inifnity to 60000 (60 seconds),
as that's safer and is also a good value for mobile
devices.
|
|
Currently marked as experimental because it can't be tweaked
(just enabled/disabled) and because it is not documented yet.
|
|
|
|
|
|
|
|
|
|
Now named read_part/read_part_body, with a verb indicating action.
|
|
|
|
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...
|
|
|