aboutsummaryrefslogtreecommitdiffstats
path: root/src
AgeCommit message (Collapse)Author
2012-01-06Make REST handlers' process_post accept true or false return valuesLoïc Hoguin
They should return true when it has been processed successfully, or false otherwise, in which case a 500 error is sent. Fixes #119.
2012-01-06Fix handler crashes handlingLoïc Hoguin
We try to send a 500 error only if we didn't send the response headers yet. If they were, then we have no way to be sure the response was fully sent, nor should we assume anything about how this will be handled client-side, so we do nothing more and in both cases close the connection.
2012-01-06Move the ensure_response call before ensure_body_processedLoïc Hoguin
We want to reply as soon as possible.
2012-01-05Add test and doc for content types function.Magnus Klaar
2012-01-04inet_address:parse/1 does not accept binaries as an input, only stringsYurii Rashkovskii
2012-01-03Merge branch 'static-handler-split' of https://github.com/klaar/cowboyLoïc Hoguin
2012-01-03Add note on async threads to cowboy_http_static.Magnus Klaar
2011-12-28Add built-in cowboy_http_static handler.Magnus Klaar
2011-12-28Add cowboy_http_req:set_resp_body_fun/3 to restMagnus Klaar
2011-12-28Add cowboy_http_req:set_resp_body_fun/3.Magnus Klaar
2011-12-28Add cowboy_http_req:transport/1 function.Magnus Klaar
2011-12-26Use calendar date and time types exported since R14B04Loïc Hoguin
Removes the cowboy_clock:date/0, time/0 and datetime/0 exported types.
2011-12-22Add 'Upgrade' header parsingLoïc Hoguin
Not parsing product tokens, I don't see much point.
2011-12-22Remove outdated @todo notes and update anotherLoïc Hoguin
2011-12-22Add a max_keepalive HTTP protocol optionLoïc Hoguin
Based on the patch by Louis-Philippe Gauthier.
2011-12-22Websocket control frames payload length must be lower than 126 bytesLoïc Hoguin
2011-12-19create_path now returns a path, not an URILoïc Hoguin
Also add the new 'put_path' metadata information to the request before entering the put_resource step (which proceeds to call content_types_accepted and then the chosen content type's callback, which is expected to use the 'put_path' value as the path to the new resource instead of the original request path, because it may have been changed by the create_path call.
2011-12-19Add meta/2 and meta/3 to cowboy_http_req to save useful protocol informationLoïc Hoguin
* cowboy_http_protocol now defines 'websocket_version' as metadata. * cowboy_http_rest now defines 'media_type', 'language', 'charset' as metadata.
2011-12-19Add missing p_headers and cookies to compacted valuesLoïc Hoguin
2011-12-16update type of resp_body to iodataMagnus Klaar
resp_body is set by cowboy_http_req:set_resp_body/2 which accepts the input type iodata(). Update the resp_body field to use the same type. Also update the cowboy_http_req:has_resp_body/2 function to use the iolist_size/1 which works with both binary() and iolist() values instead of the byte_size/1 function which only works with binary() values.
2011-12-15Fix a dialyzer warningLoïc Hoguin
2011-12-15Reply status 400 if we receive an unexpected value or error for headersLoïc Hoguin
2011-12-15Add cowboy:accept_ack/1 for a cleaner handling of the shoot messageLoïc Hoguin
2011-12-12Merge branch 'variances-fix' of github.com:klaar/cowboyLoïc Hoguin
2011-12-12Fixes match_media_type in cowboy_http_restLoïc Hoguin
Based on the patch from Heinz N. Gies. The main change is that his patch accept values such as */plain which we do not want. Fixes issue #105.
2011-12-12Merge branch 'hipe-compilation-fix' of github.com:klaar/cowboyLoïc Hoguin
2011-12-12Merge branch 'master' of github.com:talentdeficit/cowboyLoïc Hoguin
2011-12-12adds webmachine format content type handlingalisdair sullivan
2011-12-11update cowboy_http_rest:variances/2Magnus Klaar
Fix pattern in case statement that was intended to strip away the first comma separating the values in the variance header. Update generation of variance list to use more idiomatic erlang. Pattern match on list structure over using erlang:length/1 to compute length.
2011-12-10update /bits in binary expressions to /binaryMagnus Klaar
This is a workaround for an issue in the hipe compiler where compilation of code matching on binaries using patterns of the form Data = <<Char, _Ignore/bits>> fails because _Ignore is expected to be used. Using /binary instead of /bits resolves the issue. We're applying this change to all binary expressions in cowboy_http because all functions in this module process human readable text formats which are always expected to be bytestrings. Two uses of /bits has been changed to /binary in cowboy_http_websocket in two clauses of a single function, websocket_data/4. This is safe to change because the data is later passed to binary:match/2 which will always fail with a badarg error if the input is a bitstring instead of a bytestring.
2011-12-09add cowboy_http:urlencode/2 and urlencode/1Magnus Klaar
This function complements the cowboy_http:urldecode/2 and urldecode/1 functions. We should have this encoding covered now. urldecode is only expected to be invoked by user code, no further changes needed to integrate this.
2011-12-08Fix the process_post/2 function in cowboy_http_restLoïc Hoguin
2011-12-08Add more documentation to the REST protocol handlerLoïc Hoguin
2011-12-08Merge branch 'master' of https://github.com/erlyvideo/cowboyLoïc Hoguin
Just fixed the indentation a bit.
2011-12-08Add default values to known_methods and allowed_methodsLoïc Hoguin
Only allowing HEAD and GET requests by default.
2011-12-08Allow HTTP protocol upgrades to use keepaliveLoïc Hoguin
REST needed this to be allowed to chain requests on the same connection.
2011-12-08peer_addr/1 functionMax Lapshin
2011-12-07Merge branch 'noquoted' of https://github.com/klaar/cowboyLoïc Hoguin
2011-12-07replace quoted:from_url with cowboy_http:urldecodeMagnus Klaar
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.
2011-12-07Add cowboy_http_req:set_resp_cookie/4Loïc Hoguin
Pretty much just an alias for a combination of set_resp_header and cookie.
2011-12-06Fix a crash in websocket_handshake/3 with hixie-76Loïc Hoguin
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.
2011-12-06Simplify the guards for cowboy_http_req:body/2Loïc Hoguin
2011-12-06cowboy_http_protocol shouldn't crash if the client sends HTTP responsesLoïc Hoguin
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.
2011-12-05Add experimental Webmachine based REST protocol supportLoïc Hoguin
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!
2011-12-05The semantics for a missing 'If-Match' aren't the same as '*'Loïc Hoguin
2011-12-05Fix specs to allow headers as iodata() and not just binary()Loïc Hoguin
2011-12-01Change the returned value for language_range parsingLoïc Hoguin
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.
2011-11-28Weekdays are binaries and not listsLoïc Hoguin
Spotted by devinus on IRC.
2011-11-28Add set_resp_header/3 and set_resp_body/2 to cowboy_http_reqLoïc Hoguin
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.
2011-11-24Fix default parsed values for the Accept and Accept-* headersLoïc Hoguin