phroxy

Gopher to HTTP proxy
git clone git://git.z3bra.org/phroxy.git
Log | Files | Refs | LICENSE

commit 6e94eb9317745df9cee6ce43df062fc0801da6ba
parent de16181ef04c64ba57523496ec68b02354505525
Author: Willy Goiffon <dev@z3bra.org>
Date:   Thu, 24 Sep 2020 09:58:35 +0200

Experiment: use <pre> only for formatted text

Diffstat:
Mphroxy.c | 12+++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/phroxy.c b/phroxy.c @@ -277,9 +277,15 @@ printhtml(int fd, const char *data, size_t len) break; n += r + 2; /* go past "\n\n" */ - write(fd, "<pre>", 5); - write(fd, s, r); - write(fd, "</pre>\n", 7); + if (strstr(s, " ") && strstr(s, " ") < e) { + write(fd, "<pre>", 5); + write(fd, s, r); + write(fd, "</pre>\n", 7); + } else { + write(fd, "<p>", 3); + write(fd, s, r); + write(fd, "</p>\n", 5); + } } return 0; }