|Summary:||HttpListener's scheme parser is case sensitive|
|Product:||[Mono] Class Libraries||Reporter:||Valery Dachev <xamarin.com>|
|Component:||System||Assignee:||Marek Safar <masafa>|
|Tags:||Is this bug a regression?:||---|
|Last known good build:|
|Attachments:||A demo program|
Description Valery Dachev 2015-02-09 07:57:09 UTC
According to RFC 3986 (http://tools.ietf.org/html/rfc3986#section-3.1) scheme in URL should be case insensitive. However, HttpListener doesn't seem to transform URLs in their canonical form and that leads to broken handling of some (broken) HTTP requests. The attached example server is sent a request and should produce a response with status code 20 containing the raw URL of the request. a) if a request is made to "http://localhost:9999/", the response is: === snip = snip = snip === --> GET Http://localhost:9999/ HTTP/1.0 --> <-- HTTP/1.1 200 OK <-- Server: Mono-HTTPAPI/1.0 <-- Date: Mon, 09 Feb 2015 12:38:59 GMT <-- Connection: close http://localhost:9999/ === snip = snip = snip === b) if a request is made to "Http://localhost:9999/" (notice the scheme case?), the response should be the same as a), but instead: === snip = snip = snip === --> GET Http://localhost:9999/ HTTP/1.0 --> <-- HTTP/1.1 400 Bad Request <-- Content-Type: text/html; charset=utf-8 <-- Server: Mono-HTTPAPI/1.0 <-- Date: Mon, 09 Feb 2015 12:38:45 GMT <-- Content-Length: 79 <-- Connection: close <-- <-- <h1>Bad Request (Invalid url: http://127.0.0.1:9999Http://localhost:9999/)</h1> === snip = snip = snip === *** NOTE: The behavior of Microsoft's .NET Framework 4.5 is correct. However, NHttp (https://www.nuget.org/packages/NHttp/0.1.6) has just the same bug.
Comment 2 Valery Dachev 2015-02-11 10:47:03 UTC
I've tested it on Ubuntu - both original 3.2.8 from both the Ubuntu Utopic repository and 3.12.0 from the Mono repository for Debian Wheezy.
Comment 3 Marek Safar 2015-02-18 11:01:39 UTC
I cannot reproduce it with Mono master. I tested the request using HttpClient and I am not certain it does not do url transformation somewhere down to the stack
Comment 4 Valery Dachev 2015-02-26 06:55:11 UTC
HttpClient might tweak the request and lower-case the schema in the URL, and such a test is therefore unreliable. That's why I tested it with a "telnet". And that's why I reopen the bug.
Comment 5 Marek Safar 2015-03-13 12:42:52 UTC
Fixed in master