From 0fda0dc34c703fe7ecb41ef8b30a33a52e97f1da Mon Sep 17 00:00:00 2001 From: Jocelyn Fiat Date: Mon, 30 May 2011 22:26:35 +0200 Subject: [PATCH] left adjust request_header_map items. --- src/http_connection_handler.e | 20 ++++++++++++++------ src/http_server.e | 2 +- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/http_connection_handler.e b/src/http_connection_handler.e index 48872289..f287232c 100644 --- a/src/http_connection_handler.e +++ b/src/http_connection_handler.e @@ -51,6 +51,7 @@ feature -- Execution l_remote_info.addr := l_addr.host_address.host_address l_remote_info.hostname := l_addr.host_address.host_name l_remote_info.port := l_addr.port + remote_info := l_remote_info end analyze_request_message (l_input) @@ -117,9 +118,9 @@ feature -- Parsing input_readable: a_input /= Void and then a_input.is_readable local end_of_stream : BOOLEAN - pos : INTEGER + pos,n : INTEGER line : STRING - val: STRING + k, val: STRING txt: STRING do create txt.make (64) @@ -136,13 +137,20 @@ feature -- Parsing end_of_stream loop line := a_input.last_string + n := line.count print ("%N" +line+ "%N") pos := line.index_of (':',1) - val := line.substring (pos + 1, line.count) - if val[val.count] = '%R' then - val.remove_tail (1) + if pos > 0 then + k := line.substring(1, pos-1) + if line[pos+1].is_space then + pos := pos + 1 + end + if line[n] = '%R' then + n := n - 1 + end + val := line.substring (pos + 1, n) + request_header_map.put (val, k) end - request_header_map.put (val, line.substring (1,pos-1)) txt.append (line) txt.append_character ('%N') if line.is_empty or else line[1] = '%R' then diff --git a/src/http_server.e b/src/http_server.e index 0bfe0186..f171417c 100644 --- a/src/http_server.e +++ b/src/http_server.e @@ -18,6 +18,7 @@ feature -- Initialization make (cfg: like configuration) do configuration := cfg + set_server_configuration (configuration) end setup (a_http_handler : HTTP_HANDLER) @@ -27,7 +28,6 @@ feature -- Initialization print("%N%N%N") print ("Starting Web Application Server (port="+ configuration.http_server_port.out +"):%N") stop_requested := False - set_server_configuration (configuration) if configuration.force_single_threaded then a_http_handler.execute else