Permalink
Browse files

R16 crypto needs asn1, minor formatting cleanup.

  • Loading branch information...
1 parent 15b7c5a commit d2be664ceb58199878a30fbe81eb9ba1be548f2f @knutin committed Dec 13, 2013
Showing with 22 additions and 23 deletions.
  1. +20 −22 src/elli_http.erl
  2. +2 −1 test/elli_ssl_tests.erl
View
@@ -104,7 +104,7 @@ handle_response(Req, Buffer, {response, Code, UserHeaders, Body}) ->
t(request_end),
handle_event(Mod, request_complete, [Req, Code, Headers, Body, get_timings()], Args),
- {close_or_keepalive(Req, UserHeaders), Buffer};
+ {close_or_keepalive(Req, UserHeaders), Buffer};
handle_response(Req, _Buffer, {chunk, UserHeaders, Initial}) ->
@@ -142,27 +142,6 @@ handle_response(Req, Buffer, {file, ResponseCode, UserHeaders, Filename, Range})
--spec mk_req(Method::http_method(), {PathType::atom(), RawPath::binary()},
- RequestHeaders::headers(), RequestBody::body(), V::version(),
- Socket::elli_tcp:socket() | undefined, Callback::callback()) ->
- record(req).
-mk_req(Method, RawPath, RequestHeaders, RequestBody, V, Socket, Callback) ->
- {Mod, Args} = Callback,
- case parse_path(RawPath) of
- {ok, {Path, URL, URLArgs}} ->
- #req{method = Method, path = URL, args = URLArgs, version = V,
- raw_path = Path, headers = RequestHeaders,
- body = RequestBody, pid = self(), socket = Socket,
- callback = Callback};
- {error, Reason} ->
- handle_event(Mod, request_parse_error,
- [{Reason, {Method, RawPath}}], Args),
- send_bad_request(Socket),
- elli_tcp:close(Socket),
- exit(normal)
- end.
-
-
%% @doc: Generates a HTTP response and sends it to the client
send_response(Req, Code, Headers, UserBody) ->
Body = case {Req#req.method, Code} of
@@ -464,6 +443,25 @@ check_max_size(Socket, ContentLength, Buffer, Opts, {Mod, Args}) ->
ok
end.
+-spec mk_req(Method::http_method(), {PathType::atom(), RawPath::binary()},
+ RequestHeaders::headers(), RequestBody::body(), V::version(),
+ Socket::elli_tcp:socket() | undefined, Callback::callback()) ->
+ record(req).
+mk_req(Method, RawPath, RequestHeaders, RequestBody, V, Socket, Callback) ->
+ {Mod, Args} = Callback,
+ case parse_path(RawPath) of
+ {ok, {Path, URL, URLArgs}} ->
+ #req{method = Method, path = URL, args = URLArgs, version = V,
+ raw_path = Path, headers = RequestHeaders,
+ body = RequestBody, pid = self(), socket = Socket,
+ callback = Callback};
+ {error, Reason} ->
+ handle_event(Mod, request_parse_error,
+ [{Reason, {Method, RawPath}}], Args),
+ send_bad_request(Socket),
+ elli_tcp:close(Socket),
+ exit(normal)
+ end.
%%
%% HEADERS
View
@@ -24,11 +24,12 @@ hello_world() ->
setup() ->
+ application:start(asn1),
application:start(crypto),
application:start(public_key),
application:start(ssl),
inets:start(),
-
+
EbinDir = filename:dirname(code:which(?MODULE)),
CertDir = filename:join([EbinDir, "..", "test"]),
CertFile = filename:join(CertDir, "server_cert.pem"),

0 comments on commit d2be664

Please sign in to comment.