Re: \ in path (instead of /)

2003-12-29 Thread Christian Kohlschütter
On Monday 22 December 2003 09:23, Ortwin Glück wrote:
 Sam Berlin wrote:
  HttpClient (rc2) currently barfs on addresses that look like:
 
  http://address:port\path\to\some\file.html
 
  It might be worthwhile to allow these slashes to be parsed as if they
  were /'s.

 Why? Sorry, I don't think this sort of URI is defined by any URI RFC
 (teach me better). If you need this for your particular application then
 please write a convertor for it. But this is certainly not something
 that will go into HttpClient.

 Odi

Sam,

some time ago, I have also had to work with such backslashed http-URLs.
My solution was to extend the URI class (see below).

It was a quick hack only, but may suit your needs.
Feel free to use/modify the code in your program (feedback always 
appreciated).

I agree with Odi that working with backslashes in URIs is unwise and that 
support for this should not be included in the HttpClient core (but probably 
in contrib someday)


Christian

/**
 * A non-standards compliant URI supporting unescaped backslashes ('\')
 * and more unwise things
 *
 * @author  Christian Kohlschuetter
 */
public class UnwiseURI extends URI {

public UnwiseURI(String uri) throws URIException {
super(uri, true);
}

public void setRawPath(char[] escapedPath) throws URIException {
if (escapedPath == null || escapedPath.length == 0) {
_opaque = escapedPath;
}

escapedPath = removeFragmentIdentifier(escapedPath);
_path = escapedPath;
setURI();
}

public static void main(String[] args) throws Exception {
System.out.println(new URI(http://www.newsclub.de/foo\\bar;, false));
System.out.println(new UnwiseURI(http://www.newsclub.de/foo\\bar;));
}
}

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: \ in path (instead of /)

2003-12-22 Thread Ortwin Glück
Sam Berlin wrote:
HttpClient (rc2) currently barfs on addresses that look like:

http://address:port\path\to\some\file.html

It might be worthwhile to allow these slashes to be parsed as if they were
/'s.
Why? Sorry, I don't think this sort of URI is defined by any URI RFC 
(teach me better). If you need this for your particular application then 
please write a convertor for it. But this is certainly not something 
that will go into HttpClient.

Odi

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


\ in path (instead of /)

2003-12-20 Thread Sam Berlin
HttpClient (rc2) currently barfs on addresses that look like:

http://address:port\path\to\some\file.html

It might be worthwhile to allow these slashes to be parsed as if they were
/'s.

(Note that I have purposely not used the words forward or backward slash
because I have never been able to figure out which is which.)

Thanks,
 Sam


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: \ in path (instead of /)

2003-12-20 Thread Sven Köhler
http://address:port\path\to\some\file.html

It might be worthwhile to allow these slashes to be parsed as if they were
/'s.
such URLs are totally invalid in my eyes. it's nice that some browsers 
accept them, but i wouldn't care if HttpClient doesn't. Additional it's 
farely easy to replace them by yourself.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]