From: Hungerburg <pc...@my...> - 2011-12-23 14:06:12
|
I did report a bug, that on line 362 of src/org/exist/http/RESTServer.java the class URLDecoder is used to decode a path component of an URI, which is wrong. I have now swapped the decoder and instrumented the build. A file "b+b.xml" uploaded through webdav can now be fetched by the same name from the rest servlet, and also by its encoded name "b%2Bb.xml". Still no joy from webdav though. Below some tests with different requests and the patch used: - the string to be decoded - the decoded string - reencoded by xmldburi 2011-12-23 14:37:52,194 [eXistThread-22] INFO (RESTServer.java [doGet]:365) - /db/plus/b+b.xml 2011-12-23 14:37:52,194 [eXistThread-22] INFO (RESTServer.java [doGet]:367) - /db/plus/b+b.xml 2011-12-23 14:37:52,194 [eXistThread-22] INFO (RESTServer.java [doGet]:373) - /db/plus/b+b.xml 2011-12-23 14:38:52,272 [eXistThread-22] INFO (RESTServer.java [doGet]:365) - /db/plus/b%2Bb.xml 2011-12-23 14:38:52,272 [eXistThread-22] INFO (RESTServer.java [doGet]:367) - /db/plus/b+b.xml 2011-12-23 14:38:52,272 [eXistThread-22] INFO (RESTServer.java [doGet]:373) - /db/plus/b+b.xml 2011-12-23 14:38:25,726 [eXistThread-28] INFO (RESTServer.java [doGet]:365) - /db/plus/b%20b.xml 2011-12-23 14:38:25,727 [eXistThread-28] INFO (RESTServer.java [doGet]:367) - /db/plus/b b.xml 2011-12-23 14:38:25,727 [eXistThread-28] INFO (RESTServer.java [doGet]:373) - /db/plus/b%20b.xml 2011-12-23 14:50:46,425 [eXistThread-28] INFO (RESTServer.java [doGet]:363) - /db/plus/a%252Ba.xml 2011-12-23 14:50:46,426 [eXistThread-28] INFO (RESTServer.java [doGet]:365) - /db/plus/a%2Ba.xml 2011-12-23 14:50:46,426 [eXistThread-28] INFO (RESTServer.java [doGet]:371) - /db/plus/a%2Ba.xml 2011-12-23 14:48:50,325 [eXistThread-27] INFO (RESTServer.java [doGet]:363) - /db/plus/b%25b.xml 2011-12-23 14:48:50,325 [eXistThread-27] INFO (RESTServer.java [doGet]:365) - /db/plus/b%b.xml 2011-12-23 14:48:50,327 [eXistThread-27] ERROR (EXistServlet.java [doGet]:366) - Invalid URI: Malformed escape pair at index 10: /db/plus/b%b.xml A request for a%a.txt from the browser will not log anything. maybe jetty takes on that one, by producing a blank page... Index: src/org/exist/http/RESTServer.java =================================================================== --- src/org/exist/http/RESTServer.java (revision 15596) +++ src/org/exist/http/RESTServer.java (working copy) @@ -32,7 +32,7 @@ import java.io.StringWriter; import java.io.Writer; import java.net.URI; -import java.net.URLDecoder; +import java.net.URISyntaxException; import java.util.ArrayList; import java.util.Date; import java.util.Iterator; @@ -359,8 +359,17 @@ } // Process the request DocumentImpl resource = null; - XmldbURI pathUri = XmldbURI.create( URLDecoder.decode( path , "UTF-8" ) ); + XmldbURI pathUri = null; + LOG.info(path); try { + LOG.info ( new URI( path ).getPath() ); + pathUri = XmldbURI.create( new URI( path ).getPath() ); + } catch (URISyntaxException e) { + if (LOG.isDebugEnabled()) + LOG.debug(e.getMessage(), e); + } + LOG.info(pathUri); + try { // check if path leads to an XQuery resource String xquery_mime_type = MimeType.XQUERY_TYPE.getName(); String xproc_mime_type = MimeType.XPROC_TYPE.getName(); |