t* gopherproxy-c customized
       
   URI git clone git://git.codevoid.de/gopherproxy-c-sdk
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
       tREADME (3071B)
       ---
            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 Tor support:
           59 
           60 To accept tor gopher browsing, remove the -static flag from LDFLAGS in the
           61 Makefile set allow_tor to 1 in config.h to allow .onion addresses.
           62 
           63 Port restriction:
           64 
           65 For security reasons, only port 70 and 7070 are accepted as valid gopher ports.
           66 If you want allow all ports, set allow_all_ports in config.h
           67 
           68 Nginx buffering issues:
           69 
           70 When using nginx 1.12+ with OpenBSD slowcgi there may be buffering issues. This
           71 is a bug in nginx. This bug is fixed in newer nginx versions (see patch below).
           72 
           73 Workaround:
           74         # workaround fastcgi buffering bug in nginx (fixed in 1.14).
           75         fastcgi_buffering off;
           76 
           77 Patch:
           78 
           79 commit cfc8c28259b3fd59f2517ac4830a08e8a9925148
           80 Author: Maxim Dounin <mdounin@mdounin.ru>
           81 Date:   Thu Nov 9 15:35:20 2017 +0300
           82 
           83     FastCGI: adjust buffer position when parsing incomplete records.
           84     
           85     Previously, nginx failed to move buffer position when parsing an incomplete
           86     record header, and due to this wasn't be able to continue parsing once
           87     remaining bytes of the record header were received.
           88     
           89     This can affect response header parsing, potentially generating spurious errors
           90     like "upstream sent unexpected FastCGI request id high byte: 1 while reading
           91     response header from upstream".  While this is very unlikely, since usually
           92     record headers are written in a single buffer, this still can happen in real
           93     life, for example, if a record header will be split across two TCP packets
           94     and the second packet will be delayed.
           95     
           96     This does not affect non-buffered response body proxying, due to "buf->pos =
           97     buf->last;" at the start of the ngx_http_fastcgi_non_buffered_filter()
           98     function.  Also this does not affect buffered response body proxying, as
           99     each input buffer is only passed to the filter once.
          100 
          101 diff --git a/src/http/modules/ngx_http_fastcgi_module.c b/src/http/modules/ngx_http_fastcgi_module.c
          102 index ea16ecae..b4bb1d0a 100644
          103 --- a/src/http/modules/ngx_http_fastcgi_module.c
          104 +++ b/src/http/modules/ngx_http_fastcgi_module.c
          105 @@ -2646,6 +2646,7 @@ ngx_http_fastcgi_process_record(ngx_http_request_t *r,
          106          }
          107      }
          108  
          109 +    f->pos = p;
          110      f->state = state;
          111  
          112      return NGX_AGAIN;