diff options
author | Jeffrey Armstrong <jeff@approximatrix.com> | 2022-06-28 16:25:12 -0400 |
---|---|---|
committer | Jeffrey Armstrong <jeff@approximatrix.com> | 2022-06-28 16:25:12 -0400 |
commit | 1023ceb58f48c7a01a8d04688a48918ac485d20a (patch) | |
tree | 80da33c29df79272a861eafce46b7280fd5fc06a /captain/gemini.f90 | |
parent | 6e59e791b7b4d1184e70378544b6ace433ab33aa (diff) | |
download | levitating-1023ceb58f48c7a01a8d04688a48918ac485d20a.tar.gz levitating-1023ceb58f48c7a01a8d04688a48918ac485d20a.zip |
Refactoring requests to be protocol-specific
Diffstat (limited to 'captain/gemini.f90')
-rw-r--r-- | captain/gemini.f90 | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/captain/gemini.f90 b/captain/gemini.f90 index 7e849d6..b14078d 100644 --- a/captain/gemini.f90 +++ b/captain/gemini.f90 @@ -227,8 +227,10 @@ contains type(c_ptr)::ssl integer(kind=c_long)::res - type(request)::req - type(titan_request)::treq + class(request), pointer::req + + type(gemini_request), target::greq + type(titan_request), target::treq type(response)::resp ! Requested file @@ -297,7 +299,14 @@ contains call read_request(ssl, text_request) call write_log("Initializing object", LOG_DEBUG) - call req%init(text_request) + + if(get_protocol(text_request) == "gemini") then + call greq%init(text_request) + req => greq + else + call treq%init(text_request, ssl) + req => treq + end if call write_log("Request object created", LOG_DEBUG) @@ -309,7 +318,6 @@ contains resp = api_request_gemini(req) call write_log("resp filename is: '"//trim(resp%body_filename)//"'", LOG_DEBUG) else if(req%protocol == "titan") then - call treq%init_from_request(req, ssl) resp = api_request_titan(treq) end if @@ -328,9 +336,8 @@ contains if(req%protocol == "gemini") then - resp = external_request_gemini(req) + resp = external_request_gemini(greq) else if(req%protocol == "titan") then - call treq%init_from_request(req, ssl) resp = external_request_titan(treq) end if |