aboutsummaryrefslogtreecommitdiff
path: root/captain/gemini.f90
diff options
context:
space:
mode:
authorJeffrey Armstrong <jeff@approximatrix.com>2021-04-01 20:41:13 -0400
committerJeffrey Armstrong <jeff@approximatrix.com>2021-04-01 20:41:13 -0400
commitda47fdfddc46e35a939b7771eda21debec50c094 (patch)
tree0eb9ac1333dd3b17e25eca6c4c96f732da357b89 /captain/gemini.f90
parent3e58313bde5e3e572d84fe014d9902dfb04712c3 (diff)
downloadlevitating-da47fdfddc46e35a939b7771eda21debec50c094.tar.gz
levitating-da47fdfddc46e35a939b7771eda21debec50c094.zip
Started work on API implementation
Diffstat (limited to 'captain/gemini.f90')
-rw-r--r--captain/gemini.f9015
1 files changed, 8 insertions, 7 deletions
diff --git a/captain/gemini.f90 b/captain/gemini.f90
index 46725cb..8822ed5 100644
--- a/captain/gemini.f90
+++ b/captain/gemini.f90
@@ -178,6 +178,7 @@ contains
use config
use iso_fortran_env
use external_handling, only: external_request_gemini
+ use api_handling, only: api_request
use logging, only: write_log
use server_response
implicit none
@@ -193,6 +194,8 @@ contains
! Requested file
character(1024)::text_request
+
+ character(32)::first
integer::rendered_unit, ioerror
@@ -258,13 +261,11 @@ contains
call req%init(text_request)
call write_log("Request object created")
- if(len(req%location) .ge. 4) then
- if(req%location(1:4) == '/api') then
- !call handle_api_request(request)
- else
- resp = external_request_gemini(req)
- end if
- else
+
+ call req%path_component(1, first)
+ if(trim(first) == 'api') then
+ resp = api_request(request)
+ else
resp = external_request_gemini(req)
end if