After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 469681 - document() function not sending port number in Host request header
document() function not sending port number in Host request header
Status: RESOLVED FIXED
Product: libxslt
Classification: Platform
Component: general
1.1.20
Other Linux
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2007-08-23 18:33 UTC by Chuck Bearden
Modified: 2007-08-24 03:00 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Stylesheet that illustrates the bug (375 bytes, application/xml)
2007-08-23 19:22 UTC, Chuck Bearden
Details
libpcap file of HTTP request made with attached stylesheet (39.39 KB, application/cap)
2007-08-23 19:25 UTC, Chuck Bearden
Details

Description Chuck Bearden 2007-08-23 18:33:35 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>
Comment 1 Chuck Bearden 2007-08-23 19:22:15 UTC
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
Comment 2 Chuck Bearden 2007-08-23 19:25:39 UTC
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.
Comment 3 William M. Brack 2007-08-24 03:00:44 UTC
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.