aboutsummaryrefslogtreecommitdiff
path: root/protocol.f90
diff options
context:
space:
mode:
authorJeffrey Armstrong <jeff@approximatrix.com>2020-05-05 11:04:22 -0400
committerJeffrey Armstrong <jeff@approximatrix.com>2020-05-05 11:04:22 -0400
commit0ade9914918238b8da35e995fe9782a517988ae2 (patch)
treeff9871528998544479a1a15144354d8b873ddc20 /protocol.f90
parent723324ae71f8209e4b1757a3f84bd0e66b6c6319 (diff)
downloadLR-87-0ade9914918238b8da35e995fe9782a517988ae2.zip
LR-87-0ade9914918238b8da35e995fe9782a517988ae2.tar.gz
Fixed link handling. Can now navigate links and page up/down.
Diffstat (limited to 'protocol.f90')
-rw-r--r--protocol.f9032
1 files changed, 31 insertions, 1 deletions
diff --git a/protocol.f90 b/protocol.f90
index 52b6430..130c866 100644
--- a/protocol.f90
+++ b/protocol.f90
@@ -48,7 +48,6 @@ contains
if(send_string(conn%ssl, url//c_carriage_return//c_new_line, trimming=.false.)) then
bytes_received = retrieve_characters(conn%ssl, buffer)
- Print *, bytes_received
do while(bytes_received > 0)
do i=1, bytes_received
@@ -115,4 +114,35 @@ contains
end subroutine get_redirect_url
+ subroutine handle_relative_url(current_url, path)
+ implicit none
+
+ character(*), intent(inout)::current_url
+ character(*), intent(in)::path
+
+ integer::past_protocol, first_slash, last_slash
+
+ past_protocol = index(current_url, "://")
+ if(past_protocol > 0) then
+
+ past_protocol = past_protocol + 3
+
+ if(path(1:1) == "/") then
+
+ first_slash = index(current_url(past_protocol:len_trim(current_url)), "/")
+ current_url = current_url(1:(past_protocol + first_slash - 1))//path
+
+ else
+
+ last_slash = index(current_url, "/", back=.true.)
+ if(last_slash > 0) then
+ current_url = current_url(1:last_slash)//path
+ end if
+
+ end if
+
+ end if
+
+ end subroutine handle_relative_url
+
end module gemini_protocol \ No newline at end of file