1753401 Members
7144 Online
108792 Solutions
New Discussion юеВ

CSWS - CGI question

 
SOLVED
Go to solution
Willem Grooters
Honored Contributor

CSWS - CGI question

I encountered an odd behaviour in CGI.
The script test-cgi-cms.com, as delivered with CSWS, displays all variables apparantly known to CGI. However, SHOW SYMBOL * dosn't show any of these.

What's the reason for that?

Script and output attached (in one file)
Willem Grooters
OpenVMS Developer & System Manager
11 REPLIES 11
Alex  Daniels
Frequent Advisor

Re: CSWS - CGI question

From one of the symbols we can see the folllowing...

symbol UIC = [AP_HTTPD,APACHE$WWW]

When you are doing the 'sh sym *' are you doing this from your own user, or that user??

Even if you log in as that user, I would guess the symbols are defined as part of the startup of CSWS, so you may not see them anyway..


Martin P.J. Zinser
Honored Contributor

Re: CSWS - CGI question

Actually they are not even defined at server startup but filled at script invocation e.g. the
user agent (IE Explorer in your case) can only
be known when the script is actually invoked.
Also the names are not specific to Apache, but rather part of the common gateway interface.
Willem Grooters
Honored Contributor

Re: CSWS - CGI question

It's a standard installation, so the script IS run under that UIC. The symbols shown in SHOW SYMBOL * are indeed the ones defined for that process - as Martin said.
What wonders me is that the symbols outputted by the PRINTENV subroutine (see the script) only show up when defined locally (like UIC), but others that are originate from HTTP (like REMOTE_USER) seem to be non-existent as VMS symbol, and still, they can be used.



Willem Grooters
OpenVMS Developer & System Manager
Martin P.J. Zinser
Honored Contributor

Re: CSWS - CGI question

Hello Willem,

they do not exist as VMS symbols for the Apache account, but rather are created if the script is executed in the context of a CGI script process.
They are actually also not really specific to CSWS/Apache, but are the same for other Webservers (that is why it is called the >>Common<< Gateway Interface ;-)

Greetings, Martin
Willem Grooters
Honored Contributor

Re: CSWS - CGI question

I can understand that they are created when the script is started on behalf/by CGI and exists in respect with CGI, not the OS. But still, I do still not understand that this work WITHOUT symbols being known to VMS:

call printenv REMOTE_USER

in printenv:

symbolname = 'P1'
==> symbolname = "REMOTE_USER"
if f$type('symbolname' .eqs. ""
==> if f$type("REMOTE_USER") .eqs. ""
then
symbolvalue = 'REMOTE_USER'

==> symbolvalue = "[AP_HTTPD,APACHE$WWW]"

and that REMOTE_USER doesn't show up.
UNLESS CGI uses a 'backdoor'???
Willem Grooters
OpenVMS Developer & System Manager
Martin P.J. Zinser
Honored Contributor

Re: CSWS - CGI question

Hello Willem,

from the source:

$ if f$type('symbolName') .eqs. ""
$ then
$ symbolValue = ""
$ else
$ symbolValue = 'symbolName'
$ endif

i.e. if the remote_user is not set also the
symbolvalue will be set to the empty string,
else the value of remote_user is copied in.

As for the "backdoor" the symbol is created by the server for the thread executing the script.

A read in Alan Winstons VMS Webserver book (Digital Press) might help to clarify the issue.

Greetings, Martin
Willem Grooters
Honored Contributor

Re: CSWS - CGI question

Ok Martin,

but I'm not that infamiliar with VMS.
If I ask the system to show the contents of symbol X (whatecer) I expect that symbol to show up issueing SHOW SYMBOL. This makes is possible to issue a command like

if f$type('Symbolname')

For UIC in the example, this works, since UIC is defined within the script. But REMOTE_USER does NOT, STILL it responds to f$type, and that's what I don't understand. As I see for now, REMOTE_USER is NOT a VMS symbol since SHOW SYMBOL doesn't show it, and yet it is since F$TYPE gives a response. So what wrong with my understanding....
Willem Grooters
OpenVMS Developer & System Manager
Martin P.J. Zinser
Honored Contributor

Re: CSWS - CGI question

Hello Willem,

sorry for the delay, we have been moving our home ;-)

To get at the bottom of this I did install CSWS T2.0 on my system. I do not get the remote_user in the printenv output. Could you plese post the configuration rules you used to setup authentication for the script on your server.

Greetings, Martin
Robert Atkinson
Respected Contributor

Re: CSWS - CGI question

Willem, I have also seen this behaviour with SHOW SYMBOL. It appears to be a bug with the SHOW command rather than a problem with CSWS, although I've seen this problem in a variety of places.

In the text below you can see a symbol DISK_INDEX (from TapeSys), but if you then immediately do a SHOW SYM *, it does not appear.


ALPHA_ROB$ typ rob.tmp
(15:10:37) $ !
(15:10:37) $ SH SYM DISK_INDEX
DISK_INDEX = 5 Hex = 00000005 Octal = 00000000005
(15:10:37) $ SH SYM *
$RESTART == "FALSE"
$SEVERITY == "1"
.......
DENSITY == ""
DISMDAILY_DONE = "FALSE"
DISMOUNT_QUALS == "/UNLOAD"
DRIVES_PER_BACKUP == 1 Hex = 00000001 Octal = 00000000001
DRIVE_TYPE == ""
DUMMY = ""
ERRORMOD == "@OPS$COM_FILES:ERRORMOD"
ESC == "."
EXCLUDE_STATUS == "NORMAL,ACCONFLICT"
(15:10:37) $ SH SYM /ALL /LOCAL
BACKUP = "TEST"
COUNT = 2 Hex = 00000002 Octal = 00000000002
CURR_TIME = "1510"
DISMDAILY_DONE = "FALSE"
DUMMY = ""
P1 = ""
P2 = ""
P3 = ""
P4 = ""
P5 = ""
P6 = ""
P7 = ""
P8 = ""
STATUS = " "
TEMP = "TLFILES_1"
TEMP2 = "SY4:[LIVE.DAT]AUTOCONV*.MAS"
TL_CURR_DATE = "20020829"
TL_INDEX = 6 Hex = 00000006 Octal = 00000000006
VERIFY = 1 Hex = 00000001 Octal = 00000000001
(15:10:37) $ SH SYM DISK_INDEX
DISK_INDEX = 5 Hex = 00000005 Octal = 00000000005
(15:10:37) $ !
ALPHA_ROB$