README (3782B)
1 gopherproxy 2 =========== 3 4 Build dependencies 5 ------------------ 6 7 - C compiler. 8 - libc + some BSD extensions (dprintf). 9 - POSIX system. 10 - make (optional). 11 - LibreSSL libtls for gophers:// support (optional). 12 13 14 Features 15 -------- 16 17 - Works in older browsers such as links, lynx, w3m, dillo, etc. 18 - No Javascript or CSS required. 19 - Gopher+ is not supported. 20 - Support for Gopher over TLS encryption (gophers://). 21 22 23 Cons 24 ---- 25 26 - Not all gopher types are supported. 27 28 29 Gopher over TLS 30 --------------- 31 32 For a description of the protocol see near the section "TLS support": 33 gopher://bitreich.org/1/scm/gopher-protocol/file/gopher-extension.md.gph 34 35 For a server implementation see: 36 - geomyidae: gopher://bitreich.org/1/scm/geomyidae 37 38 For client implementations that support it see: 39 40 - cURL: https://curl.se/ 41 - sacc: gopher://bitreich.org/1/scm/sacc 42 - hurl: gopher://codemadness.org/1/git/hurl 43 44 45 CGI configuration examples 46 -------------------------- 47 48 Nginx + slowcgi: 49 50 location /gopherproxy/ { 51 include /etc/nginx/fastcgi_params; 52 fastcgi_pass unix:/run/slowcgi.sock; 53 fastcgi_param SCRIPT_FILENAME /cgi-bin/gopherproxy.cgi; 54 fastcgi_param SCRIPT_NAME /cgi-bin/gopherproxy.cgi; 55 fastcgi_param REQUEST_URI /cgi-bin/gopherproxy.cgi; 56 } 57 58 59 OpenBSD httpd + slowcgi: 60 61 location "/gopherproxy" { 62 root "/cgi-bin/gopherproxy.cgi" 63 fastcgi 64 } 65 66 Caddy + http.cgi: 67 68 proxy.domain.tld { 69 cgi /proxy /usr/local/bin/gopherproxy 70 } 71 72 73 Notes 74 ----- 75 76 Restrictions: 77 78 For security reasons, only port 70 and 7070 are accepted as valid gopher ports. 79 Furthermore there is a connection time limit and download size limit. See the 80 source-code for more information. 81 82 83 Tor support: 84 85 Modify the isblacklisted() function in gopherproxy.c to allow .onion addresses. 86 87 88 torsocks support: 89 90 To accept torsocks with gopherproxy, remove the -static flag from LDFLAGS in 91 the Makefile. This is because torsocks is a shared library and "hooks into" the 92 network calls. 93 94 95 Nginx buffering issues: 96 97 When using nginx 1.12+ with OpenBSD slowcgi there may be buffering issues. This 98 is a bug in nginx. This bug is fixed in newer nginx versions (see patch below). 99 100 Workaround: 101 # workaround fastcgi buffering bug in nginx (fixed in 1.14). 102 fastcgi_buffering off; 103 104 Patch: 105 106 commit cfc8c28259b3fd59f2517ac4830a08e8a9925148 107 Author: Maxim Dounin <mdounin@mdounin.ru> 108 Date: Thu Nov 9 15:35:20 2017 +0300 109 110 FastCGI: adjust buffer position when parsing incomplete records. 111 112 Previously, nginx failed to move buffer position when parsing an incomplete 113 record header, and due to this wasn't be able to continue parsing once 114 remaining bytes of the record header were received. 115 116 This can affect response header parsing, potentially generating spurious errors 117 like "upstream sent unexpected FastCGI request id high byte: 1 while reading 118 response header from upstream". While this is very unlikely, since usually 119 record headers are written in a single buffer, this still can happen in real 120 life, for example, if a record header will be split across two TCP packets 121 and the second packet will be delayed. 122 123 This does not affect non-buffered response body proxying, due to "buf->pos = 124 buf->last;" at the start of the ngx_http_fastcgi_non_buffered_filter() 125 function. Also this does not affect buffered response body proxying, as 126 each input buffer is only passed to the filter once. 127 128 diff --git a/src/http/modules/ngx_http_fastcgi_module.c b/src/http/modules/ngx_http_fastcgi_module.c 129 index ea16ecae..b4bb1d0a 100644 130 --- a/src/http/modules/ngx_http_fastcgi_module.c 131 +++ b/src/http/modules/ngx_http_fastcgi_module.c 132 @@ -2646,6 +2646,7 @@ ngx_http_fastcgi_process_record(ngx_http_request_t *r, 133 } 134 } 135 136 + f->pos = p; 137 f->state = state; 138 139 return NGX_AGAIN;