1
0
forked from aniani/gmnisrv

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.
This commit is contained in:
Julian Maingot 2022-07-30 17:24:36 -07:00 committed by Drew DeVault
parent 1925bc3e7a
commit 132f2ececc

View File

@ -345,7 +345,10 @@ client_readable(struct gmnisrv_server *server, struct gmnisrv_client *client)
switch (e) { switch (e) {
case SSL_ERROR_WANT_READ: case SSL_ERROR_WANT_READ:
case SSL_ERROR_WANT_WRITE: case SSL_ERROR_WANT_WRITE:
if (client->bufln == 0) {
goto queue_ssl_write; goto queue_ssl_write;
}
// intentional fallthrough
default: default:
client_submit_response(client, client_submit_response(client,
GEMINI_STATUS_BAD_REQUEST, error, NULL); GEMINI_STATUS_BAD_REQUEST, error, NULL);