Merge remote-tracking branch 'jocelynEWF/master'
This commit is contained in:
Submodule ext/server/nino updated: 9fef2d71f0...58767bb1c1
@@ -59,17 +59,17 @@ feature -- Authentication
|
||||
Result := session.auth_type_id
|
||||
end
|
||||
|
||||
username: detachable READABLE_STRING_8
|
||||
username: detachable READABLE_STRING_32
|
||||
do
|
||||
Result := session.username
|
||||
end
|
||||
|
||||
password: detachable READABLE_STRING_8
|
||||
password: detachable READABLE_STRING_32
|
||||
do
|
||||
Result := session.password
|
||||
end
|
||||
|
||||
credentials: detachable READABLE_STRING_8
|
||||
credentials: detachable READABLE_STRING_32
|
||||
do
|
||||
Result := session.credentials
|
||||
end
|
||||
|
||||
@@ -8,7 +8,8 @@ class
|
||||
HTTP_CLIENT_REQUEST_CONTEXT
|
||||
|
||||
create
|
||||
make
|
||||
make,
|
||||
make_with_credentials_required
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
@@ -19,6 +20,12 @@ feature {NONE} -- Initialization
|
||||
create form_data_parameters.make (10)
|
||||
end
|
||||
|
||||
make_with_credentials_required
|
||||
do
|
||||
make
|
||||
set_credentials_required (True)
|
||||
end
|
||||
|
||||
feature -- Settings
|
||||
|
||||
credentials_required: BOOLEAN
|
||||
@@ -40,6 +47,16 @@ feature -- Status report
|
||||
|
||||
feature -- Element change
|
||||
|
||||
add_query_parameter (k: READABLE_STRING_8; v: READABLE_STRING_32)
|
||||
do
|
||||
query_parameters.force (v, k)
|
||||
end
|
||||
|
||||
add_form_data_parameter (k: READABLE_STRING_8; v: READABLE_STRING_32)
|
||||
do
|
||||
form_data_parameters.force (v, k)
|
||||
end
|
||||
|
||||
set_credentials_required (b: BOOLEAN)
|
||||
do
|
||||
credentials_required := b
|
||||
|
||||
@@ -92,12 +92,17 @@ feature -- Authentication
|
||||
-- See {HTTP_CLIENT_CONSTANTS}.Auth_type_*
|
||||
|
||||
username,
|
||||
password: detachable READABLE_STRING_8
|
||||
password: detachable READABLE_STRING_32
|
||||
|
||||
credentials: detachable READABLE_STRING_8
|
||||
credentials: detachable READABLE_STRING_32
|
||||
|
||||
feature -- Change
|
||||
|
||||
set_base_url (u: like base_url)
|
||||
do
|
||||
base_url := u
|
||||
end
|
||||
|
||||
set_timeout (n: like timeout)
|
||||
do
|
||||
timeout := n
|
||||
@@ -113,6 +118,11 @@ feature -- Change
|
||||
headers.force (v, k)
|
||||
end
|
||||
|
||||
remove_header (k: READABLE_STRING_8)
|
||||
do
|
||||
headers.prune (k)
|
||||
end
|
||||
|
||||
set_credentials (u: like username; p: like password)
|
||||
do
|
||||
username := u
|
||||
|
||||
@@ -20,9 +20,11 @@ create
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make_with_base (a_app: like application; a_base: like base)
|
||||
require
|
||||
a_base_starts_with_slash: (a_base /= Void and then not a_base.is_empty) implies a_base.starts_with ("/")
|
||||
do
|
||||
make (a_app)
|
||||
base := a_base
|
||||
set_base (a_base)
|
||||
end
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
@@ -52,8 +54,12 @@ feature -- Access
|
||||
feature -- Element change
|
||||
|
||||
set_base (b: like base)
|
||||
require
|
||||
b_starts_with_slash: (b /= Void and then not b.is_empty) implies b.starts_with ("/")
|
||||
do
|
||||
base := b
|
||||
ensure
|
||||
valid_base: (attached base as l_base and then not l_base.is_empty) implies l_base.starts_with ("/")
|
||||
end
|
||||
|
||||
feature -- Server
|
||||
|
||||
@@ -64,8 +64,16 @@ feature -- Request processing
|
||||
until
|
||||
a_headers_map.after
|
||||
loop
|
||||
vn := "HTTP_" + a_headers_map.key_for_iteration.as_upper
|
||||
create vn.make_from_string (a_headers_map.key_for_iteration.as_upper)
|
||||
vn.replace_substring_all ("-", "_")
|
||||
if
|
||||
vn.starts_with ("CONTENT_") and then
|
||||
(vn.same_string_general ({WGI_META_NAMES}.content_type) or vn.same_string_general ({WGI_META_NAMES}.content_length))
|
||||
then
|
||||
--| Keep this name
|
||||
else
|
||||
vn.prepend ("HTTP_")
|
||||
end
|
||||
add_environment_variable (a_headers_map.item_for_iteration, vn, env)
|
||||
a_headers_map.forth
|
||||
end
|
||||
@@ -90,6 +98,8 @@ feature -- Request processing
|
||||
l_server_name := l_host
|
||||
l_server_port := "80" -- Default
|
||||
end
|
||||
else
|
||||
check host_available: False end
|
||||
end
|
||||
|
||||
if attached a_headers_map.item ("Authorization") as l_authorization then
|
||||
|
||||
@@ -20,6 +20,8 @@ feature {NONE} -- Implementation
|
||||
|
||||
make_custom (a_callback: like {WGI_AGENT_APPLICATION}.callback; a_base_url: detachable STRING)
|
||||
-- Initialize `Current'.
|
||||
require
|
||||
base_url_starts_with_slash: (a_base_url /= Void and then not a_base_url.is_empty) implies a_base_url.starts_with ("/")
|
||||
local
|
||||
app: WGI_AGENT_APPLICATION
|
||||
do
|
||||
|
||||
Reference in New Issue
Block a user