tProvide a static /robots.txt response - phroxy - Gopher to HTTP proxy
 (HTM) git clone git://git.z3bra.org/phroxy.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) LICENSE
       ---
 (DIR) commit 7b716aa8cb5087d707b16615ffdaeedb930a5bcc
 (DIR) parent 60dbd05fe2fc35874ea32542f3849507f2787ce3
 (HTM) Author: Willy Goiffon <dev@z3bra.org>
       Date:   Mon, 20 Sep 2021 10:41:05 +0200
       
       Provide a static /robots.txt response
       
       Diffstat:
         M config.def.h                        |       1 +
         M phroxy.c                            |      13 +++++++++++++
       
       2 files changed, 14 insertions(+), 0 deletions(-)
       ---
 (DIR) diff --git a/config.def.h b/config.def.h
       t@@ -9,6 +9,7 @@ const char *head =
                "</head>\n"
                "<body>\n";
        const char *foot = "</body></html>\n";
       +const char *robotstxt = "User-Agent: *\nDisallow: /\n";
        
        const char *items[] = {
                [ITEM_0] =  "📄",
 (DIR) diff --git a/phroxy.c b/phroxy.c
       t@@ -370,6 +370,16 @@ printhtml(int fd, const char *data, size_t len)
        }
        
        int
       +servebots()
       +{
       +        printf("HTTP/1.1 200 OK\r\n");
       +        printheaders("text/plain");
       +        printf("\r\n");
       +        write(1, robotstxt, strlen(robotstxt));
       +        return 0;
       +}
       +
       +int
        serveitem(char item, char *path, char *data, size_t len)
        {
                char *send;
       t@@ -440,6 +450,9 @@ phroxy(char *url)
                char *hole, *path, *host, *port;
                char *data = NULL, *srch = NULL;
        
       +        if (!strncmp(url, "/robots.txt", 10))
       +                return servebots();
       +
                url++;
                hole = strsep(&url, "/");
                if (!hole || !strnlen(hole, 1))