From 1ef40339cc161484b3e70d34ab4d507b758b29eb Mon Sep 17 00:00:00 2001 From: Jeffrey Armstrong Date: Fri, 1 May 2020 20:45:13 -0400 Subject: Simple, single request function for retrieving a gemini page into a unit number --- request.f90 | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'request.f90') 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 -- cgit v1.2.3