diff --git a/calexium_lib/web/CXM_multihost_http_server.anubis b/calexium_lib/web/CXM_multihost_http_server.anubis index e336241..bee3095 100644 --- a/calexium_lib/web/CXM_multihost_http_server.anubis +++ b/calexium_lib/web/CXM_multihost_http_server.anubis @@ -489,7 +489,8 @@ public define One --- That's all for the public part ! -------------------------------------------------- - + +define Maybe(String) get_host_header_value(List(HTTP_header) headers). define String utime_to_string @@ -2798,24 +2799,31 @@ define String Finding the 'Host' header. No redirection is performed if this header is not found. define String - handle_redirection // returns the redirected URI - ( - Redirections redirections, - String uri, // original URI - List(HTTP_header) headers - ) = + handle_redirection // returns the redirected URI + ( + Redirections redirections, + String uri, // original URI + List(HTTP_header) headers + )= + if get_host_header_value(headers) is + { + failure then uri, + success(host) then + if redirections is + { + redirection_list(l) then handle_redirection(uri, host, l) + redirection_fn(f) then f(uri, host) + } + }. + if headers is { [ ] then uri, [h . t] then if h is http_header(name,value) then - if redirections is - { - redirection_list(l) then - if name = "host" - then handle_redirection(uri, strip_port(value,0), l) - else handle_redirection(redirections,uri,t) - redirection_fn(f) then f(uri, strip_port(value,0)) - } + if name = "host" then + + else + handle_redirection(redirections,uri,t) }. -- libgit2 0.21.4