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

25 commits

Author SHA1 Message Date
Loïc Hoguin
9969684035
Improve trailers test when no te header is sent 2017-11-20 12:17:44 +01:00
Loïc Hoguin
d7761b5259
Remove another test from the old http suite 2017-11-19 22:17:57 +01:00
Loïc Hoguin
39baed6c80
Add preliminary support for trailers in responses
This depends on changes in Cowlib that are only available on
master.
2017-11-15 14:58:49 +01:00
Loïc Hoguin
83bd8bc935
Fix two edge cases for cowboy_req:stream_body
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.
2017-11-01 15:33:10 +00:00
Loïc Hoguin
217fac7f44
Handle expect: 100-continue request headers
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).
2017-10-30 16:21:25 +00:00
Loïc Hoguin
f3d6b05b86
Add cowboy_req:inform/2,3
User code can now send as many 1xx responses as necessary.
2017-10-29 21:03:04 +00:00
Loïc Hoguin
ef58e15547
Introduce cowboy_req:sock/1 and cowboy_req:cert/1
To obtain the local socket ip/port and the client TLS
certificate, respectively.
2017-10-25 21:03:26 +01:00
Jeffrey Griffin
6460e9d2d2
Fix infinite loop on incomplete multipart body
I have amended a lot of changes from the original commit
to make it behave as expected, including returning a 400
error. LH
2017-10-02 13:28:43 +02:00
Loïc Hoguin
fda2d150db
Fix error response when constraint validation fails 2017-09-27 16:20:38 +02:00
Loïc Hoguin
3cbf885961
Improve how we detect request errors
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.
2017-09-14 13:42:17 +02:00
Loïc Hoguin
9f5a1803da
Add tests for direct Req access 2017-09-05 15:28:11 +02:00
Loïc Hoguin
4fd6e2f7cd
Accept sendfile tuple with 0 length in cowboy_req
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.
2017-09-04 20:48:07 +02:00
Loïc Hoguin
ec00e3d60e
Make cowboy_req:read_part return multipart headers as map 2017-06-09 16:57:11 +02:00
Loïc Hoguin
f3e5f3e410
Preliminary h2 flow control support
Existing tests pass. A number of things remain to be done.
Has only been tested with Gun so far. Feedback welcome!
2017-05-19 20:18:00 +02:00
Loïc Hoguin
9255cdf1d7
Change the type of bindings from a list to a map
Maps make more sense because the keys are unique.
2017-02-19 16:51:16 +01:00
Loïc Hoguin
61d66a4de2
Remove outdated todo comments from req_SUITE 2017-02-05 17:12:29 +01:00
Loïc Hoguin
3e05ab8f82
Add experimental cowboy_compress_h stream handler
Currently marked as experimental because it can't be tweaked
(just enabled/disabled) and because it is not documented yet.
2017-01-22 10:50:39 +01:00
Loïc Hoguin
e5a8088e68
Make the new cowboy_req tests more realistic 2017-01-04 19:45:35 +01:00
Johan Lövdahl
3f4e79d42f
Add functions for getting and setting response headers 2017-01-04 13:37:50 +01:00
Loïc Hoguin
43adacc760
Welcome to 2017 2017-01-02 19:36:36 +01:00
Loïc Hoguin
ed664345d7
Add a few more test cases for cowboy_req:match_qs 2017-01-02 14:56:20 +01:00
Loïc Hoguin
ae0dd61673 Add tests for responses and request body reading
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...
2016-08-10 11:49:31 +02:00
Loïc Hoguin
63c7d05eb2 Add tests for cowboy_req: match_cookies and match_qs 2016-06-22 09:27:29 +02:00
Loïc Hoguin
19468d0503 Add cowboy_req:uri/1,2
Along with more cowboy_req tests.

This commit also removes cowboy_req:url/1 and cowboy_req:host_url/1
in favor of the much more powerful new set of functions.
2016-06-21 19:04:52 +02:00
Loïc Hoguin
d9cad866f2 Add initial req suite 2016-06-20 17:31:31 +02:00