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)
int yaz_encode_http_request(ODR o, Z_HTTP_Request *hr)
{
Z_HTTP_Header *h;
+ 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);
- odr_write(o, hr->path, strlen(hr->path));
+ cp = strchr(hr->path, '#');
+ odr_write(o, hr->path, cp ? (cp - hr->path) : strlen(hr->path));
odr_write(o, " HTTP/", 6);
odr_write(o, hr->version, strlen(hr->version));
odr_write(o, "\r\n", 2);