summaryrefslogtreecommitdiffstats
path: root/src/server.c
diff options
context:
space:
mode:
authorJulian Maingot <julianmaingot@gmail.com>2022-07-30 17:24:36 -0700
committerDrew DeVault <sir@cmpwn.com>2022-08-15 15:50:27 +0200
commit132f2ececc012cf4744ca5b8044fb637fed96a0c (patch)
tree970546195405ebf064fe7d1f41de86bf41822b6d /src/server.c
parent1925bc3e7a131dfcb1c6152c80675deb2a067020 (diff)
downloadgmnisrv-132f2ececc012cf4744ca5b8044fb637fed96a0c.tar.gz
gmnisrv-132f2ececc012cf4744ca5b8044fb637fed96a0c.tar.xz
gmnisrv-132f2ececc012cf4744ca5b8044fb637fed96a0c.zip
notify clients about malformed requests
I think this has been broken for a while and I came across it while implementing my own client. The server should notify the client that the request is malformed but wasn't sending the response when SSL_read returned SSL_ERROR_WANT_READ.
Diffstat (limited to 'src/server.c')
-rw-r--r--src/server.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/server.c b/src/server.c
index e199f6f..56e11c9 100644
--- a/src/server.c
+++ b/src/server.c
@@ -345,7 +345,10 @@ client_readable(struct gmnisrv_server *server, struct gmnisrv_client *client)
switch (e) {
case SSL_ERROR_WANT_READ:
case SSL_ERROR_WANT_WRITE:
- goto queue_ssl_write;
+ if (client->bufln == 0) {
+ goto queue_ssl_write;
+ }
+ // intentional fallthrough
default:
client_submit_response(client,
GEMINI_STATUS_BAD_REQUEST, error, NULL);