From c7b18db974f4de4a6558aff474896effc679979f Mon Sep 17 00:00:00 2001 From: Jeffrey Armstrong Date: Thu, 7 Mar 2024 14:46:44 -0500 Subject: Queries to an instruction page now perform redirect to drop the query string --- captain/web.f90 | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/captain/web.f90 b/captain/web.f90 index b377751..eedb254 100644 --- a/captain/web.f90 +++ b/captain/web.f90 @@ -101,7 +101,8 @@ contains character(len=:), allocatable::url, script_name, cookie, server_name, fullurl character(len=4)::method integer::url_size, cookie_size, sn_size - + character(len=5)::server_port + call get_environment_variable("REQUEST_URI", length=url_size) allocate(character(len=url_size)::url) call get_environment_variable("REQUEST_URI", url) @@ -113,6 +114,8 @@ contains 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("SERVER_PORT", server_port) call get_environment_variable("REQUEST_METHOD", method) @@ -130,7 +133,7 @@ contains ! 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) + fullurl = "http://"//trim(server_name)//":"//trim(server_port)//trim(url) call write_log("FULL URL WOULD BE "//trim(fullurl), level=LOG_DEBUG) if(allocated(cookie)) then @@ -1088,6 +1091,10 @@ contains else if(trim(req%location) == "/logout.html") then template_to_use = "redirect.html" + + else if(index(req%location, "/instructions/") == 1 .and. associated(req%query_string)) then + + template_to_use = "redirect.html" else @@ -1156,12 +1163,14 @@ contains if(associated(req%query_string)) then call handle_instruction_command(req) + call page%assign('title', 'Command Received') + call page%assign('destination', req%location(2:)) + else + call page%assign('title', 'Build Instructions') + contents => generate_one_instuction_html(req) + call page%assign('contents', contents) end if - call page%assign('title', 'Build Instructions') - contents => generate_one_instuction_html(req) - call page%assign('contents', contents) - else if(trim(first) == "jobs") then call get_job_page_title(req, job_page_title) -- cgit v1.2.3