Compare commits
10 Commits
7f77f9e3b1
..
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 180ebfb299 | |||
| b0b5882936 | |||
| cee4d0bf56 | |||
| 23261552e1 | |||
| 141e637630 | |||
| faf14bac3f | |||
| 0def0846bf | |||
| f2e41fcfec | |||
| 62b95f13fe | |||
| 5002127580 |
+1
-1
@@ -3,5 +3,5 @@
|
||||
{registered,[]},
|
||||
{included_applications,[]},
|
||||
{applications,[stdlib,kernel]},
|
||||
{vsn,"0.2.0"},
|
||||
{vsn,"0.2.1"},
|
||||
{modules,[qhl]}]}.
|
||||
|
||||
+3
-3
@@ -4,9 +4,9 @@
|
||||
qargs = undefined :: undefined | #{Key :: binary() := Value :: binary()},
|
||||
fragment = undefined :: undefined | none | binary(),
|
||||
version = undefined :: undefined | http10 | http11 | http20,
|
||||
headers = undefined :: undefined | [{Key :: binary(), Value :: binary()}],
|
||||
headers = undefined :: undefined | #{Key :: binary() := Value :: binary()},
|
||||
cookies = undefined :: undefined | #{Key :: binary() := Value :: binary()},
|
||||
enctype = undefined :: undefined | none | urlencoded | multipart(),
|
||||
enctype = undefined :: undefined | none | urlencoded | json | multipart(),
|
||||
size = undefined :: undefined | none | non_neg_integer(),
|
||||
body = undefined :: undefined | none | body()}).
|
||||
|
||||
@@ -20,6 +20,6 @@
|
||||
|
||||
-type method() :: get | post | options.
|
||||
-type multipart() :: {multipart, Boundary :: binary()}.
|
||||
-type body() :: {partial, binary()} | {multipart, [body_part()]} | binary().
|
||||
-type body() :: {partial, binary()} | {multipart, [body_part()]} | binary() | zj:value().
|
||||
-type body_part() :: {Field :: binary(), Data :: binary()}
|
||||
| {Field :: binary(), Name :: binary(), Data :: binary()}.
|
||||
|
||||
+9
-4
@@ -8,7 +8,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(qhl).
|
||||
-vsn("0.2.0").
|
||||
-vsn("0.2.1").
|
||||
-author("Craig Everett <ceverett@tsuriai.jp>").
|
||||
-copyright("Craig Everett <ceverett@tsuriai.jp>").
|
||||
-license("MIT").
|
||||
@@ -27,7 +27,8 @@
|
||||
-spec parse(Socket, Received) -> Result
|
||||
when Socket :: gen_tcp:socket(),
|
||||
Received :: binary(),
|
||||
Result :: {ok, #request{}} | {error, Reason},
|
||||
Result :: {ok, #request{}, Next} | {error, Reason},
|
||||
Next :: none | binary(),
|
||||
Reason :: term(). % FIXME
|
||||
%% @doc
|
||||
%% @equiv parse(Socket, Received, #request{})
|
||||
@@ -40,13 +41,17 @@ parse(Socket, Received) ->
|
||||
when Socket :: gen_tcp:socket(),
|
||||
Received :: binary(),
|
||||
Request :: #request{},
|
||||
Result :: {ok, #request{}} | {error, Reason},
|
||||
Result :: {ok, #request{}, Next} | {error, Reason},
|
||||
Next :: none | binary(),
|
||||
Reason :: term(). % FIXME
|
||||
%5 @doc
|
||||
%% @doc
|
||||
%% Pass this function the connection socket and whatever the receive loop has acquired,
|
||||
%% and receive back a parsed #request{} record. This requires that you have imported
|
||||
%% the `http.hrl' and set `{mode, binary}' and `{active, once}' options on the
|
||||
%% socket.
|
||||
%%
|
||||
%% `Next' is any additional binary data found on the socket after a valid
|
||||
%% request is parsed (presumably the beginning of a sequential request).
|
||||
|
||||
parse(Socket, Received, M = #request{method = undefined}) ->
|
||||
case read_method(Socket, Received) of
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
{type,lib}.
|
||||
{modules,[]}.
|
||||
{prefix,none}.
|
||||
{author,"Craig Everett"}.
|
||||
{desc,"The Quick HTTP Library"}.
|
||||
{package_id,{"otpr","qhl",{0,2,0}}}.
|
||||
{deps,[]}.
|
||||
{author,"Craig Everett"}.
|
||||
{package_id,{"otpr","qhl",{0,2,1}}}.
|
||||
{deps,[{"otpr","zj",{1,1,2}}]}.
|
||||
{key_name,none}.
|
||||
{a_email,"zxq9@zxq9.com"}.
|
||||
{c_email,"zxq9@zxq9.com"}.
|
||||
|
||||
Reference in New Issue
Block a user