From: Zachary Lee Andrews Date: Thu, 26 Aug 2021 16:56:08 +0000 (+0000) Subject: Support Gopher type "w" (#889) X-Git-Tag: SQUID_6_0_1~292 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=dc7bfd75163730fbcc0d2838f0ce87fe113f598c;p=thirdparty%2Fsquid.git Support Gopher type "w" (#889) Known uses and libwww imply that "w" selector is an absolute URI. Also updated gopher item-type code list and codes documentation. --- diff --git a/src/gopher.cc b/src/gopher.cc index 242e8203ca..7c0e666252 100644 --- a/src/gopher.cc +++ b/src/gopher.cc @@ -35,7 +35,7 @@ #include "MemObject.h" #endif -/* gopher type code from rfc. Anawat. */ +// RFC 1436 section 3.8 gopher item-type codes #define GOPHER_FILE '0' #define GOPHER_DIRECTORY '1' #define GOPHER_CSO '2' @@ -51,17 +51,18 @@ #define GOPHER_GIF 'g' #define GOPHER_IMAGE 'I' +// Gopher+ section 2.9 extension types +// https://github.com/jgoerzen/pygopherd/blob/master/doc/standards/Gopher%2B.txt +#define GOPHER_PLUS_IMAGE ':' +#define GOPHER_PLUS_MOVIE ';' +#define GOPHER_PLUS_SOUND '<' + +// non-standard item-type codes #define GOPHER_HTML 'h' #define GOPHER_INFO 'i' - -/// W3 address #define GOPHER_WWW 'w' #define GOPHER_SOUND 's' -#define GOPHER_PLUS_IMAGE ':' -#define GOPHER_PLUS_MOVIE ';' -#define GOPHER_PLUS_SOUND '<' - #define GOPHER_PORT 70 #define TAB '\t' @@ -564,6 +565,10 @@ gopherToHTML(GopherStateData * gopherState, char *inbuf, int len) icon_url = NULL; break; + case GOPHER_WWW: + icon_url = mimeGetIconURL("internal-link"); + break; + default: icon_url = mimeGetIconURL("internal-unknown"); break; @@ -588,6 +593,9 @@ gopherToHTML(GopherStateData * gopherState, char *inbuf, int len) /* WWW link */ snprintf(tmpbuf, TEMP_BUF_SIZE, " %s\n", icon_url, host, rfc1738_escape_unescaped(selector + 5), html_quote(name)); + } else if (gtype == GOPHER_WWW) { + snprintf(tmpbuf, TEMP_BUF_SIZE, " %s\n", + icon_url, rfc1738_escape_unescaped(selector), html_quote(name)); } else { /* Standard link */ snprintf(tmpbuf, TEMP_BUF_SIZE, " %s\n",