Hi Again,
It's Satook. I forgot my password and for whatever reason I never put an email address in there. I came accross this issue again, but this time with dotNet 3.5. I did a bit more digging this time and thought you'd like to know what I found. Here is a URL I put in Firefox and what it appeared as in whireshark and in dream 1.5.7 running on different versions of dotNet:
Firefox: "http://crlx113798:8081/insurance%20line/poop%2Fhat"
Wireshark: "http://crlx113798:8081/insurance%20line/poop%2Fhat"
Dream 1.5.7 dotNet 2.0: httpContext.Request.URi.OriginalString: "http://crlx113798:8081/insurance%20line/poop%2fhat"
Dream 1.5.7 dotNet 2.0 sp1: httpContext.Request.URL.OriginalString: "http://crlx113798:8081/insurance line/poop/hat"
Dream 1.5.7 dotNet 2.0 sp2: httpContext.Request.URL.OriginalString: "http://crlx113798:8081/insurance line/poop/hat"
Dream 1.5.7 dotNet 3.5: httpContext.Request.URL.OriginalString: "http://crlx113798:8081/insurance line/poop/hat"
The httpContext.Request.URL I'm refering to mindtouch.core.httptransport class line 161 where the RequestHander method does it's thing.
The from 2.0 SP1 onwards, the URL property is returning the incorrect OriginalString value. This means that the XUri dream class is getting the decoded version of the URL string and thus spaces cause it to fail. Worse, if you put a %2F in the path then it gets interpretted as a segment seperator. I changed the code that contructs the XUri object to instead hand over the raw URL, which I composed as follows:
Code:
string rawURL = string.Format("{0}://{1}{2}", httpContext.Request.Url.Scheme, httpContext.Request.UserHostName, httpContext.Request.RawUrl);
If I hand this in to XUri, it gets a correct, undecoded string for the URL and everything works as intended.
Note: I ran dream 1.5.7 on Visual Studio 2005 for the dotNet 2.0/sp1/sp2 tests and on VS2008 for the dotNet 3.5 tests.
I also checked the 1.6.0 version of dream and the error is still present, as you're still constructing the XUri object using the HttpListenerRequest.URL.OriginalString property, which is decoded. Seems like MS made a breaking change in how HttpListenerRequest constructs it's URL object and never noticed. It sure isn't given the raw URL, as when I tested doing this myself the OriginalString property was correct.
Cheers