[Mono-dev] [PATCH] MVC on FastCGI produces NotImplementedException

Tiaan tagdev at gmail.com
Thu Oct 22 14:37:41 EDT 2009


The attached patch files are to fix a bug when hosting an MVC 1.0 website on
Mono 2.4.2.3 (and XSP 2.4.2) in combination with a FastCGI setup on the web
server.

 

The problem was initially reported on 5 August 2009 by Sergii Volchkov (see
http://www.mail-archive.com/mono-list@lists.ximian.com/msg30411.html titled
"MVC site on fastcgi + nginx produces NotImplementedException in
System.Web.Routing.Route.GetRouteData unless PATH_INFO is specified").
However, a similar problem is also encountered with Apache when using a
FastCGI setup (for example with mod_fastcgi).

 

The issue seems to arise from the override method implementation in
Mono.WebServer.FastCgi.WorkerRequest.GetPathInfo, which can sometimes return
null (although this should perhaps not be a valid return value).  Looking at
the base implementation in System.Web.HttpWorkerRequest.GetPathInfo (and the
MSDN documentation for the System.Web.HttpRequest.PathInfo property), this
virtual method should maybe rather return String.Empty for the undefined
case.  Also, it may be better if System.Web.Routing.Route.GetRouteData is
more forgiving about acceptable values and should perhaps also allow null
strings to pass through (since it doesn't actually use the pathInfo variable
anyway).  The System.Web.HttpRequest.PathInfo property's implementation
should perhaps also never allow null to be returned (this one may be the
most essential change).  The three above-mentioned changes are illustrated
in the three patch files.

 

Perhaps one should also review the rest of the FastCGI code for similar
scenarios when parameters are not defined, if they should instead also be
returning empty strings.

 

Could someone please review/commit the patches to both version 2.6 and the
trunk?

 

Thanks!

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20091022/895362d5/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Mono.WebServer.FastCgi.diff
Type: application/octet-stream
Size: 397 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20091022/895362d5/attachment.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: System.Web.diff
Type: application/octet-stream
Size: 419 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20091022/895362d5/attachment-0001.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: System.Web.Routing.diff
Type: application/octet-stream
Size: 482 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20091022/895362d5/attachment-0002.obj 


More information about the Mono-devel-list mailing list