* Copyright (C) 1995-2005, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: srwutil.c,v 1.28 2005-06-25 15:46:05 adam Exp $
+ * $Id: srwutil.c,v 1.31 2005-09-12 10:23:53 adam Exp $
*/
/**
* \file srwutil.c
int no = 2;
const char *cp;
*name = 0;
- if (*path != '?')
+ if (*path == '?')
+ path++;
+ if (!*path)
return no;
- path++;
cp = path;
while ((cp = strchr(cp, '&')))
{
cp++;
no++;
}
- *name = odr_malloc(o, no * sizeof(char**));
- *val = odr_malloc(o, no * sizeof(char**));
+ *name = odr_malloc(o, no * sizeof(char*));
+ *val = odr_malloc(o, no * sizeof(char*));
for (no = 0; *path; no++)
{
{0, 0, 0}
};
#endif
- if (!strcmp(hreq->method, "GET"))
+ const char *content_type = z_HTTP_header_lookup(hreq->headers,
+ "Content-Type");
+ /*
+ SRU GET: allow any content type.
+ SRU POST: we support "application/x-www-form-urlencoded";
+ not "multipart/form-data" .
+ */
+ if (!strcmp(hreq->method, "GET")
+ ||
+ (!strcmp(hreq->method, "POST")
+ && content_type &&
+ !yaz_strcmp_del("application/x-www-form-urlencoded",
+ content_type, "; ")
+ )
+ )
{
char *db = "Default";
const char *p0 = hreq->path, *p1;
memcpy (db, p0, p1 - p0);
db[p1 - p0] = '\0';
}
+ if (!strcmp(hreq->method, "POST"))
+ p1 = hreq->content_buf;
yaz_uri_array(p1, decode, &uri_name, &uri_val);
#if HAVE_XML2
if (uri_name)