Permalink
Browse files

update server

  • Loading branch information...
1 parent 62766fc commit f6fc12b00324661fd3b6bbe76aba187098be9176 @trung committed Sep 25, 2009
Showing with 32 additions and 2 deletions.
  1. +32 −2 temp/server/server.erl
View
@@ -1,5 +1,21 @@
-module(server).
--export([start/0, stop/0, do/1]).
+-export([start/0, stop/0, restart/0, do/1]).
+
+-record(init_data,{peername,resolve}).
+-record(mod,{init_data,
+ data=[],
+ socket_type=ip_comm,
+ socket,
+ config_db,
+ method,
+ absolute_uri=[],
+ request_uri,
+ http_version,
+ request_line,
+ parsed_header=[],
+ entity_body,
+ connection}).
+
start() ->
inets:start(),
@@ -14,7 +30,7 @@ start() ->
{modules, [?MODULE]}]).
do(Info) ->
- io:fwrite("Received: ~p~n", [Info]),
+ parse(Info),
{proceed,
[{response,
{200,
@@ -23,3 +39,17 @@ do(Info) ->
stop() ->
inets:stop().
+
+restart() ->
+ stop(),
+ start().
+
+%% Parsing html request
+parse(Info) ->
+ %% Byte array
+ _Data = Info#mod.entity_body,
+ io:fwrite("Received: ~p~n", [Info]),
+ %% Print byte array in hex
+ ok.
+
+

0 comments on commit f6fc12b

Please sign in to comment.