aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffrey Armstrong <jeff@approximatrix.com>2020-05-27 16:46:04 -0400
committerJeffrey Armstrong <jeff@approximatrix.com>2020-05-27 16:46:04 -0400
commit10bb07b2d12f232a2ec68f3a1b8e337be9582f7d (patch)
tree5cae301c28d4fb0fb3a6ad9e5f3d410cc2773aa7
parentbeb210f16f2e351470f90b771ff95d9f18e95073 (diff)
downloadLR-87-10bb07b2d12f232a2ec68f3a1b8e337be9582f7d.zip
LR-87-10bb07b2d12f232a2ec68f3a1b8e337be9582f7d.tar.gz
Added an additional failure condition. Exit dumb_renderer on error with initial site.
-rw-r--r--main.F9010
-rw-r--r--protocol.f9017
2 files changed, 23 insertions, 4 deletions
diff --git a/main.F90 b/main.F90
index 02eab98..9512f2c 100644
--- a/main.F90
+++ b/main.F90
@@ -98,6 +98,7 @@ implicit none
running = .true.
loaded = .false.
+ redo_layout = .false.
call r%initialize()
locations_visited => null()
@@ -121,8 +122,8 @@ implicit none
call r%report_status("Requesting "//trim(desired_url))
return_code = request_url(desired_url, io, return_type, bh)
- populated = .true.
-
+ populated = .not. is_failure_code(return_code)
+ Print *, "return code: ", return_code
call update_status(r, desired_url, return_code)
end if
@@ -179,7 +180,12 @@ implicit none
end if
redo_layout = .false.
+
+ else if(.not. redo_layout .and. is_failure_code(return_code) .and. len_trim(current_url) == 0) then
+ call r%report_status("Exiting without initial site")
+ running = .false.
+
end if
do while(loaded .and. running)
diff --git a/protocol.f90 b/protocol.f90
index b0699a6..4948325 100644
--- a/protocol.f90
+++ b/protocol.f90
@@ -31,6 +31,7 @@ implicit none
integer, parameter::STATUS_CERTREQ = 6
integer, parameter::STATUS_BADRESPONSE = 7
integer, parameter::STATUS_LOCALFAIL = -1
+ integer, parameter::STATUS_CONNECTFAIL = -2
integer, parameter::BUFFER_SIZE = 256
@@ -38,6 +39,17 @@ implicit none
contains
+ function is_failure_code(return_code)
+ implicit none
+
+ integer, intent(in)::return_code
+ logical::is_failure_code
+
+ is_failure_code = any(return_code == &
+ [STATUS_CONNECTFAIL, STATUS_LOCALFAIL, STATUS_BADRESPONSE, STATUS_PERMFAIL, STATUS_TEMPFAIL])
+
+ end function is_failure_code
+
subroutine get_mimetype(status_line, return_type)
implicit none
@@ -225,16 +237,17 @@ contains
else
- returncode = -1
+ returncode = STATUS_CONNECTFAIL
write(unit_number, *) "Send Error: Could Not Send Request"
end if
else
- returncode = -1
+ returncode = STATUS_CONNECTFAIL
write(unit_number, *) "Connection Error: "//trim(translate_connection_code(conn%code))
write(*, *) "Connection Error: "//trim(translate_connection_code(conn%code))
+
end if
call close_connection(conn)