{"action":"closed","issue":{"url":"https://api.github.com/repos/Bilal-S/iis2tomcat/issues/8","labels_url":"https://api.github.com/repos/Bilal-S/iis2tomcat/issues/8/labels{/name}","comments_url":"https://api.github.com/repos/Bilal-S/iis2tomcat/issues/8/comments","events_url":"https://api.github.com/repos/Bilal-S/iis2tomcat/issues/8/events","html_url":"https://github.com/Bilal-S/iis2tomcat/issues/8","id":22855569,"number":8,"title":"URL containing : in path causes NotSupportedException","user":{"login":"olivierdagenais","id":297515,"avatar_url":"https://avatars.githubusercontent.com/u/297515?v=3","gravatar_id":"","url":"https://api.github.com/users/olivierdagenais","html_url":"https://github.com/olivierdagenais","followers_url":"https://api.github.com/users/olivierdagenais/followers","following_url":"https://api.github.com/users/olivierdagenais/following{/other_user}","gists_url":"https://api.github.com/users/olivierdagenais/gists{/gist_id}","starred_url":"https://api.github.com/users/olivierdagenais/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/olivierdagenais/subscriptions","organizations_url":"https://api.github.com/users/olivierdagenais/orgs","repos_url":"https://api.github.com/users/olivierdagenais/repos","events_url":"https://api.github.com/users/olivierdagenais/events{/privacy}","received_events_url":"https://api.github.com/users/olivierdagenais/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2013-11-18T18:05:16Z","updated_at":"2015-04-17T18:40:48Z","closed_at":"2015-04-17T18:40:48Z","body":"Steps to reproduce\r\n--------------------\r\n 1. Deploy a web app that encodes parameters in a virtual path, such as [GitBucket](https://github.com/takezoe/gitbucket).\r\n 2. Access a URL containing `:`, such as GitBucket's pull request URLs that look like `http://server/gitbucket/user/project/group:master...master`\r\n\r\nExpected behaviour\r\n--------------------\r\nThe page is rendered just like when hitting Tomcat directly.\r\n\r\nActual behaviour\r\n----------------\r\n\"Yellow screen of death\":\r\n```\r\nServer Error in '/' Application.\r\n\r\nThe given path's format is not supported.\r\n\r\nDescription: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. \r\n\r\nException Details: System.NotSupportedException: The given path's format is not supported.\r\n\r\nSource Error: \r\n\r\nAn unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.\r\n\r\nStack Trace: \r\n\r\n\r\n[NotSupportedException: The given path's format is not supported.]\r\n   System.Security.Util.StringExpressionSet.CanonicalizePath(String path, Boolean needFullPath) +14424837\r\n   System.Security.Util.StringExpressionSet.CreateListFromExpressions(String[] str, Boolean needFullPath) +323\r\n   System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList) +151\r\n   System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList) +38\r\n   System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess access, String path) +92\r\n   System.Web.HttpRequest.get_PhysicalPath() +77\r\n   BonCodeIIS.BonCodeCallHandler.ProcessRequest(HttpContext context) +419\r\n   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +913\r\n   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +165\r\n```\r\n\r\nCause\r\n------\r\nBonCodeIIS/CallHandler.cs(119) reads:\r\n`BonCodeAJP13Settings.BonCodeAjp13_PhysicalFilePath = context.Request.PhysicalPath;`\r\n...and ASP.NET tries to parse the `:` in the path portion of the URL as a Windows path character.\r\n\r\nAnalysis\r\n--------\r\nIt appears the `BonCodeAjp13_PhysicalFilePath` global mutable variable (!) is only used by the `ServerPath()` method in `BonCodeAJP13.BonCodeAJP13ServerConnection`, which itself is only called by the `AnalyzePackage()` method when dealing with a ColdFusion request.  It looks like this was introduced as part of the [version 1.0.9 changes](https://github.com/Bilal-S/iis2tomcat/commit/18a3a64c3e0d4f9b42222b2b8f45e8bd7e1ae3e7) and [was almost implemented in terms of a call to `HttpContext.Current`](https://github.com/Bilal-S/iis2tomcat/commit/18a3a64c3e0d4f9b42222b2b8f45e8bd7e1ae3e7#diff-46667ab4add08d5747f8e15cd14bcc53R868).\r\n\r\nI have never written any ColdFusion code, so I'm weary of touching that part of the code since I wouldn't be able to test it.  Would it be possible to call `HttpContext.Current.Request.PhysicalPath` instead of `BonCodeAJP13Settings.BonCodeAjp13_PhysicalFilePath` in `ServerPath()`?\r\n\r\nAnother option would be to detect whether the value of `PhysicalPath` needs to be retrieved in `ProcessRequest()`, by either detecting the type of request or through a `AddColdFusionSupport` configuration option of some sort.\r\n\r\nOption number 3 is to surround the call to `PhysicalPath` in a try..catch and ignore the `NotSupportedException`; the global variable would then be empty."}}