couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject [10/50] mochiweb commit: updated refs/heads/1843-feature-bigcouch to 432c949
Date Thu, 17 Apr 2014 18:16:38 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/1843-feature-bigcouch
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