jgoerzen / pygopherd

Multiprotocol Gopher/Web Server [Python]
GNU General Public License v2.0
170 stars 25 forks source link

"No handler found" for html links deeper than the root gophermap file #3

Closed DavidGriffith closed 4 years ago

DavidGriffith commented 5 years ago

Suppose we have /var/gopher/gophermap. Then /var/gopher/foo/gophermap. An html link in the first gophermap file will be handled correctly. In the second gophermap, this is the result:

   3'/foo/URL:http://www.foobar.com' does not exist (no handler found) error.host 1
qunka commented 5 years ago

The offending code seems to be line 74 in pygopherd/handlers/gophermap.py: if selector[0] != '/': # Relative link Since the first character isn't /, the gophermap handler assumes URL:http://www.foobar.com is a relative path. This fix should do it: if selector[0] != '/' and selector[0:4] != "URL:": # Relative link If anyone still uses UMN-style links, the equivalent fix is to line 212 in pygopherd/handlers/UMN.py: elif len(pathname) and pathname[0] != '/' and pathname[0:4] != "URL:":

qunka commented 5 years ago

I've opened a pull request.

qunka commented 4 years ago

@jgoerzen Thanks for the merge! This issue can now be closed.

geckopfote commented 3 years ago

This line is also responsible for telnet links being broken.

The following line in my gophermap file 8BBS[tab]none[tab]bbs.thesprawl.city[tab]23 will become this link: telnet///none@bbs.thesprawl.city:23/ Note the extra /

To get the correct telnet link my workarround for line 74 looks as follows: if selector[0] != '/' and arg[0][0] != '8':