[prev in list] [next in list] [prev in thread] [next in thread] 

List:       elinks-dev
Subject:    [elinks-dev] [PATCH] gopher: ensure slash after entity type in links
From:       Pete Deas <petedeas () fastmail ! fm>
Date:       2016-04-29 20:16:13
Message-ID: 20160429201612.GJ6806 () raspberrypi
[Download RAW message or body]

This prevents links with null selectors being interpreted as pointing to
a (likely non-existent) file gopher://server/1
An example of a page with such links: gopher://gopher.floodgap.com/1/new
---
 src/protocol/gopher/gopher.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/protocol/gopher/gopher.c b/src/protocol/gopher/gopher.c
index dcca0a6..da76d37 100644
--- a/src/protocol/gopher/gopher.c
+++ b/src/protocol/gopher/gopher.c
@@ -527,6 +527,10 @@ add_gopher_menu_line(struct string *buffer, unsigned char *line)
 			add_format_to_string(&address, "gopher://%s/%c",
 				host, entity);
 
+			/* Ensure we put a slash after entity type */
+			if (selector[0] != '/')
+				add_char_to_string(&address, '/');
+
 			/* Encode selector string */
 			encode_selector_string(&address, selector);
 		}
-- 
2.8.1
-- 
http://lists.linuxfromscratch.org/listinfo/elinks-dev
Unsubscribe: See the above information page

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic