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

92 commits

Author SHA1 Message Date
Loïc Hoguin
fd3c40c7ee Wrap-up the user guide 2014-06-25 11:23:58 +02:00
Loïc Hoguin
642630fea1 Add a multipart intro chapter to the guide 2014-06-23 17:51:36 +02:00
Loïc Hoguin
5cd2f0516a Write the guide chapter rest_flowcharts explaining the diagrams 2014-06-22 17:10:17 +02:00
Loïc Hoguin
efa8bb5cf8 Add a missing "true" label 2014-06-21 19:03:53 +02:00
Loïc Hoguin
05503affa8 Add a stub chapter with all the REST flowcharts
The detailed explanations will be written at a later time.
2014-06-21 18:50:50 +02:00
Loïc Hoguin
7b18373943 Add more details about the 304 in cond diagram 2014-06-21 18:22:20 +02:00
Loïc Hoguin
0083f44c6a Add REST diagram for PUT/POST/PATCH 2014-06-21 18:15:50 +02:00
Loïc Hoguin
14c1414b4b Add REST diagram for DELETE method 2014-06-20 19:52:51 +02:00
Loïc Hoguin
b386c962f6 Add REST diagram for GET and HEAD 2014-06-20 18:56:07 +02:00
Loïc Hoguin
1b22e1582e Add REST diagram for the part about conditional requests 2014-06-19 19:46:45 +02:00
Loïc Hoguin
82f51ca6d2 Add variances to the conneg diagram 2014-06-19 19:29:35 +02:00
Loïc Hoguin
a4cc031218 Add more REST diagrams 2014-06-19 13:47:49 +02:00
Loïc Hoguin
d8b65cbc33 Add REST diagram for OPTIONS method 2014-06-18 17:08:25 +02:00
Loïc Hoguin
7a808e0aa3 Add a REST principles chapter to the guide
This is a complex subject so hopefully I did not introduce
errors while trying to explain it.
2014-06-04 15:28:27 +02:00
Loïc Hoguin
0c37925642 Add request body reading options
The options were added to allow developers to fix timeout
issues when reading large bodies. It is also a cleaner and
easier to extend interface.

This commit deprecates the functions init_stream, stream_body
and skip_body which are no longer needed. They will be removed
in 1.0.

The body function can now take an additional argument that is a
list of options. The body_qs, part and part_body functions can
too and simply pass this argument down to the body call.

There are options for disabling the automatic continue reply,
setting a maximum length to be returned (soft limit), setting
the read length and read timeout, and setting the transfer and
content decode functions.

The return value of the body and body_qs have changed slightly.
The body function now works similarly to the part_body function,
in that it returns either an ok or a more tuple depending on
whether there is additional data to be read. The body_qs function
can return a badlength tuple if the body is too big. The default
size has been increased from 16KB to 64KB.

The default read length and timeout have been tweaked and vary
depending on the function called.

The body function will now adequately process chunked bodies,
which means that the body_qs function will too. But this means
that the behavior has changed slightly and your code should be
tested properly when updating your code.

The body and body_qs still accept a length as first argument
for compatibility purpose with older code. Note that this form
is deprecated and will be removed in 1.0. The part and part_body
function, being new and never having been in a release yet, have
this form completely removed in this commit.

Again, while most code should work as-is, you should make sure
that it actually does before pushing this to production.
2014-06-02 23:09:43 +02:00
Loïc Hoguin
87cd5a2206 Change wording in the guide to remove ambiguity 2014-04-26 14:32:56 +02:00
Loïc Hoguin
239e5e0ba7 Update and improve Websocket chapters in the guide 2014-03-03 16:59:02 +01:00
Loïc Hoguin
917cf99e10 Add and document the new multipart code
The old undocumented API is removed entirely.

While a documentation exists for the new API, it will not
be considered set in stone until further testing has been
performed, and a file upload example has been added.

The new API should be a little more efficient than the
old API, especially with smaller messages.
2014-02-06 19:36:25 +01:00
Loïc Hoguin
df81862554 Merge branch 'patch-1' of git://github.com/alco/cowboy 2013-11-15 22:08:26 +01:00
Loïc Hoguin
62a47914d8 Fix link to the Ranch guide in getting started 2013-11-15 22:00:59 +01:00
Alexei Sholik
1c8b6e3c45 Fix grammar in "how it looks like" 2013-11-14 18:47:02 +02:00
Loïc Hoguin
6672ea0415 Review, improve and document the static files handler
Changes include:

 *  Much simplified route configuration.

 *  Etag generation is now enabled by default.

 *  Web mimetypes are now detected by default. A bigger list of
    mimetypes can be detected without any additional library.

 *  Mimetypes can no longer be specified as a list. Copying this
    list for new connections is too costy. You can easily convert
    it into a function and pass that function to the handler instead.

 *  You can however specify a single hardcoded mimetype. Mostly
    useful when serving a single file, like an index.html file,
    to avoid extra operations.

 *  Specifying a path as a list of tokens is not possible anymore.
    Use either a binary or a string.

 *  Using a private directory will not work if the application
    was not started properly. Cowboy will not attempt to find
    the location of this directory if the VM doesn't know it,
    as this caused issues in some setups.

 *  Overall the code has been much simplified and clarified,
    and of course has now been documented.
