Fix specs for cowboy_http:language_range_ret/3
Fix default parsed values for the Accept and Accept-* headers
Add set_resp_header/3 and set_resp_body/2 to cowboy_http_req

These functions allow to set response headers and body in advance,
before calling any of the reply functions.

Also add has_resp_header/2 and has_resp_body/1 to check if the given
response headers have already been set.
Fix a websocket test handler that was throwing an unwanted error

The test still worked because we expect the websocket connection
to fail, but it didn't fail exactly the way we wanted it to.
Weekdays are binaries and not lists

Spotted by devinus on IRC.
Change the returned value for language_range parsing

Considering how it must be used, a simple binary is much better
than a tag and a list of subtags. We still parse them like this
to make sure they follow the specs, though.
Fix specs to allow headers as iodata() and not just binary()
The semantics for a missing 'If-Match' aren't the same as '*'
Add experimental Webmachine based REST protocol support

As with everything experimental, it probably has a lot of bugs and
may not even work.

Like Websocket, REST must be upgraded from a standard resource through
the init/3 function.

A key difference between Webmachine and Cowboy's REST protocol handler
is that in Cowboy the resource has direct access to the request object.
This makes a small change in a few places where you were expected to
return headers or body in Webmachine and are now expected to set them
directly yourself if needed (options/2, for example).

Another difference is that the functions rest_init/2 will always be
called when starting to process a request. Similarly, rest_terminate/2
will be called when the process completes successfully.

The Cowboy REST support also includes automatic language selection,
thanks to the languages_provided/2 callback.

Finally, Cowboy REST expects full URIs to be given at all times, and
will not try to reconstruct URIs from fragments.

Note that REST requests cannot be chained (keepalive) at this time.
This is a design issue in cowboy_http_protocol that will be fixed soon.

Check out the source for more details. It has been designed to be very
easy to read and understand so if you don't understand something,
it's probably a bug. Thanks in advance for all the great bug reports,
pull requests and comments you'll forward my way!
cowboy_http_protocol shouldn't crash if the client sends HTTP responses

It was replying back the correct error, but with a crash message in
the console. This patch prevents it from crashing.

Fixes issue #94 reported by oribrost.
Simplify the guards for cowboy_http_req:body/2
Fix a crash in websocket_handshake/3 with hixie-76

Happened when an error occurred while trying to read the body to
get the key. Also fixes all the dialyzer warnings in cowboy_http_websocket.
Add cowboy_http_req:set_resp_cookie/4

Pretty much just an alias for a combination of set_resp_header and cookie.
replace quoted:from_url with cowboy_http:urldecode

This change makes the dependency on quoted optional
by adding a minimal urldecode function to cowboy.

A protocol option for setting the urldecoding function
has been added to the cowboy_http_protocol module.
The default value for this option is set to be
equivalent to the default settings for quoted.

{fun cowboy_http:urldecode/2, crash}

A note has been added in the README to document
how to use quoted instead of this function.

A field to store this option value has been added
to the state record in the cowboy_http_protocol
module and the http_req record in include/http.hrl

Functions that previously used quoted:from_url/1
has been updated to require an equivalent function
in addition to the previously required arguments.

This change removes a C compiler from the build
requirements of cowboy. It also removes the requirement
to cross compile the code if the target arch/OS
is different from the arch/OS used to build it.
Merge branch 'noquoted' of https://github.com/klaar/cowboy
peer_addr/1 function
Allow HTTP protocol upgrades to use keepalive

REST needed this to be allowed to chain requests on the same connection.
Add default values to known_methods and allowed_methods

Only allowing HEAD and GET requests by default.
Merge branch 'master' of https://github.com/erlyvideo/cowboy

Just fixed the indentation a bit.
Add more documentation to the REST protocol handler