diff options
Diffstat (limited to 'captain/web.f90')
-rw-r--r-- | captain/web.f90 | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/captain/web.f90 b/captain/web.f90 index f808eae..1421f96 100644 --- a/captain/web.f90 +++ b/captain/web.f90 @@ -98,15 +98,22 @@ contains implicit none type(http_request), intent(out)::req - character(len=:), allocatable::url, script_name, cookie + character(len=:), allocatable::url, script_name, cookie, server_name, fullurl character(len=4)::method - integer::url_size, cookie_size + integer::url_size, cookie_size, sn_size call get_environment_variable("REQUEST_URI", length=url_size) - allocate(character(len=url_size)::url, script_name) + allocate(character(len=url_size)::url) call get_environment_variable("REQUEST_URI", url) + + call get_environment_variable("SCRIPT_NAME", length=sn_size) + allocate(character(len=sn_size)::script_name) call get_environment_variable("SCRIPT_NAME", script_name) + call get_environment_variable("SERVER_NAME", length=sn_size) + allocate(character(len=sn_size)::server_name) + call get_environment_variable("SERVER_NAME", server_name) + call get_environment_variable("REQUEST_METHOD", method) call get_environment_variable("HTTP_COOKIE", length=cookie_size) @@ -117,6 +124,15 @@ contains end if ! If we're in CGI mode, treat the "server" as the script name + call write_log("URL IS "//trim(url), level=LOG_DEBUG) + call write_log("SE IS "//trim(script_name), level=LOG_DEBUG) + + ! We don't actually use this fabircated URL, but it is helpful for debugging + ! whatever the hell is going on when the request object is built... + allocate(character(len=(len_trim(server_name) + len_trim(url) + 7)) :: fullurl) + fullurl = "http://"//trim(server_name)//trim(url) + call write_log("FULL URL WOULD BE "//trim(fullurl), level=LOG_DEBUG) + if(allocated(cookie)) then call req%init(url, server_explicit=script_name, protocol_explicit="http", method=method, cookiestring=cookie) deallocate(cookie) @@ -126,6 +142,7 @@ contains deallocate(url) deallocate(script_name) + deallocate(server_name) end subroutine build_request_object |