Merge changes from Javier
- update on RESTbuck examples - new example - fixed bad typo in WSF_REQUEST Reverted some changes such as - http_client_response: keep the headers as a list to handle multiple message-value with same message-name Fixed simple and simple_file example Improved HTTP_HEADER Changed libcurl implementation for http client - now the header from the context really overwrite any of the session headers - better design which is more strict, and remove any doubt about context's header usage
This commit is contained in:
@@ -11,7 +11,11 @@ inherit
|
||||
WSF_RESPONSE_MESSAGE
|
||||
|
||||
create
|
||||
make
|
||||
make,
|
||||
make_with_body
|
||||
|
||||
convert
|
||||
make_with_body ({READABLE_STRING_8, STRING_8, IMMUTABLE_STRING_8})
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
@@ -21,6 +25,12 @@ feature {NONE} -- Initialization
|
||||
create header.make
|
||||
end
|
||||
|
||||
make_with_body (a_body: READABLE_STRING_8)
|
||||
do
|
||||
make
|
||||
body := a_body
|
||||
end
|
||||
|
||||
feature -- Status
|
||||
|
||||
status_code: INTEGER
|
||||
@@ -34,10 +44,24 @@ feature -- Header
|
||||
feature -- Output
|
||||
|
||||
send_to (res: WSF_RESPONSE)
|
||||
local
|
||||
b: like body
|
||||
h: like header
|
||||
do
|
||||
h := header
|
||||
b := body
|
||||
res.set_status_code (status_code)
|
||||
res.write_header_text (header.string)
|
||||
if attached body as b then
|
||||
|
||||
if b /= Void then
|
||||
if not h.has_content_length then
|
||||
h.put_content_length (b.count)
|
||||
end
|
||||
if not h.has_content_type then
|
||||
h.put_content_type_text_plain
|
||||
end
|
||||
end
|
||||
res.write_header_text (h.string)
|
||||
if b /= Void then
|
||||
res.write_string (b)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -26,19 +26,22 @@ convert
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make_from_wgi (r: WGI_REQUEST)
|
||||
local
|
||||
tb: like meta_variables_table
|
||||
do
|
||||
wgi_request := r
|
||||
if attached r.meta_variables as l_vars then
|
||||
create meta_variables_table.make (l_vars.count)
|
||||
create tb.make (l_vars.count)
|
||||
across
|
||||
l_vars as c
|
||||
loop
|
||||
meta_variables_table.force (new_string_value (c.key, c.item), c.item)
|
||||
tb.force (new_string_value (c.key, c.item), c.key)
|
||||
end
|
||||
else
|
||||
create meta_variables_table.make (0)
|
||||
create tb.make (0)
|
||||
end
|
||||
meta_variables := meta_variables_table
|
||||
meta_variables_table := tb
|
||||
meta_variables := tb
|
||||
create error_handler.make
|
||||
create uploaded_files.make (0)
|
||||
raw_post_data_recorded := True
|
||||
|
||||
Reference in New Issue
Block a user