X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Fhttp.c;fp=src%2Fhttp.c;h=0fdd465907b00d565edcaa346e60d87a8d06b3f7;hp=54521b16a2eaeb0adf6ea650103fee034119d987;hb=077c4e7bb226de0f6414674e01a838498a49867b;hpb=0f24d89832c8100312b48b9bf58a5c0eba877f93 diff --git a/src/http.c b/src/http.c index 54521b1..0fdd465 100644 --- a/src/http.c +++ b/src/http.c @@ -511,6 +511,12 @@ int yaz_decode_http_request(ODR o, Z_HTTP_Request **hr_p) int lspace = 0; *hr_p = hr; + hr->method = 0; + hr->version = 0; + hr->path = 0; + hr->headers = 0; + hr->content_buf = 0; + hr->content_len = 0; /* method .. */ for (i = 0; buf[i] != ' '; i++) if (i >= size-5 || i > 30) @@ -613,6 +619,8 @@ int yaz_encode_http_request(ODR o, Z_HTTP_Request *hr) char *cp; int top0 = o->op->top; + if (!hr->method || !hr->path) + return 0; odr_write(o, hr->method, strlen(hr->method)); odr_write(o, " ", 1); cp = strchr(hr->path, '#');