aboutsummaryrefslogtreecommitdiff
path: root/captain/api.f90
diff options
context:
space:
mode:
authorJeffrey Armstrong <jeff@approximatrix.com>2021-06-29 16:06:44 -0400
committerJeffrey Armstrong <jeff@approximatrix.com>2021-06-29 16:06:44 -0400
commitcd4a5891b8e2a019fdfda7512d6490e075628292 (patch)
tree8012dc7dc52f17632f5b429dea79709e55ab96c4 /captain/api.f90
parentd282a7e283a1704cdde2649c7caf130fb923051a (diff)
downloadlevitating-cd4a5891b8e2a019fdfda7512d6490e075628292.tar.gz
levitating-cd4a5891b8e2a019fdfda7512d6490e075628292.zip
Tokens are now checked for file uploads. Fixed major buffer bugs in status reporting.
Diffstat (limited to 'captain/api.f90')
-rw-r--r--captain/api.f9026
1 files changed, 16 insertions, 10 deletions
diff --git a/captain/api.f90 b/captain/api.f90
index 4d9545e..7b99ec7 100644
--- a/captain/api.f90
+++ b/captain/api.f90
@@ -182,6 +182,7 @@ contains
use server_response
use special_filenames
use logging
+ use security, only: validate_token => validate_titan_token
implicit none
type(titan_request), intent(in)::req
@@ -200,20 +201,25 @@ contains
! Task - "/api/player/{name}/job/{jobid}/task/{task num}"
if(trim(req%component(2)) == "player" .and. &
trim(req%component(4)) == "job" .and. &
- trim(req%component(6)) == "task") then
+ trim(req%component(6)) == "task") &
+ then
- job_id = req%path_component_int(5)
+ if(validate_token(req%token, req%component(3))) then
+
+ job_id = req%path_component_int(5)
- task_num = req%path_component_int(7)
+ task_num = req%path_component_int(7)
- write(job_text, '(I6)') job_id
- write(task_text, '(I6)') task_num
-
- call write_log("Handling a task update for job "//trim(job_text)//" task "//trim(task_text), LOG_INFO)
- call handle_task_request(req)
+ write(job_text, '(I6)') job_id
+ write(task_text, '(I6)') task_num
+
+ call write_log("Handling a task update for job "//trim(job_text)//" task "//trim(task_text), LOG_INFO)
+ call handle_task_request(req)
+
+ fullpath => get_task_result_static_filename(job_id, task_num)
+
+ end if
- fullpath => get_task_result_static_filename(job_id, task_num)
-
end if
if(associated(fullpath)) then