Permalink
Browse files

Upgrade Cowboy to version 0.8.2

  • Loading branch information...
1 parent 45a97b1 commit cff36219ceac8a6ce8567a1190f0c51f0500a69a @essen essen committed Mar 16, 2013
@@ -26,16 +26,16 @@
%%
%% HTTP METHODS
%%
--define(HTTP_GET, 'GET').
--define(HTTP_POST, 'POST').
--define(HTTP_PUT, 'PUT').
--define(HTTP_DELETE, 'DELETE').
--define(HTTP_HEAD, 'HEAD').
+-define(HTTP_GET, <<"GET">>).
+-define(HTTP_POST, <<"POST">>).
+-define(HTTP_PUT, <<"PUT">>).
+-define(HTTP_DELETE, <<"DELETE">>).
+-define(HTTP_HEAD, <<"HEAD">>).
%%
%% HTTP-RELATED
%%
--define(SERVER_HEADER, {"Server","LeoFS"}).
+-define(SERVER_HEADER, {<<"server">>,<<"LeoFS">>}).
-define(STR_NEWLINE, "\n").
-define(STR_SLASH, "/").
-define(BIN_SLASH, <<"/">>).
@@ -44,31 +44,27 @@
-define(ERR_TYPE_INTERNAL_ERROR, internal_server_error).
%% HTTP HEADER
--define(HTTP_HEAD_ATOM_AGE, 'Age').
--define(HTTP_HEAD_ATOM_AUTHORIZATION, 'Authorization').
--define(HTTP_HEAD_ATOM_CACHE_CTRL, 'Cache-Control').
--define(HTTP_HEAD_ATOM_CONTENT_LENGTH, 'Content-Length').
--define(HTTP_HEAD_ATOM_CONTENT_MD5, 'Content-Md5').
--define(HTTP_HEAD_ATOM_CONTENT_TYPE, 'Content-Type').
--define(HTTP_HEAD_ATOM_DATE, 'Date').
-
--define(HTTP_HEAD_ATOM_ETAG, 'Etag').
--define(HTTP_HEAD_ATOM_IF_MODIFIED_SINCE, 'If-Modified-Since').
--define(HTTP_HEAD_ATOM_LAST_MODIFIED, 'Last-Modified').
--define(HTTP_HEAD_ATOM_RANGE, 'Range').
-
--define(HTTP_HEAD_BIN_CACHE_CTRL, <<"Cache-Control">>).
--define(HTTP_HEAD_BIN_CONTENT_TYPE, <<"Content-Type">>).
--define(HTTP_HEAD_BIN_ETAG4AWS, <<"ETag">>).
--define(HTTP_HEAD_BIN_LAST_MODIFIED, <<"Last-Modified">>).
--define(HTTP_HEAD_BIN_PREFIX, <<"prefix">>).
--define(HTTP_HEAD_BIN_X_AMZ_META_DIRECTIVE, <<"X-Amz-Metadata-Directive">>).
--define(HTTP_HEAD_BIN_X_AMZ_COPY_SOURCE, <<"X-Amz-Copy-Source">>).
--define(HTTP_HEAD_BIN_X_AMZ_ID_2, <<"X-Amz-Id-2">>).
--define(HTTP_HEAD_BIN_X_AMZ_REQ_ID, <<"X-Amz-Request-Id">>).
--define(HTTP_HEAD_BIN_X_AMZ_META_DIRECTIVE_COPY, <<"COPY">>).
--define(HTTP_HEAD_BIN_X_AMZ_META_DIRECTIVE_REPLACE, <<"REPLACE">>).
--define(HTTP_HEAD_BIN_X_FROM_CACHE, <<"X-From-Cache">>).
+-define(HTTP_HEAD_AGE, <<"age">>).
+-define(HTTP_HEAD_AUTHORIZATION, <<"authorization">>).
+-define(HTTP_HEAD_CACHE_CTRL, <<"cache-control">>).
+-define(HTTP_HEAD_CONTENT_LENGTH, <<"content-length">>).
+-define(HTTP_HEAD_CONTENT_MD5, <<"content-md5">>).
+-define(HTTP_HEAD_CONTENT_TYPE, <<"content-type">>).
+-define(HTTP_HEAD_DATE, <<"date">>).
+-define(HTTP_HEAD_ETAG, <<"etag">>).
+-define(HTTP_HEAD_IF_MODIFIED_SINCE, <<"if-modified-since">>).
+-define(HTTP_HEAD_LAST_MODIFIED, <<"last-modified">>).
+-define(HTTP_HEAD_PREFIX, <<"prefix">>).
+-define(HTTP_HEAD_RANGE, <<"range">>).
+
+-define(HTTP_HEAD_ETAG4AWS, <<"ETag">>).
+-define(HTTP_HEAD_X_AMZ_META_DIRECTIVE, <<"x-amz-metadata-directive">>).
+-define(HTTP_HEAD_X_AMZ_COPY_SOURCE, <<"x-amz-copy-source">>).
+-define(HTTP_HEAD_X_AMZ_ID_2, <<"x-amz-id-2">>).
+-define(HTTP_HEAD_X_AMZ_REQ_ID, <<"x-amz-request-id">>).
+-define(HTTP_HEAD_X_AMZ_META_DIRECTIVE_COPY, <<"COPY">>).
+-define(HTTP_HEAD_X_AMZ_META_DIRECTIVE_REPLACE, <<"REPLACE">>).
+-define(HTTP_HEAD_X_FROM_CACHE, <<"x-from-cache">>).
-define(HTTP_CTYPE_OCTET_STREAM, <<"application/octet-stream">>).
-define(HTTP_CTYPE_XML, <<"application/xml">>).
@@ -80,10 +76,12 @@
-define(HTTP_ST_OK, 200).
-define(HTTP_ST_NO_CONTENT, 204).
+-define(HTTP_ST_PARTIAL_CONTENT, 206).
-define(HTTP_ST_NOT_MODIFIED, 304).
-define(HTTP_ST_BAD_REQ, 400).
-define(HTTP_ST_FORBIDDEN, 403).
-define(HTTP_ST_NOT_FOUND, 404).
+-define(HTTP_ST_BAD_RANGE, 416).
-define(HTTP_ST_INTERNAL_ERROR, 500).
-define(HTTP_ST_SERVICE_UNAVAILABLE, 503).
-define(HTTP_ST_GATEWAY_TIMEOUT, 504).
View
@@ -8,7 +8,7 @@
{leo_statistics, ".*", {git, "https://github.com/leo-project/leo_statistics.git", {tag, "0.10.10"}}},
{leo_s3_libs, ".*", {git, "https://github.com/leo-project/leo_s3_libs.git", {tag, "0.12.7" }}},
{ecache, ".*", {git, "https://github.com/leo-project/ecache.git", {tag, "0.10.14"}}},
- {cowboy, ".*", {git, "https://github.com/leo-project/cowboy.git", {tag, "0.6.2" }}},
+ {cowboy, ".*", {git, "https://github.com/extend/cowboy.git", {tag, "0.8.2" }}},
{meck, ".*", {git, "https://github.com/eproxus/meck.git", {tag, "0.7.2" }}},
{proper, ".*", {git, "https://github.com/manopapad/proper.git", "7d535ac61e9c2a9a7616af4615c39595a3c5739f"}}
]}.
@@ -8,8 +8,7 @@
{leo_statistics, ".*", {git, "https://github.com/leo-project/leo_statistics.git", "develop" }},
{leo_s3_libs, ".*", {git, "https://github.com/leo-project/leo_s3_libs.git", "develop" }},
{ecache, ".*", {git, "https://github.com/leo-project/ecache.git", "develop" }},
- {mochiweb, ".*", {git, "https://github.com/leo-project/mochiweb.git", "develop" }},
- {cowboy, ".*", {git, "https://github.com/leo-project/cowboy.git", "develop" }},
+ {cowboy, ".*", {git, "https://github.com/extend/cowboy.git", {branch, "master"}}},
{meck, ".*", {git, "https://github.com/eproxus/meck.git", {branch, "master"}}},
{proper, ".*", {git, "https://github.com/manopapad/proper.git", {branch, "master"}}}
]}.
@@ -25,7 +25,7 @@
{vsn, "0.14.0-RC2"},
{id, "leo_gateway"},
{registered, []},
- {applications, [kernel, stdlib, crypto]},
+ {applications, [kernel, stdlib, crypto, ranch]},
{mod, {leo_gateway_app, []}},
{env, []}
]
@@ -206,7 +206,7 @@ handle_loop(Key0, Total, Index, Req) ->
case leo_gateway_rpc_handler:get(Key1) of
%% only children
{ok, #metadata{cnumber = 0}, Bin} ->
- case cowboy_http_req:chunk(Bin, Req) of
+ case cowboy_req:chunk(Bin, Req) of
ok ->
handle_loop(Key0, Total, Index + 1, Req);
{error, Cause} ->
Oops, something went wrong.

0 comments on commit cff3621

Please sign in to comment.