GNOME Bugzilla – Bug 303068
document() function does not load xml file via ftp
Last modified: 2021-07-05 10:59:53 UTC
Please describe the problem: When using the document function in xslt and giving a URL such as: document('ftp://ftp.foo.com/test.xml') for anonymous ftp or document('ftp://user:pass@ftp.foo.com/test.xml') gives the error: warning: failed to load external entity "ftp://ftp.foo.com/test.xml" Permissions heve been checked and loads under IE msxml. Works fine if http:// Steps to reproduce: 1. Load external document using select="document('ftp://....')" 2. 3. Actual results: Returns warning: failed to load external entity "ftp://...." Expected results: Loads xml document into tree Does this happen every time? Yes Other information:
Could you provide a test script that exhibits the problem? http://www.xmlsoft.org/bugs.html
Created attachment 46060 [details] xslt stylesheet I found some additional details. Attached are x.xml and x.xsl for test case. Note the ftp address value for TITAN storms in x.xml. If the address is NOT surrounded by single quotes you get the Unknown IO error. If the address is surrounded by single quotes yon do not get the error message but the document still does not load. Note the http address for Radar works fine without the single quotes but throws an error if you add them.
Created attachment 46061 [details] xml file
The FTP server on ftp.rap.ucar.edu seems incompatible with libxml2 nanoftp implementation. Other FTP servers like vsftpd do work fine: paphio:~/XML -> xmllint ftp://fr.rpmfind.net/pub/veillard/tst.xml <?xml version="1.0"?> <doc/> paphio:~/XML -> xmllint ftp://ftp.rap.ucar.edu/pub/titan-cart/TitanCart.xml error : Unknown IO error warning: failed to load external entity "ftp://ftp.rap.ucar.edu/pub/titan-cart/TitanCart.xml" paphio:~/XML -> and strace xmllint ftp://ftp.rap.ucar.edu/pub/titan-cart/TitanCart.xml shows the sequence socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 3 connect(3, {sa_family=AF_INET, sin_port=htons(21), sin_addr=inet_addr("128.117.192.211")}, 16) = 0 recv(3, "220-\r\n", 512, 0) = 6 recv(3, "220- *** National Cent"..., 506, 0) = 506 send(3, "USER anonymous\r\n", 16, 0) = 16 recv(3, "-\r\n220- The local time is: Thu "..., 512, 0) = 447 socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 4 send(3, "PASV\r\n", 6, 0) = 6 recv(3, "331 Guest login ok, send your co"..., 512, 0) = 68 close(4) = 0 write(2, "error : ", 8error : ) = 8 write(2, "Unknown IO error\n", 17Unknown IO error ) = 17 close(3) There is something in this given FTP server answer 331 which breaks libxml2 FTP implementation. From a direct ftp session it's unclear: paphio:~/XML -> ftp ftp.rap.ucar.edu Connected to ftp.rap.ucar.edu (128.117.192.211). 220- 220- *** National Center for Atmospheric Research *** 220- *** Research Applications Program *** 220- 220- *** Use of this system for unauthorized purposes is a *** 220- *** violation of federal law. See Public Law 99-474. *** 220- *** Any activity may be logged and monitored. By *** 220- *** using this system, you consent to such logging and *** 220- *** monitoring. *** 220- 220- The local time is: Thu May 5 09:16:03 2005 220- 220- If you have problems logging in, please try using a dash (-) as the 220- first character of your password--this will turn off the continuation 220- messages that may be confusing your ftp client. 220- 220- If you have unusual problems, please contact: ftpadmin@rap.ucar.edu 220- 220 weave.rap.ucar.edu FTP server (Version wu-2.6.2(1) Mon Mar 28 19:08:01 UTC 2005) ready. Name (ftp.rap.ucar.edu:veillard): anonymous 331 Guest login ok, send your complete e-mail address as password. Password: FTP compatibility is harder to provide than HTTP, that's well-known. I take patches, I may look for the problem but I don't consider this very urgent at the moment, Daniel
In looking at the strace is is possible the first 220 (FTP_COMMAND_OK) response is causing libxml2 to send the username:password too quickly? I see the line send(3, "PASV\r\n", 6, 0) = 6 is sent before the request for a password. Thanks Bruce
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org. As part of that, we are mass-closing older open tickets in bugzilla.gnome.org which have not seen updates for a longer time (resources are unfortunately quite limited so not every ticket can get handled). If you can still reproduce the situation described in this ticket in a recent and supported software version, then please follow https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines and create a new ticket at https://gitlab.gnome.org/GNOME/libxslt/-/issues/ Thank you for your understanding and your help.