GNOME Bugzilla – Bug 469681
document() function not sending port number in Host request header
Last modified: 2007-08-24 03:00:44 UTC
Using libxslt and xsltproc in version 1.1.20 (1.1.20-0ubuntu2, Xubuntu 7.04). Here's what xsltproc says about itself: cbearden@plantinga:~/printing/PrintAll/2007.08.15$ xsltproc --version Using libxml 20627, libxslt 10120 and libexslt 813 xsltproc was compiled against libxml 20627, libxslt 10120 and libexslt 813 libxslt 10120 was compiled against libxml 20627 libexslt 813 was compiled against libxml 20627 When in a stylesheet an XML document is requested with the document() function from a host listening on a port other than 80, the port number is not sent in the Host HTTP header. E.g.: GET /content/m0036/latest/index.cnxml HTTP/1.0 Host: sandbox.cnx.rice.edu Accept-Encoding: gzip Here is the stylesheet that will produce the above result: <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <test> <xsl:copy-of select="document('http://sandbox.cnx.rice.edu:8080/content/m0036/latest/index.cnxml')"/> </test> </xsl:template> </xsl:stylesheet>
Created attachment 94212 [details] Stylesheet that illustrates the bug In my description of the bug I omitted to say explicitly that the URI generating the HTTP headers was http://sandbox.cnx.rice.edu:8080/content/m0036/latest/index.cnxml
Created attachment 94213 [details] libpcap file of HTTP request made with attached stylesheet Shows both the server port 8080 in the packet headers and the Host line in the HTTP headers.
The root cause of problem was actually within libxml2/nanohttp.c. After reviewing RFC2616, I enhanced that code so that (whenever the port is != 80) it includes the port number in the URL on the "Host:" line. For your test, it produces a header of: GET /content/m0036/latest/index.cnxml HTTP/1.0 Host: sandbox.cnx.rice.edu:8080 Accept-Encoding: gzip I think that should be satisfactory. Sorry we just missed the latest libxml2 release, but fixed code (libxml2/nanohttp) is in svn. Thanks for the report.