[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
[xml] Relative HTTP redirects
- From: Ian Hummel <ian themodernlife net>
- To: libxml2 mailing list <xml gnome org>
- Subject: [xml] Relative HTTP redirects
- Date: Wed, 31 Mar 2004 16:18:28 +0200
xmlNanoHTTP makes no attempt to follow http redirects if the url in the
'Location:' header is relative. Attached is a patch that fixes it.
It's true that returning a relative url in a location header violates
HTTP. Unfortunately, it seems this practice is encouraged in the IIS
camp.
If you guys decide to not commit it, how about changing the error
message? right now it just outputs an "Unknown IO error", with
DEBUG_HTTP enabled, as it doesn't understand the url its trying to fetch
is incomplete. I'd be happy to take a look at that, could someone let
me know the proper way to output errors from inside the lib?
Thanks,
Ian Hummel
--- nanohttp.c 2004-03-22 15:54:58.000000000 +0100
+++ nanohttp2.c 2004-03-31 16:07:25.000000000 +0200
@@ -840,7 +840,13 @@
while ((*cur == ' ') || (*cur == '\t')) cur++;
if (ctxt->location != NULL)
xmlFree(ctxt->location);
- ctxt->location = xmlMemStrdup(cur);
+ if (*cur == '/') {
+ xmlChar *tmp_http = xmlStrdup ("http://");
+ xmlChar *tmp_loc = xmlStrcat (tmp_http, BAD_CAST ctxt->hostname);
+ ctxt->location = (char *) xmlStrcat (tmp_loc, cur);
+ } else {
+ ctxt->location = xmlMemStrdup(cur);
+ }
} else if (!xmlStrncasecmp(BAD_CAST line, BAD_CAST"WWW-Authenticate:", 17)) {
cur += 17;
while ((*cur == ' ') || (*cur == '\t')) cur++;
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]