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