From b063cac571202757ec25f2c6e2a772684b88d4ae Mon Sep 17 00:00:00 2001 From: Jeffrey Armstrong Date: Tue, 5 May 2020 11:56:54 -0400 Subject: Added input handling with escaping, all untested. --- main.F90 | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'main.F90') diff --git a/main.F90 b/main.F90 index 9ab1782..a457d01 100644 --- a/main.F90 +++ b/main.F90 @@ -18,6 +18,7 @@ implicit none logical::running logical::loaded + logical::populated integer::return_code @@ -62,11 +63,19 @@ implicit none do while(running) + if(index(current_url, "gemini://") /= 1) then + call r%draw_error("Only gemini:// URLs are supported") + populated = .false. + loaded = .true. + return_code = STATUS_LOCALFAIL + end if + if(.not. loaded) then call r%report_status("Requesting "//trim(current_url)) return_code = request_url(trim(current_url), io) + populated = .true. call update_status(r, current_url, return_code) @@ -76,8 +85,18 @@ implicit none call get_redirect_url(io, current_url) loaded = .false. + populated = .false. - else + else if(return_code == STATUS_INPUT) then + + if(handle_input(r, current_url, io)) then + ! Should force a new load + loaded = .false. + else + loaded = .true. + end if + + else if(populated) then first_line => load_unit(io, file_type_gemini) loaded = .true. -- cgit v1.2.3