couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From beno...@apache.org
Subject [12/50] mochiweb commit: updated refs/heads/import-upstream to 8eb1f22
Date Thu, 13 Feb 2014 16:06:07 GMT
Add support for possible outputs from 
`erlang:decode_package/3` so they can be handled
gracefully.

Project: http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/commit/d2fb1be3
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/tree/d2fb1be3
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/diff/d2fb1be3

Branch: refs/heads/import-upstream
Commit: d2fb1be3df69ca9acd9b43b01638e42d803988f9
Parents: 680dba8
Author: Ómar Kjartan Yasin <omarkj@gmail.com>
Authored: Thu Jul 11 12:13:08 2013 -0700
Committer: Ómar Kjartan Yasin <omarkj@gmail.com>
Committed: Thu Jul 11 12:13:08 2013 -0700

----------------------------------------------------------------------
 src/mochiweb.erl | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-mochiweb/blob/d2fb1be3/src/mochiweb.erl
----------------------------------------------------------------------
diff --git a/src/mochiweb.erl b/src/mochiweb.erl
index f597c73..76e5953 100644
--- a/src/mochiweb.erl
+++ b/src/mochiweb.erl
@@ -56,6 +56,23 @@ new_request({Socket, {Method, '*'=Uri, Version}, Headers}) ->
                          Method,
                          Uri,
                          Version,
+                         mochiweb_headers:make(Headers));
+%% Request URI is a scheme
+%% Erlang decode_package will return this for requests like `CONNECT example:port`
+new_request({Socket, {Method, {scheme, Hostname, Port}, Version}, Headers}) ->
+    Uri = Hostname ++ ":" ++ Port,
+    mochiweb_request:new(Socket,
+                         Method,
+                         Uri,
+                         Version,
+                         mochiweb_headers:make(Headers));
+%% Request is an HTTP string
+%% Erlang decode_package will return this for requests like `GET example`
+new_request({Socket, {Method, HttpString, Version}, Headers}) when is_list(HttpString) ->
+    mochiweb_request:new(Socket,
+                         Method,
+                         HttpString,
+                         Version,
                          mochiweb_headers:make(Headers)).
 
 %% @spec new_response({Request, integer(), Headers}) -> MochiWebResponse


Mime
View raw message