projects
/
pazpar2-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Allow to override on the commandline the variables:
[pazpar2-moved-to-github.git]
/
src
/
http.c
diff --git
a/src/http.c
b/src/http.c
index
642465f
..
86f8dc2
100644
(file)
--- a/
src/http.c
+++ b/
src/http.c
@@
-1,5
+1,5
@@
/* This file is part of Pazpar2.
/* This file is part of Pazpar2.
- Copyright (C) 2006-2008 Index Data
+ Copyright (C) 2006-2009 Index Data
Pazpar2 is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Pazpar2 is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
@@
-99,7
+99,7
@@
static const char *http_lookup_header(struct http_header *header,
return 0;
}
return 0;
}
-static struct http_buf *http_buf_create()
+static struct http_buf *http_buf_create(void)
{
struct http_buf *r;
{
struct http_buf *r;
@@
-230,12
+230,13
@@
static void urldecode(char *i, char *o)
*(o++) = ' ';
i++;
}
*(o++) = ' ';
i++;
}
- else if (*i == '%')
+ else if (*i == '%' && i[1] && i[2])
{
{
+ int v;
i++;
i++;
- sscanf(i, "%2hhx", o);
+ sscanf(i, "%2x", &v);
+ *o++ = v;
i += 2;
i += 2;
- o++;
}
else
*(o++) = *(i++);
}
else
*(o++) = *(i++);
@@
-350,7
+351,7
@@
static int package_check(const char *buf, int sz)
while (*cp == ' ')
cp++;
content_len = 0;
while (*cp == ' ')
cp++;
content_len = 0;
- while (*cp && isdigit(*cp))
+ while (*cp && isdigit(*(const unsigned char *)cp))
content_len = content_len*10 + (*cp++ - '0');
if (content_len < 0) /* prevent negative offsets */
content_len = 0;
content_len = content_len*10 + (*cp++ - '0');
if (content_len < 0) /* prevent negative offsets */
content_len = 0;
@@
-403,7
+404,7
@@
struct http_response *http_parse_response_buf(struct http_channel *c, const char
return 0;
*(value++) = '\0';
h->name = nmem_strdup(c->nmem, p);
return 0;
*(value++) = '\0';
h->name = nmem_strdup(c->nmem, p);
- while (isspace(*value))
+ while (isspace(*(const unsigned char *) value))
value++;
if (value >= p2) // Empty header;
{
value++;
if (value >= p2) // Empty header;
{
@@
-588,7
+589,8
@@
struct http_request *http_parse_request(struct http_channel *c,
r->content_len = start + len - buf;
r->content_buf = buf;
r->content_len = start + len - buf;
r->content_buf = buf;
- if (!strcmp(content_type, "application/x-www-form-urlencoded"))
+ if (!yaz_strcmp_del("application/x-www-form-urlencoded",
+ content_type, "; "))
{
http_parse_arguments(r, c->nmem, r->content_buf);
}
{
http_parse_arguments(r, c->nmem, r->content_buf);
}
@@
-887,6
+889,8
@@
static void http_io(IOCHAN i, int event)
hc->request->path,
*hc->request->search ? "?" : "",
hc->request->search);
hc->request->path,
*hc->request->search ? "?" : "",
hc->request->search);
+ if (hc->request->content_buf)
+ yaz_log(YLOG_LOG, "%s", hc->request->content_buf);
if (http_weshouldproxy(hc->request))
http_proxy(hc->request);
else
if (http_weshouldproxy(hc->request))
http_proxy(hc->request);
else
@@
-1290,7
+1294,9
@@
void http_observer_set_data2(http_channel_observer_t obs, void *data2)
/*
* Local variables:
* c-basic-offset: 4
/*
* Local variables:
* c-basic-offset: 4
+ * c-file-style: "Stroustrup"
* indent-tabs-mode: nil
* End:
* vim: shiftwidth=4 tabstop=8 expandtab
*/
* indent-tabs-mode: nil
* End:
* vim: shiftwidth=4 tabstop=8 expandtab
*/
+