[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Specifically, QUERY_STRING (WAS: RE: Pi3Perl - how to pass

Note that Pi3Perl is alpha, and it might be easier just to use
CGI, but if you really want to use Pi3Perl, then....
> >
> > Toni Harbaugh-Blackford schrieb:
> > > 
> > > Folks-
> > > 
> > > I just picked the 'development' versions of Pi3Web and Pi3Perl, and
> > > implemented the sample hello.pl program to test the basic setup.  But
> > ^^^^
> > Hi, first a question (Sorry): Is there a sample configuration file shipped
> > with Pi3Perl? I just started with it and in vain looked for a working sample
> > configuration. Did I overlook something?
> No, I was not clear.  I just read the top of hello.pl and tried the suggestion
> to add a 'Handle Pi3WebPerl...' line.  I had to modify it with a 'Condition',
> though, otherwise *all* my files ended up saying 'Hello, World'.  ;-D
> >
> > > now I would like to be able to access a Pi3Perl script's environment
> > > via %ENV, and with the sample setup no environment variables are passed.
> > ^^^^
> > I'm also very new with Pi3Perl. So far as I know the embedded Perl interpreter
> > means that you can access the PIAPI's directly. But I think that you can use
> > the example how to access  server-variables (the common CGI-environment is just
> > copy of selected server variables). When you look into the auth.pl example,
> > you'll find how to lookup the field "Authorization" in the request-database.
> > Some more additional info you'll find in the server documentation too
> > (http://localhost/pidocs/)
> >
> Ok, but how do I get the equivalent of the CGI 'QUERY_STRING' variable from
> the request-database?  I am not familiar with the format of the HTTP request
> header; which header line contains this information?  Basically, what string
> do I pass to PIDB_lookup instead of "Authorization"?
You would use "QueryString", and the DB type is 'string' (rfc822 is
only use to store headers to and from the browser), i.e.

	my( $qs );
    Pi3::PIDB_lookup( $qs, $request_db, &Pi3::PIDBTYPE_STRING, "QueryString",
        &Pi3::PIDBFLAG_NONE );
	# $qs now contains the query string for this request.

> > > 
> > > Does someone have a Config file example for passing the environment to a
> > > Pi3Perl script?  If not, does the 'Pi3WebPerl' object support parameters
> > > like "IncludeParentsEnvironment", "EnvironmentSize", "Variable", etc.,
> > > as in the 'StandardCGI' object description?
> > ^^^^
> >Don't know the configuration of the Pi3WebPerl-object at this time, sorry.
> >But I think this is not your current problem. I think Pi3Perl needs another
> >approach than you got used to with standard CGI. (Correct English?)
You can read 'configuration' values for the Pi3WebPerl handler - see
the example auth.pl where $AuthFile and $Realm are read from the configuration
file config.pi3

> Ok, I think I understand now.  Can someone point me to a good description
> of how to bread down HTTP request-headers in terms of CGI?
Not sure I get the question, let me know. I've attached an HTML
dump of variables and types that can be used with PIDB_lookup
at the end of this message. The CGI handler uses PIDB_lookup to
create the environment block. The example is the output from
a test of features.pi3.


Pi3Expressions - DB Dump
Connection DB 
Request DB 
Response DB 
Host DB 


Dump of Connection DB dblookup(connection,...)
Type Variable Value  
String RemoteAddr  
String RemoteHost localhost  
String LocalAddr  
Opaque RecvTimeout 60  
Opaque SendTimeout 45  
Opaque KeepOpen 1  
Dump of Request DB dblookup(request,...)
Type Variable Value  
String CLF GET /Pi3Expressions/dummy+file/path+info?1,2 HTTP/1.1  
String Method GET  
String URI /Pi3Expressions/dummy+file/path+info  
String QueryString 1,2  
String Protocol HTTP/1.1  
Rfc822 Accept application/vnd.ms-excel, application/msword, application/vnd.ms-powerpoint, image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*  
Rfc822 Referer http://localhost/pidocs/Features/  
Rfc822 Accept-Language en-us  
Rfc822 Accept-Encoding gzip, deflate  
Rfc822 User-Agent Mozilla/4.0 (compatible; MSIE 4.01; Windows NT)  
Rfc822 Host localhost  
Rfc822 Connection Keep-Alive  
Opaque Method 1  
Opaque Protocol 3  
Dump of Response DB dblookup(response,...)
Type Variable Value  
String Path C:\Pi3Web\**internal**\dummy+file  
String PathInfo /path+info  
String PathTranslated C:\Pi3Web\WebRoot\path+info  
String ScriptName /Pi3Expressions/dummy+file  
String ObjectMap Pi3Expr  
Dump of Host DB dblookup(host,...)
Type Variable Value  
Rfc822 ObjectName MainVirtualHostInformation  
Rfc822 Administrator webmaster@localhost  
Rfc822 HostName localhost