geomyidae

A small C-based gopherd. (gopher://bitreich.org/1/scm/geomyidae)
git clone git://r-36.net/geomyidae
Log | Files | Refs | README | LICENSE

commit a95a4265767fd7f6f8b6e14fd92e39142244c684
parent bbda3db127acc7e916bdd1668edb00ca7235ad02
Author: Quentin Rameau <quinq@fifth.space>
Date:   Sat, 30 Jan 2021 19:38:26 +0100

Terminate data exchange with ".\r\n" for all non-binary types

Signed-off-by: Christoph Lohmann <20h@r-36.net>

Diffstat:
handlr.c | 8++++++++
handlr.h | 2++
ind.c | 20++++++++++----------
index.gph | 3++-
4 files changed, 22 insertions(+), 11 deletions(-)

diff --git a/handlr.c b/handlr.c @@ -127,6 +127,14 @@ handlebin(int sock, char *file, char *port, char *base, char *args, } void +handletxt(int sock, char *file, char *port, char *base, char *args, + char *sear, char *ohost, char *chost, int istls) +{ + handlebin(sock, file, port, base, args, sear, ohost, chost, istls); + dprintf(sock, ".\r\n"); +} + +void handlecgi(int sock, char *file, char *port, char *base, char *args, char *sear, char *ohost, char *chost, int istls) { diff --git a/handlr.h b/handlr.h @@ -26,6 +26,8 @@ void handlegph(int sock, char *file, char *port, char *base, char *args, char *sear, char *ohost, char *chost, int istls); void handlebin(int sock, char *file, char *port, char *base, char *args, char *sear, char *ohost, char *chost, int istls); +void handletxt(int sock, char *file, char *port, char *base, char *args, + char *sear, char *ohost, char *chost, int istls); void handlecgi(int sock, char *file, char *port, char *base, char *args, char *sear, char *ohost, char *chost, int istls); void handledcgi(int sock, char *file, char *port, char *base, char *args, diff --git a/ind.c b/ind.c @@ -42,16 +42,16 @@ filetype type[] = { {"gif", "g", handlebin}, {"png", "I", handlebin}, {"bmp", "I", handlebin}, - {"txt", "0", handlebin}, - {"html", "0", handlebin}, - {"htm", "0", handlebin}, - {"xhtml", "0", handlebin}, - {"css", "0", handlebin}, - {"md", "0", handlebin}, - {"c", "0", handlebin}, - {"sh", "0", handlebin}, - {"patch", "0", handlebin}, - {"meme", "0", handlebin}, + {"txt", "0", handletxt}, + {"html", "0", handletxt}, + {"htm", "0", handletxt}, + {"xhtml", "0", handletxt}, + {"css", "0", handletxt}, + {"md", "0", handletxt}, + {"c", "0", handletxt}, + {"sh", "0", handletxt}, + {"patch", "0", handletxt}, + {"meme", "0", handletxt}, {NULL, NULL, NULL}, }; diff --git a/index.gph b/index.gph @@ -1,9 +1,10 @@ comment tcomment [1|R-36|/|server|port] -[0|file - comment|/file.dat|server|port] +[0|file - comment|/file.txt|server|port] [h|http://www.heise.de|URL:http://www.heise.de|server|port] [0|some \| escape and [ special characters ] test|error|server|port] +[9|binary data file|/file.dat|server|port] [|empty type||server|port] some invalid line