[Ur] mod_fcgid and Ur/Web

Edward Z. Yang ezyang at MIT.EDU
Sat May 5 04:46:04 EDT 2012


Additionally, the 'prefix' option (described for cgi) sort of
works: it makes paths become routable, but also uglifies
all of the URLs in the application.

E.g.

    prefix /logitext.fcgi/

lets me view the app from /logitext.fcgi/, and also mod rewrite to
that URL, but the URIs the application generates always have this
prefix even though Apache is doing extra routing.

Edward

Excerpts from Edward Z. Yang's message of Thu May 03 12:19:28 -0400 2012:
> To be more concrete, this patch makes routing work:
> 
> diff -r 5b678adda1c9 src/c/fastcgi.c
> --- a/src/c/fastcgi.c   Wed May 02 17:17:57 2012 -0400
> +++ b/src/c/fastcgi.c   Thu May 03 12:18:54 2012 -0400
> @@ -327,8 +327,6 @@
>    headers hs;
>    size_t body_size = 0;
>    char *body = malloc(0);
> -  size_t path_size = 0;
> -  char *path_buf = malloc(0);
>  
>    hs.uppercased = malloc(0);
>    hs.uppercased_len = 0;
> @@ -459,16 +457,7 @@
>      }
>  
>      if ((path_info = search_nvps(hs.nvps, "PATH_INFO"))) {
> -      int len1 = strlen(path), len2 = strlen(path_info);
> -      int len = len1 + len2 + 1;
> -
> -      if (len > path_size) {
> -        path_size = len;
> -        path_buf = realloc(path_buf, path_size);
> -      }
> -
> -      sprintf(path_buf, "%s%s", path, path_info);
> -      path = path_buf;
> +      path = path_info;
>      }
> 
> Excerpts from Edward Z. Yang's message of Thu May 03 11:03:42 -0400 2012:
> > Because you're using the FastCgiServer directive, you are using
> > mod_fastcgi, *not* mod_fcgid. (This directive is only available
> > for the former.  Also, it is not a valid directive in .htaccess)
> > It would be a godo thing to have a story for mod_fcgid, since
> > it is the "real" FastCGI module endorsed by Apache.
> > 
> > Getting the web server to pass exactly the right path format
> > is exactly the problem here.  The convention for FastCGI deployment
> > is that you setup some mod_rewrite rules which rewrite:
> > 
> >     /internal/path
> > 
> > to
> > 
> >     /script.fcgi/internal/path
> > 
> > The FastCGI itself sees the second path, and essentially every
> > other FastCGI application knows that it should refer to PATH_INFO
> > (which is equal to /internal/path) not REQUEST_URI (which is
> > /scripts.fcgi/internal/path) for routing.
> > 
> > Edward
> > 
> > Excerpts from Adam Chlipala's message of Thu May 03 10:39:06 -0400 2012:
> > > Edward Z. Yang wrote:
> > > > Has anyone on this list gotten Ur/Web to work with mod_fcgid,
> > > > using only .htaccess available directives?  (I keep getting
> > > > 404 errors in the error log, even when I try rewriting
> > > > the paths.)
> > > 
> > > I run all the demos on www.impredicative.com using FastCGI in Apache, 
> > > though I don't remember which module I'm using.  It's the one that adds 
> > > the 'FastCgiServer' directive, and the manual documents how to make such 
> > > things work.
> > > 
> > > Getting things to work properly with an arbitrary module shouldn't be 
> > > complicated.  You just have to get the web server to pass the 
> > > application URI's in exactly the format it would get if you had compiled 
> > > a standalone web server.
> > > 
> > > If you can point to a small set of short source and configuration files 
> > > that illustrates the problem, I may be able to offer more specific advice.
> > > 
> > 



More information about the Ur mailing list