HP3000-L Archives

November 1995, Week 4

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Eric Schubert <[log in to unmask]>
Reply To:
Eric Schubert <[log in to unmask]>
Date:
Mon, 27 Nov 1995 10:52:30 -0500
Content-Type:
text/plain
Parts/Attachments:
text/plain (67 lines)
FYI:
 
 Here is a bug I'm working on (maybe) concerning the Jazz httpd 1.3 WWW
server.  I wrote a CGI c program that creates a form by reading data from a
file and merges this data with HTML statements.  To make it generic, I do
"getenv(SERVER_NAME)" and reference the server name in the ACTION of the
METHOD anchor.
 
 
...the c code to obtain SERVER_NAME:
 
main(int argc, char *argv[]) {
    register int x,m=0,mm=0;
    int cl;
    char *gcl;
    int button;
    record *rec;
 
    httpd=getenv("SERVER_NAME");
    if (!httpd) {
        error_page("Failed to obtain server name");
        exit(1);
       }
...}
 
 
...the "printf line in a subroutine that creates form output":
 
printf(" <body>\
<h2>This is a MockUp of a the purchase requisition form.\
On line ordering is currently being discussed.</h2>\
<FORM METHOD=\"POST\" ACTION=\"http://%s/cgi-bin/purchcgi\">\
<p> %c",httpd,LF);
 
===
IF I call up my CGI with URL:
 
 http://test.nd.edu/cgi-bin/purchcgi
 
I get the correct output:
===
<body><h2>This is a MockUp of a the purchase requisition form.On line
ordering is currently being discussed.</h2><FORM METHOD="POST"
ACTION="http://test.nd.edu/cgi-bin/purchcgi"><p>
               ^^^^^^^^^^
               SERVER_NAME reference is correct.
 
===
However, if I send a QUERY to the CGI with URL:
 
 http://test.nd.edu/cgi-bin/purchcgi?abc00002
 
I get QUERY_STRING returned as SERVER_NAME:
===
 
<body><h2>This is a MockUp of a the purchase requisition form.On line
ordering is currently being discussed.</h2><FORM METHOD="POST"
ACTION="http://abc00002/cgi-bin/purchcgi"><p>
               ^^^^^^^^^
              query string is now SERVER_NAME!
 
This is odd....
----------------------------------------------------------------
Eric J. Schubert                    Senior Data Base Analyst
Office of Information Technologies  Univ of Notre Dame, IN USA
(219) 631-7306                      http://www.nd.edu/~eschuber

ATOM RSS1 RSS2