added space for port number (when not 80) in xmlNanoHTTPMethodRedir, plus
* nanohttp.c: added space for port number (when not 80) in
xmlNanoHTTPMethodRedir, plus a few more comments. Should
fix #514521.
svn path=/trunk/; revision=3685
diff --git a/ChangeLog b/ChangeLog
index 0131173..7d0649c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Wed Feb 6 12:10:08 HKT 2008 William Brack <wbrack@mmm.com.hk>
+
+ * nanohttp.c: added space for port number (when not 80) in
+ xmlNanoHTTPMethodRedir, plus a few more comments. Should
+ fix #514521.
+
Tue Feb 5 09:41:46 CET 2008 Daniel Veillard <daniel@veillard.com>
* schemas.c: apply fix suggested by Ashwin correcting a cut-n-paste
diff --git a/nanohttp.c b/nanohttp.c
index 91c7e87..07829c7 100644
--- a/nanohttp.c
+++ b/nanohttp.c
@@ -1332,13 +1332,23 @@
if (headers != NULL)
blen += strlen(headers) + 2;
if (contentType && *contentType)
+ /* reserve for string plus 'Content-Type: \r\n" */
blen += strlen(*contentType) + 16;
if (ctxt->query != NULL)
+ /* 1 for '?' */
blen += strlen(ctxt->query) + 1;
blen += strlen(method) + strlen(ctxt->path) + 24;
#ifdef HAVE_ZLIB_H
+ /* reserve for possible 'Accept-Encoding: gzip' string */
blen += 23;
#endif
+ if (ctxt->port != 80) {
+ /* reserve space for ':xxxxx', incl. potential proxy */
+ if (proxy)
+ blen += 12;
+ else
+ blen += 6;
+ }
bp = (char*)xmlMallocAtomic(blen);
if ( bp == NULL ) {
xmlNanoHTTPFreeCtxt( ctxt );