diff options
author | Jeffrey Armstrong <jeff@approximatrix.com> | 2020-05-01 20:45:13 -0400 |
---|---|---|
committer | Jeffrey Armstrong <jeff@approximatrix.com> | 2020-05-01 20:45:13 -0400 |
commit | 1ef40339cc161484b3e70d34ab4d507b758b29eb (patch) | |
tree | f1530f7dc01842ffe1dab393ec8fc374dc42b5e5 /request.f90 | |
parent | 4108ae479d67067789f98267175e127e6a2a61ad (diff) | |
download | LR-87-1ef40339cc161484b3e70d34ab4d507b758b29eb.tar.gz LR-87-1ef40339cc161484b3e70d34ab4d507b758b29eb.zip |
Simple, single request function for retrieving a gemini page into a unit number
Diffstat (limited to 'request.f90')
-rw-r--r-- | request.f90 | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/request.f90 b/request.f90 index 3cc8cbf..67cc4f7 100644 --- a/request.f90 +++ b/request.f90 @@ -13,6 +13,16 @@ implicit none integer, parameter::CONNECTION_SSL_CONN_FAILURE = 5 integer, parameter::CONNECTION_OPEN = 6 + character(23), dimension(0:6), parameter:: connection_code_str = & + ["No Connection ", & + "Connection Closed ", & + "Server Not Found ", & + "Local Socket Failure ", & + "SSL Configuration Error", & + "SSL Connection Failure ", & + "SSL Connection Open " ] + + type :: connection integer::code @@ -26,6 +36,25 @@ implicit none contains + function translate_connection_code(code) + implicit none + + integer, intent(in)::code + character(23)::translate_connection_code + + if(code >= lbound(connection_code_str, 1) .and. & + code <= ubound(connection_code_str, 1)) then + + translate_connection_code = connection_code_str(code) + + else + + translate_connection_code = "Unknown Error" + + end if + + end function translate_connection_code + function open_connection(server, port) result(conn) use jessl use network |