Removed implicit conversion from HTTP_CONTENT_TYPE to STRING_8

because it could be a source of bug due to hidden conversion (and parameters)
Applied changes to autotest cases
Cosmetic
This commit is contained in:
Jocelyn Fiat
2012-05-02 11:35:53 +02:00
parent 7c95e514ad
commit 18ced46c99
7 changed files with 46 additions and 10 deletions

View File

@@ -16,8 +16,7 @@ create
make_from_string
convert
make_from_string ({READABLE_STRING_8, STRING_8, IMMUTABLE_STRING_8}),
string: {READABLE_STRING_8}
make_from_string ({READABLE_STRING_8, STRING_8, IMMUTABLE_STRING_8})
feature -- Access

View File

@@ -41,8 +41,7 @@ create
make_from_string
convert
make_from_string ({READABLE_STRING_8, STRING_8, IMMUTABLE_STRING_8}),
string: {READABLE_STRING_8}
make_from_string ({READABLE_STRING_8, STRING_8, IMMUTABLE_STRING_8})
feature {NONE} -- Initialization
@@ -227,7 +226,7 @@ feature -- Status report
end
same_simple_type (s: READABLE_STRING_8): BOOLEAN
-- Current has same type/subtype string representation as `s'?
-- Current has same type/subtype string representation as `s'?
do
Result := simple_type.same_string (s)
end

View File

@@ -87,7 +87,6 @@ feature {NONE} -- Implementation
if p > 0 then
q := r.index_of ({CHARACTER_32} ']', p + 1)
if q > p then
-- k32 := url_encoder.decoded_string (k)
if attached {WSF_TABLE} ptb.value (k) as l_tb_value then
tb := l_tb_value
else

View File

@@ -80,7 +80,7 @@ feature {NONE} -- Initialization
-- Content-Type
s8 := wgi_request.content_type
if s8 /= Void then
content_type := s8
create content_type.make_from_string (s8)
else
content_type := Void
end
@@ -1111,7 +1111,7 @@ feature -- Form fields and related
feature -- Access: MIME handler
has_mime_handler (a_content_type: READABLE_STRING_8): BOOLEAN
has_mime_handler (a_content_type: HTTP_CONTENT_TYPE): BOOLEAN
-- Has a MIME handler registered for `a_content_type'?
do
if attached mime_handlers as hdls then

View File

@@ -19,6 +19,7 @@ feature {NONE} -- Initialization
-- Initialize `Current'.
do
set_service_option ("port", 9091)
set_service_option ("verbose", True)
make_and_launch
end

View File

@@ -36,6 +36,7 @@ feature {NONE} -- Events
wt: WORKER_THREAD
e: EXECUTION_ENVIRONMENT
do
-- port_number := 9091
port_number := 0
base_url := "test/"
create app.make_custom (to_wgi_service, base_url)
@@ -50,11 +51,41 @@ feature {NONE} -- Events
port_number := app.port
end
server_log_name: STRING
local
fn: FILE_NAME
once
create fn.make_from_string ("..")
fn.extend ("..")
fn.extend ("..")
fn.extend ("..")
fn.extend ("..")
fn.extend ("server_test.log")
Result := fn.string
end
server_log (m: STRING_8)
local
f: RAW_FILE
do
create f.make_open_append (server_log_name)--"..\server-tests.log")
f.put_string (m)
f.put_character ('%N')
f.close
end
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
local
q: detachable STRING_32
page: WSF_PAGE_RESPONSE
do
debug
server_log (req.request_uri)
if attached req.content_type as l_content_type then
server_log ("content_type:" + l_content_type.string)
end
end
create page.make
if attached req.request_uri as l_uri then
if l_uri.starts_with (test_url ("get/01")) then
@@ -93,17 +124,24 @@ feature {NONE} -- Events
end
create q.make_empty
-- req.set_raw_input_data_recorded (True)
across
req.form_parameters as fcur
loop
debug
server_log ("%Tform: " + fcur.item.name)
end
if not q.is_empty then
q.append_character ('&')
end
q.append (fcur.item.name.as_string_32 + "=" + fcur.item.as_string)
end
-- if attached req.raw_input_data as d then
-- server_log ("Raw data=" + d)
-- end
if not q.is_empty then
page.put_string (" : " + q )
end
@@ -154,6 +192,7 @@ feature {NONE} -- Events
http_session := sess
sess.set_timeout (-1)
sess.set_connect_timeout (-1)
-- sess.set_proxy ("127.0.0.1", 8888) --| inspect traffic with http://www.fiddler2.com/
end
end

View File

@@ -24,7 +24,6 @@ feature {NONE} -- Helpers
do
Result := Precursor (ctx)
Result.headers.extend ("chunked", "Transfer-Encoding")
-- Result.set_proxy ("127.0.0.1", 8888) --| inspect traffic with http://www.fiddler2.com/
end
feature -- Test routines