%09 in a URL causes IIS (HTTP.SYS?) to return HTTP 400 immediately

☆樱花仙子☆ 提交于 2019-12-22 11:12:57

问题


I've discovered that IIS7, 7.5 and 8 (and probably previous versions too) will fail-fast when encountering any URL that contains %09 that is not part of a querystring.

StackOverflow itself exhibits the same behavior, observe:

http://www.stackoverflow.com/questions/%09

This is annoying for my application because I have built a web-service which should return text/xml for every request, even invalid ones, containing a specific XML document format containing error codes. I've found that some webservice clients pass the %09 (often caused by a user copying and pasting) to my service, but my server returns an ugly HTML response that seems hard-coded into HTTP.SYS (I overrode the HTTP 400 error response in IIS, but it has no effect).

Bad Request - Invalid URL

HTTP Error 400. The request URL is invalid.

Is there any workaround or solution for this?

Memorandum:

For comparison:

  • Google serves a HTTP 404 correctly: https://www.google.com/%09
  • Apache seems to let MediaWiki handle the error: http://en.wikipedia.org/wiki/Foo%09
  • IIS doesn't: http://microsoft.com/download/%09

来源:https://stackoverflow.com/questions/19534080/09-in-a-url-causes-iis-http-sys-to-return-http-400-immediately

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!