summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libtipidee/tipidee_rql_read.c2
-rw-r--r--src/tipideed/tipideed-internal.h2
-rw-r--r--src/tipideed/tipideed.c8
-rw-r--r--src/tipideed/trace.c12
4 files changed, 11 insertions, 13 deletions
diff --git a/src/libtipidee/tipidee_rql_read.c b/src/libtipidee/tipidee_rql_read.c
index fe6091d..7aa0ff6 100644
--- a/src/libtipidee/tipidee_rql_read.c
+++ b/src/libtipidee/tipidee_rql_read.c
@@ -79,7 +79,7 @@ int tipidee_rql_read (buffer *b, char *buf, size_t max, size_t *w, tipidee_rql *
{
size_t l = tipidee_uri_parse(buf, max, buf + pos[1], &rql->uri) ;
if (!l) return 400 ;
- *w = l ;
+ if (w) *w = l ;
}
return 0 ;
}
diff --git a/src/tipideed/tipideed-internal.h b/src/tipideed/tipideed-internal.h
index 344840c..1efe291 100644
--- a/src/tipideed/tipideed-internal.h
+++ b/src/tipideed/tipideed-internal.h
@@ -111,7 +111,7 @@ extern void respond_30x (tipidee_rql const *, tipidee_redirection const *) ;
/* Trace */
-extern int respond_trace (char const *, tipidee_rql const *, tipidee_headers const *) ;
+extern int respond_trace (tipidee_rql const *, tipidee_headers const *) ;
/* Options */
diff --git a/src/tipideed/tipideed.c b/src/tipideed/tipideed.c
index 4df6e8f..56ef46c 100644
--- a/src/tipideed/tipideed.c
+++ b/src/tipideed/tipideed.c
@@ -373,7 +373,6 @@ int main (int argc, char const *const *argv, char const *const *envp)
if (!tain_now_set_stopwatch_g())
strerr_diefu1sys(111, "initialize clock") ;
-
tipidee_log_start(g.logv, g.sa.s + remoteip, g.sa.s + remotehost) ;
@@ -386,7 +385,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
tipidee_headers hdr ;
int e ;
unsigned int localredirs = 0 ;
- size_t content_length ;
+ size_t content_length = 0 ;
tipidee_transfercoding tcoding = TIPIDEE_TRANSFERCODING_UNKNOWN ;
char uribuf[URI_BUFSIZE] ;
char hdrbuf[HDR_BUFSIZE] ;
@@ -394,7 +393,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
tain_add_g(&deadline, &g.readtto) ;
bodysa.len = 0 ;
- e = tipidee_rql_read_g(buffer_0, uribuf, URI_BUFSIZE, &content_length, &rql, &deadline) ;
+ e = tipidee_rql_read_g(buffer_0, uribuf, URI_BUFSIZE, 0, &rql, &deadline) ;
switch (e)
{
case -1 : log_and_exit(1) ; /* bad client */
@@ -407,7 +406,6 @@ int main (int argc, char const *const *argv, char const *const *envp)
if (rql.http_major != 1) log_and_exit(1) ;
if (rql.http_minor > 1) eexit_400(&rql, "Bad HTTP version") ;
- content_length = 0 ;
tipidee_headers_init(&hdr, hdrbuf, HDR_BUFSIZE) ;
e = tipidee_headers_timed_parse_g(buffer_0, &hdr, &deadline) ;
switch (e)
@@ -491,7 +489,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
if (rql.m == TIPIDEE_METHOD_TRACE)
{
- respond_trace(hdrbuf, &rql, &hdr) ;
+ respond_trace(&rql, &hdr) ;
continue ;
}
diff --git a/src/tipideed/trace.c b/src/tipideed/trace.c
index d1aed09..0e2ccac 100644
--- a/src/tipideed/trace.c
+++ b/src/tipideed/trace.c
@@ -13,7 +13,7 @@
#include <tipidee/log.h>
#include "tipideed-internal.h"
-int respond_trace (char const *buf, tipidee_rql const *rql, tipidee_headers const *hdr)
+int respond_trace (tipidee_rql const *rql, tipidee_headers const *hdr)
{
tain deadline ;
size_t cl = 0 ;
@@ -26,7 +26,7 @@ int respond_trace (char const *buf, tipidee_rql const *rql, tipidee_headers cons
cl += strlen(rql->uri.path) + (rql->uri.query ? 1 + strlen(rql->uri.query) : 0) ;
cl += 6 + uint_fmt(0, rql->http_major) + 1 + uint_fmt(0, rql->http_minor) + 2 ;
for (size_t i = 0 ; i < hdr->n ; i++)
- cl += strlen(buf + hdr->list[i].left) + 2 + strlen(buf + hdr->list[i].right) + 2 ;
+ cl += strlen(hdr->buf + hdr->list[i].left) + 2 + strlen(hdr->buf + hdr->list[i].right) + 2 ;
cl += 2 ;
buffer_putnoflush(buffer_1, fmt, size_fmt(fmt, cl)) ;
buffer_putsnoflush(buffer_1, "\r\n\r\n") ;
@@ -52,12 +52,12 @@ int respond_trace (char const *buf, tipidee_rql const *rql, tipidee_headers cons
tipidee_log_answer(g.logv, rql, 200, cl) ;
for (size_t i = 0 ; i < hdr->n ; i++)
{
- size_t len = strlen(buf + hdr->list[i].left) ;
+ size_t len = strlen(hdr->buf + hdr->list[i].left) ;
tain_add_g(&deadline, &g.writetto) ;
- if (buffer_timed_put_g(buffer_1, buf + hdr->list[i].left, len, &deadline) < len) goto err ;
+ if (buffer_timed_put_g(buffer_1, hdr->buf + hdr->list[i].left, len, &deadline) < len) goto err ;
if (buffer_timed_put_g(buffer_1, ": ", 2, &deadline) < 2) goto err ;
- len = strlen(buf + hdr->list[i].right) ;
- if (buffer_timed_put_g(buffer_1, buf + hdr->list[i].right, len, &deadline) < len) goto err ;
+ len = strlen(hdr->buf + hdr->list[i].right) ;
+ if (buffer_timed_put_g(buffer_1, hdr->buf + hdr->list[i].right, len, &deadline) < len) goto err ;
if (buffer_timed_put_g(buffer_1, "\r\n", 2, &deadline) < 2) goto err ;
}
if (buffer_timed_put_g(buffer_1, "\r\n", 2, &deadline) < 2