2013-11-02 14:41:46 +01:00
Loïc Hoguin
4769412daa erlang.mk now has built-in support for relx 2013-10-14 16:05:19 +02:00
Loïc Hoguin
2b2829f585 Greatly expand on the Req object
Cut in four different chapters: request, request body,
response and cookies.
2013-09-23 15:44:10 +02:00
Loïc Hoguin
eb4843a46b Remove unnecessary titles 2013-09-18 20:30:11 +02:00
Loïc Hoguin
7906f30d83 Greatly improve the HTTP handlers chapter 2013-09-18 20:29:48 +02:00
Loïc Hoguin
7319526de6 Added a chapter about life of HTTP requests
Reworked the table of contents also.
2013-09-18 12:02:37 +02:00
Loïc Hoguin
40b87545f6 Fix SPDY push explanations 2013-09-10 12:08:18 +02:00
Loïc Hoguin
c7f7e4456e Much improved Getting started chapter
We now describe how to build a hello world application from
start to finish, including setting up erlang.mk for building,
and using relx for generating the release. All concepts are
not explained in details of course, but we don't need to at
this point, we just want things to be working.
2013-09-07 12:54:55 +02:00
Loïc Hoguin
4a30198f90 Make cowlib a proper dependency
Start moving a few functions from Cowboy into cowlib.
2013-09-04 19:24:54 +02:00
Loïc Hoguin
7855f80e4b Fix some explanations around response bodies 2013-08-27 18:32:53 +02:00
Matthias Endler
f664329b0b Minor corrections of the guide 2013-06-27 22:34:56 +02:00
Loïc Hoguin
61ca86b054 Greatly improve the guide introduction 2013-06-27 00:02:12 +02:00
Loïc Hoguin
b059a1237f Reword the clean erlang code part
We don't care about parameterized modules anymore. They're gone!
2013-06-23 00:34:05 +02:00
Loïc Hoguin
28186a68d0 Make the HTTP version type more practical
Now instead of {1, 1} we have 'HTTP/1.1', and instead of {1, 0}
we have 'HTTP/1.0'. This is more efficient, easier to read in
crash logs, and clearer in the code.
2013-05-16 12:56:01 +02:00
Loïc Hoguin
e0b5526f1e Remove cowboy_req:fragment/1
Clients do not send it. We skip the value if we receive it now,
as it shouldn't happen, and won't for all the mainstream clients.
2013-05-15 15:17:33 +02:00
Loïc Hoguin
9a7d606709 Fix a small error in the REST part of the guide 2013-04-26 17:08:58 +02:00
Loïc Hoguin
5291c3eb0a Update the REST chapter of the guide 2013-04-26 14:12:29 +02:00
Loïc Hoguin
a2f4703e5e Improve static file handler guide chapter
Add more infos about MIME types and the file option.
2013-04-25 18:43:48 +02:00
Loïc Hoguin
beaae7bf70 Document meta values set by REST
You can use these values to perform a reply using the negotiated
content-type and language for non-HEAD/GET methods.
2013-04-25 17:46:40 +02:00
Loïc Hoguin
109a1b8227 Add section about REST methods 2013-04-19 13:54:43 +02:00
Loïc Hoguin
b58a0549e1 Add default operations for OPTIONS method in REST
It defaults to setting the Allow header to "HEAD, GET, OPTIONS".
2013-04-12 19:02:00 +02:00
Loïc Hoguin
0460406969 Merge branch 'eventsource-helper' of git://github.com/jdavisp3/cowboy 2013-04-11 23:58:08 +02:00
Loïc Hoguin
5b9404fd07 Fix static handler snippet in the guide
Thanks to Martin Törnwall for pointing this out.
2013-04-11 23:26:16 +02:00
Loïc Hoguin
23aa1314fc First draft of the REST chapter in the guide 2013-04-11 22:25:36 +02:00
Loïc Hoguin
6256429dc9 Remove cowboy_req:peer_addr/1
This kind of function is highly dependent on the proxy used,
therefore parsing was added for x-forwarded-for instead and we
just let users write the function that works for them. The code
can be easily extracted if anyone was using the function.
2013-04-11 22:25:36 +02:00
Dave Peticolas
e3a2fd2a5b Add a reference to an eventsource helper utility. 2013-04-06 20:05:21 -07:00
Loïc Hoguin
2b56bb498f Update Ranch to 0.8.0 2013-04-03 13:47:12 +02:00
Loïc Hoguin
ce1d8862c0 Replace init_stream/5 with stream_body/2
This allows us to change the max chunk length on a per chunk basis
instead of for the whole stream. It's also much easier to use this
way even if we don't want to change the chunk size.
2013-04-02 19:40:38 +02:00
Loïc Hoguin
66f7c15c4d Add a guide section for resource links 2013-03-22 19:59:35 +01:00