Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: Where does CGI script get HTTP_USER_AGENT and PATH values from?

Re: Where does CGI script get HTTP_USER_AGENT and PATH values from?

From: Terri I. <teresni_at_ucia.gov>
Date: 11 Dec 2001 10:23:17 -0800
Message-ID: <b1f8b3bc.0112111023.3ea37698@posting.google.com>

One more update:
I modified my Java code to display more info about the Java environment on the server. When it displayed the output of System.getProperty("java.class.path"), turns out the classpath is blank! We had set it to the appropriate JRE 1.3 directories, but obviously not everywhere it needs to be set. So it appears that our problem is figuring out in which configuration file(s) the classpath needs to be set.

Manuela Mueller <520040906697-0001_at_t-online.de> wrote in message news:<3C150EAF.7C46BCD9_at_t-online.de>...
> Hi Terri,
> you performed case2, run the script out of command line.
> If you try to perform case1: script resides on apache's directory
> cgi-bin (full path eg /usr/local/apache/cgi-bin, check your specific
> installation, full path may vary!)
>
> example of an URL on my machine:
> http://dog.workgroup:8080/cgi-bin/hash_cgi.pl
>
> you see the complete listing of apache's environment variables:
> <snip>
> HTTP_USER_AGENT: Mozilla/4.76 [en] (X11; U; Linux 2.4.2-2 i686)
> </snip>
> Gives you info about my webbrowser (client, OS, and cpu-type, more info
> than I want any user to see...).
> You have to copy the script in apache's directory cgi-bin to see this
> output.
>
> To answer you original question more specifically: The variable
> HTTP_USER_AGENT is set by apache, in the file httpd.conf.
> This is the main configuration file for apache.
> You find the file in subdir /conf. Full path (remember, may vary as said
> above) /usr/local/apache/conf
> Snippet of a httpd.conf, around line 865, depends on apache-version
> (here: apache 1.3.22):
> <snip>
> # Customize behaviour based on the browser
> #
> <IfModule mod_setenvif.c>
> ...
> #NOTE: THIS CATCHES MY CLIENT (=WEBBBROWSER)
> BrowserMatch "Mozilla/2" nokeepalive
> ...
> #NOTE THE JAVA ENTRY ON NEXT LINE!!!!
> # I assume the two following lines are responsible for
> # your output:
> BrowserMatch "Java/1\.0" force-response-1.0
> BrowserMatch "JDK/1\.0" force-response-1.0
>
> </IfModule>
> </snip>
>
> In your case, your Java application behaves like my webbrowser (means:
> both play the client role).
> You can set/edit your own "Browser match string". Take a look at:
> http://httpd.apache.org/docs/mod/mod_setenvif.html#BrowserMatch
> for further explanations and three examples.
>
> In summary: The file httpd.conf has the relavant info about the client.
> If you have installed the necessary
> software (JDK/JRE), path is set correct... (means you are sure that
> there no other basic problems)
> try to edit the httpd.conf, so webserver apache is informed about your
> software version.
>
> Pleae note: If you are working with https, please search for http*.conf
> (maybe filename is https.conf),
> but I'm not sure about the exact name.
>
> Hope this helps, feel free to send reply, further questions...
> Manuela Mueller
>
>
> "Terri I." wrote:
> >
> > The PERL CGI script that I am connecting to does run the command you
> > suggested - it displays values of all environment variables, as well
> > as output of whoami and id commands. What I'm trying to figure out is
> > where some of those settings (namely the HTTP_USER_AGENT) are being
> > set (i.e., which web server configuration file is setting it).
> >
> > FYI, I am running Oracle 8.1.7 and Apache on SunOS 5.6, on a SunSPARC.
>
>
> >
> > Manuela Mueller <520040906697-0001_at_t-online.de> wrote in message news:<3C12A9D3.169F3BA6_at_t-online.de>...
> > > "Terri I." wrote:
> > > >
> > > > I've got an Oracle application that is launching some Java
> > > > code to connect via https to a CGI script. That CGI script writes a
> > > > file with all environment variables. The HTTP_USER_AGENT value is
> > > > "Java1.2.1", although I've installed the 1.3.1 version of the JDK/JRE
> > > > on the server. I cannot figure out what configuration files (Oracle?
> > > > Apache?) are making the settings that the CGI script then displays.
> > > > Can someone tell me where the web server settings are defined that
> > > > would cause the HTTP_USER_AGENT field to be set to Java1.2.1??
> > > > Because of this, my application will not work properly because it
> > > > requires JDK 1.3. I set the path and classpath for the 'Oracle' user,
> > > > but maybe browser https requests are treated as some other user such
> > > > that the appropriate paths are not being referenced.
> > >
> > >
> > > Hello Terri,
> > > don't know your platform, web server software, if you have perl
> > > installed.
> > > If you have it installed, th following simple script might answer your
> > > question
> > >
> > > #!/usr/bin/perl
> > > # case 1: Program runs via apache, webbrowser is client: show alls
> > > variables for the hash %ENV
> > > # case 2: Program runs simply via command line, shows all settings for
> > > the user
> > > # (like SET command)
> > > print "Content-type: text/html", "\n\n";
> > >
> > > print <<end;
> > > <html>
> > > <head>
> > > <title>ENV</title>
> > > </head>
> > > <body>
> > > <h1>Environment variables of Apache-Servers</h1>
> > > <ul>
> > > end
> > >
> > > foreach $key (sort keys(%ENV)) {
> > > print "<li>$key: $ENV{$key}</li>\n";
> > > }
> > >
> > > print <<end_all;
> > > </ul>
> > > </body>
> > > </html>
> > > end_all
> > >
> > > exit(0);
> > >
> > > Feel free to drop me a line if you have questions baout the script.
> > > Manuela Mueller
> > > PS: I assume it is the web server.
Received on Tue Dec 11 2001 - 12:23:17 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US