Code cleaning, and nicer output under debug clause
This commit is contained in:
@@ -96,22 +96,6 @@ feature -- Access
|
|||||||
|
|
||||||
feature -- Parsing
|
feature -- Parsing
|
||||||
|
|
||||||
parse_http_request_line (line: STRING)
|
|
||||||
require
|
|
||||||
line /= Void
|
|
||||||
local
|
|
||||||
pos, next_pos: INTEGER
|
|
||||||
do
|
|
||||||
print ("%N parse http request line:%N" + line)
|
|
||||||
-- parse (this should be done by a lexer)
|
|
||||||
pos := line.index_of (' ', 1)
|
|
||||||
method := line.substring (1, pos - 1)
|
|
||||||
next_pos := line.index_of (' ', pos+1)
|
|
||||||
uri := line.substring (pos+1, next_pos-1)
|
|
||||||
ensure
|
|
||||||
not_void_method: method /= Void
|
|
||||||
end
|
|
||||||
|
|
||||||
analyze_request_message (a_input: HTTP_INPUT_STREAM)
|
analyze_request_message (a_input: HTTP_INPUT_STREAM)
|
||||||
require
|
require
|
||||||
input_readable: a_input /= Void and then a_input.is_readable
|
input_readable: a_input /= Void and then a_input.is_readable
|
||||||
@@ -137,7 +121,9 @@ feature -- Parsing
|
|||||||
loop
|
loop
|
||||||
line := a_input.last_string
|
line := a_input.last_string
|
||||||
n := line.count
|
n := line.count
|
||||||
print ("%N" + line + "%N")
|
debug ("nino")
|
||||||
|
print ("%N" + line)
|
||||||
|
end
|
||||||
pos := line.index_of (':',1)
|
pos := line.index_of (':',1)
|
||||||
if pos > 0 then
|
if pos > 0 then
|
||||||
k := line.substring (1, pos-1)
|
k := line.substring (1, pos-1)
|
||||||
@@ -166,7 +152,11 @@ feature -- Parsing
|
|||||||
local
|
local
|
||||||
pos, next_pos: INTEGER
|
pos, next_pos: INTEGER
|
||||||
do
|
do
|
||||||
print ("%N parse request line:%N" + line)
|
debug ("nino")
|
||||||
|
print ("%N## Parse HTTP request line ##")
|
||||||
|
print ("%N")
|
||||||
|
print (line)
|
||||||
|
end
|
||||||
pos := line.index_of (' ', 1)
|
pos := line.index_of (' ', 1)
|
||||||
method := line.substring (1, pos - 1)
|
method := line.substring (1, pos - 1)
|
||||||
next_pos := line.index_of (' ', pos + 1)
|
next_pos := line.index_of (' ', pos + 1)
|
||||||
@@ -176,6 +166,7 @@ feature -- Parsing
|
|||||||
not_void_method: method /= Void
|
not_void_method: method /= Void
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
invariant
|
invariant
|
||||||
request_header_attached: request_header /= Void
|
request_header_attached: request_header /= Void
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user