left adjust request_header_map items.

This commit is contained in:
Jocelyn Fiat
2011-05-30 22:26:35 +02:00
parent f22f42c463
commit 0fda0dc34c
2 changed files with 15 additions and 7 deletions

View File

@@ -51,6 +51,7 @@ feature -- Execution
l_remote_info.addr := l_addr.host_address.host_address l_remote_info.addr := l_addr.host_address.host_address
l_remote_info.hostname := l_addr.host_address.host_name l_remote_info.hostname := l_addr.host_address.host_name
l_remote_info.port := l_addr.port l_remote_info.port := l_addr.port
remote_info := l_remote_info
end end
analyze_request_message (l_input) analyze_request_message (l_input)
@@ -117,9 +118,9 @@ feature -- Parsing
input_readable: a_input /= Void and then a_input.is_readable input_readable: a_input /= Void and then a_input.is_readable
local local
end_of_stream : BOOLEAN end_of_stream : BOOLEAN
pos : INTEGER pos,n : INTEGER
line : STRING line : STRING
val: STRING k, val: STRING
txt: STRING txt: STRING
do do
create txt.make (64) create txt.make (64)
@@ -136,13 +137,20 @@ feature -- Parsing
end_of_stream end_of_stream
loop loop
line := a_input.last_string line := a_input.last_string
n := line.count
print ("%N" +line+ "%N") print ("%N" +line+ "%N")
pos := line.index_of (':',1) pos := line.index_of (':',1)
val := line.substring (pos + 1, line.count) if pos > 0 then
if val[val.count] = '%R' then k := line.substring(1, pos-1)
val.remove_tail (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 end
request_header_map.put (val, line.substring (1,pos-1))
txt.append (line) txt.append (line)
txt.append_character ('%N') txt.append_character ('%N')
if line.is_empty or else line[1] = '%R' then if line.is_empty or else line[1] = '%R' then

View File

@@ -18,6 +18,7 @@ feature -- Initialization
make (cfg: like configuration) make (cfg: like configuration)
do do
configuration := cfg configuration := cfg
set_server_configuration (configuration)
end end
setup (a_http_handler : HTTP_HANDLER) setup (a_http_handler : HTTP_HANDLER)
@@ -27,7 +28,6 @@ feature -- Initialization
print("%N%N%N") print("%N%N%N")
print ("Starting Web Application Server (port="+ configuration.http_server_port.out +"):%N") print ("Starting Web Application Server (port="+ configuration.http_server_port.out +"):%N")
stop_requested := False stop_requested := False
set_server_configuration (configuration)
if configuration.force_single_threaded then if configuration.force_single_threaded then
a_http_handler.execute a_http_handler.execute
else else