aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffrey Armstrong <jeff@approximatrix.com>2020-05-06 16:13:59 -0400
committerJeffrey Armstrong <jeff@approximatrix.com>2020-05-06 16:13:59 -0400
commitaf97440f3ef41ce88509397ada3c206fe63f9aa1 (patch)
treef0023b2cbace0536bc1166488ac6cac4c342c51c
parentb7e9966907434c6f58efa1307b2118a470c63d2b (diff)
downloadLR-87-af97440f3ef41ce88509397ada3c206fe63f9aa1.tar.gz
LR-87-af97440f3ef41ce88509397ada3c206fe63f9aa1.zip
Fixed handling of bad server response code. Made input requests in the dumb renderer a bit more pleasant.
-rw-r--r--dumb_render.f901
-rw-r--r--main.F903
-rw-r--r--protocol.f9022
3 files changed, 17 insertions, 9 deletions
diff --git a/dumb_render.f90 b/dumb_render.f90
index e6ca671..7ff4e6d 100644
--- a/dumb_render.f90
+++ b/dumb_render.f90
@@ -218,6 +218,7 @@ contains
answer = " "
Print *, question
+ Write(*, '(1X, A3)', advance="no") "=> "
Read *, answer
! Line Feed
diff --git a/main.F90 b/main.F90
index 66e6d57..7b2319d 100644
--- a/main.F90
+++ b/main.F90
@@ -177,6 +177,9 @@ contains
case (STATUS_CERTREQ)
call r%report_status("Server requesting certificate (unsupported)")
+ case (STATUS_BADRESPONSE)
+ call r%report_status("Bad response code from server")
+
end select
end subroutine update_status
diff --git a/protocol.f90 b/protocol.f90
index 6d2390a..087e96a 100644
--- a/protocol.f90
+++ b/protocol.f90
@@ -1,13 +1,14 @@
module gemini_protocol
implicit none
- integer, parameter::STATUS_INPUT = 1
- integer, parameter::STATUS_SUCCESS = 2
- integer, parameter::STATUS_REDIRECT = 3
- integer, parameter::STATUS_TEMPFAIL = 4
- integer, parameter::STATUS_PERMFAIL = 5
- integer, parameter::STATUS_CERTREQ = 6
- integer, parameter::STATUS_LOCALFAIL = -1
+ integer, parameter::STATUS_INPUT = 1
+ integer, parameter::STATUS_SUCCESS = 2
+ integer, parameter::STATUS_REDIRECT = 3
+ integer, parameter::STATUS_TEMPFAIL = 4
+ integer, parameter::STATUS_PERMFAIL = 5
+ integer, parameter::STATUS_CERTREQ = 6
+ integer, parameter::STATUS_BADRESPONSE = 7
+ integer, parameter::STATUS_LOCALFAIL = -1
integer, parameter::BUFFER_SIZE = 256
@@ -29,7 +30,7 @@ contains
type(connection)::conn
- integer::bytes_received, i
+ integer::bytes_received, i, iostatus
character, dimension(BUFFER_SIZE)::buffer
returncode = -1
@@ -63,7 +64,10 @@ contains
call mark_file_end(unit_number)
rewind(unit_number)
- read(unit_number, '(I1)') returncode
+ read(unit_number, '(I1)', iostat=iostatus) returncode
+ if(iostatus /= 0) then
+ returncode = STATUS_BADRESPONSE
+ end if
else