diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2023-09-30 09:38:18 +0000 |
---|---|---|
committer | Laurent Bercot <ska@appnovation.com> | 2023-09-30 09:38:18 +0000 |
commit | 00774b3f92bd6898ce56f41ce39074e9fe89c08e (patch) | |
tree | deeb2a9b483ed3e4e637fc0ea744c65cc64d1763 /src/libtipidee/tipidee_rql_read.c | |
parent | f1a6903f46c0e2edcdd2b7fa83c8a5bb4ca0e021 (diff) | |
download | tipidee-00774b3f92bd6898ce56f41ce39074e9fe89c08e.tar.xz |
Some fixes; new SERVER_NAME source; prepare for more config
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/libtipidee/tipidee_rql_read.c')
-rw-r--r-- | src/libtipidee/tipidee_rql_read.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/libtipidee/tipidee_rql_read.c b/src/libtipidee/tipidee_rql_read.c index f3508cf..fc99f37 100644 --- a/src/libtipidee/tipidee_rql_read.c +++ b/src/libtipidee/tipidee_rql_read.c @@ -1,5 +1,6 @@ /* ISC license. */ +#include <errno.h> #include <stdint.h> #include <string.h> #include <strings.h> @@ -8,7 +9,6 @@ #include <skalibs/bytestr.h> #include <skalibs/buffer.h> #include <skalibs/unix-timed.h> -// #include <skalibs/lolstdio.h> #include <tipidee/method.h> #include <tipidee/uri.h> @@ -66,12 +66,11 @@ static inline int get_version (char const *in, tipidee_rql *rql) int tipidee_rql_read (buffer *b, char *buf, size_t max, size_t *w, tipidee_rql *rql, tain const *deadline, tain *stamp) { size_t pos[3] = { 0 } ; - if (timed_getlnmax(b, buf, max, &pos[0], '\n', deadline, stamp) <= 0) return -1 ; + if (timed_getlnmax(b, buf, max, &pos[0], '\n', deadline, stamp) == -1) + return errno == ETIMEDOUT ? 99 : -1 ; buf[--pos[0]] = 0 ; if (buf[pos[0] - 1] == '\r') buf[--pos[0]] = 0 ; -// LOLDEBUG("tipidee_rql_read: timed_getlnmax: len is %zu, line is %s", pos[0], buf) ; if (!rql_tokenize(buf, pos)) return 400 ; -// LOLDEBUG("tipidee_rql_read: method: %s, version: %s, uri to parse: %s", buf + pos[0], buf + pos[2], buf + pos[1]) ; rql->m = tipidee_method_tonum(buf + pos[0]) ; if (rql->m == TIPIDEE_METHOD_UNKNOWN) return 400 ; if (!get_version(buf + pos[2], rql)) return 400 ; |