Re: [Haskell-cafe] Hack (web) and apache configuration

2009-06-25 Thread Anton van Straaten

Henry Laxen wrote:

I have tried several things, the most recent being:

RewriteEngine on
RewriteRule ^/(.*)$ /hackTest?input=$1 [T=application/x-httpd-cgi]

SetHandler fastcgi-script
Options ExecCGI FollowSymLinks


but the pathInfo field is always null.  


Path info is path-like data that directly follows the name of the 
resource being referenced, e.g.: /myfiles/foo.html/this/is/path/info


A rule that would give you path info in the case you describe would be 
more like this:


  RewriteRule ^/(.*)$ /hackTest/$1 [T=application/x-httpd-cgi]

Whether that works depends on how /hackTest is being dispatched, but if 
Hack expects pathinfo, then it may just work.


Anton

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Hack (web) and apache configuration

2009-06-25 Thread Henry Laxen
Dear Group,

I am posting this here even though it probably belongs on the
apache list because I suspect other haskell users will be able to
find it here more easily.  I am playing around with hack, and am
having trouble with configuring apache with fastcgi to make
things work.  My understanding of the "hack" concept is that it
provides a stardardized interface that lets you glue together
web "Applications".  It also provides several front-ends, such as
happs, and fastcgi etc.  Now based on looking at the Middleware
supplied with hack, it seems to be trying to dispatch based on
the contents of the pathInfo field of the Env record.  So, my
question is, how do we configure Apache2 with the fastcgi handler
so that something appears in the pathInfo field?

I have tried several things, the most recent being:

RewriteEngine on
RewriteRule ^/(.*)$ /hackTest?input=$1 [T=application/x-httpd-cgi]

SetHandler fastcgi-script
Options ExecCGI FollowSymLinks


but the pathInfo field is always null.  

Env {requestMethod = GET, scriptName = "/lambda", pathInfo = "", 
queryString = "input=lambda", serverName = "127.0.0.1", serverPort = 80, 
http = [("FCGI_ROLE","RESPONDER"),("SCRIPT_URL","/lambda"),
("SCRIPT_URI","http://127.0.0.1/lambda";),("User-Agent","curl/7.18.2 
(x86_64-pc-linux-gnu) libcurl/7.18.2 OpenSSL/0.9.8g zlib/1.2.3.3 libidn/1.8
libssh2/0.18"),
("Host","127.0.0.1"),("Accept","*/*"),("PATH","/usr/local/bin:/usr/bin:/bin"),
("SERVER_SIGNATURE","Apache/2.2.9 (Debian) mod_fastcgi/2.4.6
proxy_html/3.0.0 mod_apreq2-20051231/2.6.0 mod_perl/2.0.4 Perl/v5.10.0 Server at
127.0.0.1 Port 80\n"),
("SERVER_SOFTWARE","Apache/2.2.9 (Debian) mod_fastcgi/2.4.6 proxy_html/3.0.0
mod_apreq2-20051231/2.6.0 mod_perl/2.0.4 Perl/v5.10.0"),
("SERVER_NAME","127.0.0.1"),("SERVER_ADDR","127.0.0.1"),
("SERVER_PORT","80"),("REMOTE_ADDR","127.0.0.1"),
("DOCUMENT_ROOT","/home/henry/maztrave2/www/fcgi"),
("SERVER_ADMIN","[no address given]"),
("SCRIPT_FILENAME","/home/henry/maztrave2/www/fcgi/hackTest"),
("REMOTE_PORT","44936"),
("GATEWAY_INTERFACE","CGI/1.1"),("SERVER_PROTOCOL","HTTP/1.1"),
("REQUEST_METHOD","GET"),("QUERY_STRING","input=lambda"),
("REQUEST_URI","/lambda"),("SCRIPT_NAME","/lambda")], 
hackVersion = [2009,5,19], hackUrlScheme = HTTP, hackInput = Empty, hackErrors =
HackErrors, hackHeaders = []}% 


I think what I want is to have all URLS, such as:

http://127.0.0.1/lambda

be dispatched though my hackTest executable, without having to go
through the rewrite, but I can't convice apache to do that.  In
the interest of completeness, my hackTest.hs file is the
following:

import Hack
import Hack.Handler.FastCGI
import Data.ByteString.Lazy.Char8 (pack)
import Hack.Contrib.Middleware.Lambda

app :: Application
app = \env ->   return $ Response
{ status  = 200
, headers = [ ("Content-Type", "text/plain") ]
, body= pack $ show env
}

main = runFastCGIorCGI $ lambda app

--

One final comment to the authors of hack.  Would you please
consider renaming this project.  hack is such a common word that
has nothing to do with this project that it make searching the
web with google, etc. almost useless.  I realize it is a clever
respelling of the ruby version "rack", but please consider naming
it something more unique, while it is still relatively new on the
web.

Thanks in advance for your help.
Best wishes,
Henry Laxen


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe