× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Ok - I walked through setting up a test. I created a new web server and configed to run CGI programs out of library E310PRDOBJ. I then created a program named E310H00000 that does nothing except call program E31RPP. I set up a scriptalias so that /cgi-bin/erros calls E310H00000. I set up a scriptaliasmatch that matches anything after /cgi-bin/ and then calls it as a program. Going to /cgi-bin/erros shows me the default output of E31RPP. Submitting the form on that page calls E31RPP again, and increments a counter. This is as simple of an example as I could create.

I'm sure this could be cleaner code, but I swiped this from an old CGI program I used for testing a long time ago and just converted it all to free.
https://code.midrange.com/23e3401a75.html

The key pieces are the scriptaliasmatch, making sure that the Acept-HTSession header is the first thing that E31RPP outputs, and that the next call is a post..

ScriptAlias /cgi-bin/erros /QSYS.LIB/E310PRDOBJ.LIB/E310H00000.PGM
ScriptAliasMatch ^/cgi-bin/(.*) /QSYS.LIB/E310PRDOBJ.LIB/$1

Buffer = 'Accept-HTSession:' + Handle + LineFeed;
WriteStdOut(Buffer:%Len(Buffer):Qusec);

Buffer = '<br><br><form name="cgiform" method="post" action="/cgi-bin/E31RPP.pgm/'
+ Handle + '">' + LineFeed;
WriteStdOut(Buffer:%Len(Buffer):Qusec);

Hopefully this will help you find where your setup isn't working.

-----Original Message-----
From: WEB400 [mailto:web400-bounces@xxxxxxxxxxxx] On Behalf Of Rob Dixon
Sent: Wednesday, December 12, 2018 7:04 AM
To: Web Enabling the AS400 / iSeries
Subject: Re: [WEB400] Apache directive syntax

Scott
Many thanks for your long post, explanations and helpful ideas.
As I said in my initial post, I don't understand the syntax for Apache directives and I have been unable to find documentation explaining it.

ScriptAliasMatch /cgidev2p/(.*) /qsys.lib/cgidev2.lib/$1 was a quote from easy400.net

What I actually used was
*ScriptAliasMatch ^/cgi-bin/(.*) /QSYS.LIB/E310PRDOBJ.LIB/$1* but this didn't work, although it did put what appeared to be the the correct URL - http://192.168.2.70/cgi-bin/E31RPP.PGM/081895345701239/ - in the address of the error 404 screen, together with the message The requested URL /cgi-bin/E31RPP.PGM/081895345701239/ was not found on this server.
Since the above statement is preceded by Alias /cgi-bin/ /QSYS.LIB/E310PRDOBJ.LIB*/, *I also tried ScriptAliasMatch ^/cgi-bin/(.*)
/$1 but with the same result.

http://192.168.2.70/cgi-bin/E31RPP.PGM/081895345701239/ is the same form as I get with the original HTTP server under V5R1 and I have had this working for about 10 years without any problem. I assume, perhaps naively, that anything that works with the original HTTP server will also work with Apache if it is configured correctly. I should explain that all the programs were compiled on the V5R1 system with their own ACTGRP and have been transferred to the backup V5R3 system which doesn't have programming tools. I am as sure as I can be that the files, programs etc on the V5R3 systems are the same as on my V5R1 machine. Once I have Apache working, then I can transfer to a more modern system with a later OS version.

The only CGI program is E31RPP which is used for all applications, however diverse they may be. This generates HTML and Javascript on the fly for all applications and there is no stored HTML. I don't use HTML templates. The same program, E31RPP, is also used for 5250 output and that all works fine on the V5R3 system which again makes me think that my problem is with the Apache config. If there was an ACTGRP problem, then presumably my programs would not work in 5250 mode.

You suggested ScriptAliasMatch /cgi-bin/([a-z0-9]{1,10}.pgm)/.* /qsys.lib/cgidev2.lib/$1. I assume that, as I only have one CGI program, I could use its name. My library is E310PRDOBJ rather than cgidev2 so the above would become ScriptAliasMatch /cgi-bin/E31RPP.pgm/.* /qsys.lib/E310PRDOBJ.lib/$1. I have tried that, with and without the brackets around E31RPP.PGM and it doesn't work. Have I still misunderstood? If I have not, could there be any other problem that I have not spotted?

I have explained elsewhere in this thread that my initial program is E310H00000. This is not a CGI program, has no output and calls E31RPP indirectly.

Rob








On Tue, 11 Dec 2018 at 22:16, Scott Klement <web400@xxxxxxxxxxxxxxxx> wrote:

Rob,

I'm trying to piece together this conversation from many messages in
the thread, so please forgive me if I'm missing part of it. At the
start you said you were using this:

ScriptAliasMatch /cgidev2p/(.*) /qsys.lib/cgidev2.lib/$1

Read that carefully. $1 means "everything that fits in the first set of
parenthesis". In parenthesis, you have .* which means "all
characters". So if you have a URL of
http://whatever/cgidev2p/blahblahblah the "blahblahblah" would match
the parenthesis, so would be placed in the pathname where the $1 is.

Now apply that to your URL:

http://192.168.2.70/cgi-bin/E31RPP.PGM/081854473505965/

This URL doesn't have cgidev2p in it, so will not match this script
alias. I'm assuming that you actually used cgi-bin instead of
cgidev2p, so your script alias is actually this:

ScriptAliasMatch /cgi-bin/(.*) /qsys.lib/cgidev2.lib/$1

Assuming that's what you meant, the resulting path name would be:

/qsys.lib/cgidev2.lib/E31RPP.PGM/081854473505965/

that isn't a valid path name, so this wouldn't work. You are probably
thinking that the script alias won't consider everything after the
slash to be part of the program name -- but, in fact, it doesn't know
its a program name. It's just trying to match the regular expression
.*, which includes everything, including the slash, etc. The period
means "any character" and the * means "zero or more times" so it will
include the slashes, etc as part of the program name.

Instead you'll want something like this (this is off the top of my
head,
untested):

ScriptAliasMatch /cgi-bin/([a-z0-9]{1,10}.pgm)/.*
/qsys.lib/cgidev2.lib/$1

So the idea is it matches letters a-z or digits 0-9, from 1-10
characters long, followed by the .PGM Everything after the.PGM is not
part of the program name, so isn't in the parenthesis.

-SK

On 12/11/2018 12:37 PM, Rob Dixon wrote:
John,

When a user signs on (compulsory), they are allocated an OS/400 job
number
and this is the first six digits of the long number at the end of the UI.
There is no theoretical limit to number of concurrent users possible.

It is certainly not my intention to let the client choose the
program - I have tried using wildcards in desperation but, as I
said, I really don't know what I am doing with Apache. The exact
same structure has worked
fine
under V5R1 with original HTTP server for about 10 years.

All applications use the same initial URL -
http://192.168.2.70/cgi-bin/erros and once they have signed on, and
their
initial screen has been displayed, if they then press Enter, the URI
will always be
http://192.168.2.70/cgi-bin/E31RPP.PGM/081854473505965/ where
081854 is the job number and the remaining 9 digits together with
the job number make a unique session ID. This applies for all
applications. All data and application definitions are stored in the
database, as are user authorities to use applications and the user
is presented with a list of applications to which he is authorised,
retrieved from the database. All applications, however diverse, use
the same CGI program and database handler. Selecting an application
takes the user to an initial menu for
the
application which is also stored in the database. As there is
effectively only one CGI program, they cannot select the wrong one.
The CGI program E31RPP generates all HTML and Javascript on the fly.
There is no stored HTML. But this is not really relevant to my
problem which I feel sure is simply a config problem (but I might be wrong!).


On Tue, 11 Dec 2018 at 13:26, Slanina, John <jslanina@xxxxxxxxxx> wrote:

How can you control that is only get called once ? if more than one
client
is accessing the API you could have up to by default 40 jobs running.
We
have 19 jobs serving the api's right now.
The first program wsrpgm02 is a router program the looks at the uri
and does a DB lookup to find which program to load. It provides a
level of security.
I hope you are not going to let the client side pick the program.
One
typo
from the client developer and they may run a program you don’t want
them too.

Thanks
John Slanina



On 12/11/18, 4:55 AM, "WEB400 on behalf of Rob Dixon" <
web400-bounces@xxxxxxxxxxxx on behalf of robertsdixon@xxxxxxxxx> wrote:

Many thanks. The wild card is not in my config but has been
put
there,
at
the beginning and end of each line, by a mail package when
responding
to my
post. I don't know why.

I don't need the SETENV code as the library list is set by my
initial
program. The other difference is that I have to distinguish
between the
initial program which calls my CGI program (indirectly) and
that
CGI
program, as, rather obviously, the initial program must only
be
called
once.

Rob

On Mon, 10 Dec 2018 at 16:33, Slanina, John
<jslanina@xxxxxxxxxx>
wrote:

> Rob,
>
> Here is our setup is works fine.
> I don’t undertstand why you have the wildcard * after it.
>
>
> 21 SetEnv QIBM_CGI_CHANGE_CURLIB N
> 22 SetEnv QIBM_CGI_LIBRARY_LIST
>

"QTEMP;D1BRCOBJ;D1BRFILESU;D1BRCPGMSU;D1BRFILESN;D1BRCPGMSN;D1GENNEW;D1BRFILES;D1BRCPGMS;D1PENWORK;D1PENFILES;D1NIFILES;D1TRFILES;D1IC08XXCP;D1IC08XXP;D1MW08XXCP;D1MW08XXP;D1NI08XXCP;D1NI08XXP;D1TR08XXCP;D1TR08XXP;D1BRCPGMS1;GPL;QGPL;RDB40;"
> 23
> 24 <Directory />
> 25 Order Deny,Allow
> 26 Deny From all
> 27 </Directory>
> 28
> 29 <Directory /www/brctivod1/htdocs>
> 30 Order Allow,Deny
> 31 Allow From all
> 32 </Directory>
> 33
> 34 ScriptAlias /webapi
/qsys.lib/D1BRCPGMS.lib/wsrpgm02.pgm
> 35
> 36 <Directory /qsys.lib/D1BRCPGMS.lib>
> 39 Allow From all
> 40 order allow,deny
> 41 Require valid-user
> 42 DefaultNetCCSID 819
> 43 AuthType Basic
> 44 AuthName ****
> 45 CGIJobCCSID 37
> 46 CGIConvMode EBCDIC
> 47 PasswdFile %%SYSTEM%%
>
>
> 48 </Directory>On 12/10/18, 11:24 AM, "WEB400 on behalf
of
Buck
> Calabro" <web400-bounces@xxxxxxxxxxxx on behalf of
kc2hiz@xxxxxxxxx>
> wrote:
>
> On 12/8/2018 11:48 AM, Rob Dixon wrote:
> > The header is correct for the initial display. Having got
that
> screen, I
> > then started a service program for the job and set a
breakpoint at
> the
> > beginning of the calc specs for my CGI program, which, as I
have
> said, is
> > the same program that displayed my first screen. But when I
pressed
> Enter
> > to get the second screen, there was no breakpoint. There
was
nothing
> in
> > CGIDEBUG for the second screen. but the log said
> >
> > [Sat Dec 08 14:18:19 2018] [error] [client 192.168.2.210]
> ZSRV_MSG0018:
> > File /QSYS.LIB/E310PRDOBJ.LIB/E31RPP.PGM/081780817443836/
does
not
> exist,
> > referer: http://192.168.2.70/cgi-bin/erros
> > [Sat Dec 08 14:18:19 2018] [error] [client 192.168.2.210]
> ZSRV_MSG0016: URI
> > in request POST /cgi-bin/E31RPP.PGM/081780817443836/
HTTP/1.1
is not
> valid,
> > referer: http://192.168.2.70/cgi-bin/erros
> >
> > The relevant config lines seem to be
> > * 7* * ScriptAlias /cgi-bin/erros
> > /QSYS.LIB/E310PRDOBJ.LIB/E310H00000.PGM*
> > * 8* * Alias "/cgi-bin/" "/QSYS.LIB/E310PRDOBJ.LIB/"*
> > * 9* * ScriptAliasMatch ^/cgi-bin/(.*) /$1*
> > * 10*
> > * 11* * # ScriptAliasMatch ^/cgi-bin/(.*)
> /qsys.lib/E310PRDOBJ.LIB/$1*
> >
> > Line 7 executes correctly with the display of the first
screen. I
> have
> > tried it with line 11 instead of line 9 and the result is
the
same.
>
> What's the URI after the first screen displays? Is it
> http://192.168.2.70/cgi-bin/E31RPP.PGM/081780817443836 If
so,
wouldn't
> that assert ScriptAliasMatch and try to fire off program
> 081780817443836, which doesn't exist?
>
> --
> --buck
>
> http://wiki.midrange.com
> Your updates make it better!
>
> --
> This is the Web Enabling the IBM i (AS/400 and iSeries)
(WEB400)
> mailing list
> To post a message email: WEB400@xxxxxxxxxxxx
> To subscribe, unsubscribe, or change list options,
> visit: https://lists.midrange.com/mailman/listinfo/web400
> or email: WEB400-request@xxxxxxxxxxxx
> Before posting, please take a moment to review the archives
> at https://archive.midrange.com/web400.
>
>
>
> --
> This is the Web Enabling the IBM i (AS/400 and iSeries)
(WEB400) mailing
> list
> To post a message email: WEB400@xxxxxxxxxxxx
> To subscribe, unsubscribe, or change list options,
> visit: https://lists.midrange.com/mailman/listinfo/web400
> or email: WEB400-request@xxxxxxxxxxxx
> Before posting, please take a moment to review the archives
> at https://archive.midrange.com/web400.
>
>

--
Rob Dixon

www.erros.co.uk
www.boarstall.com
--
This is the Web Enabling the IBM i (AS/400 and iSeries)
(WEB400) mailing list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/web400.



--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400)
mailing list To post a message email: WEB400@xxxxxxxxxxxx To
subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at
https://archive.midrange.com/web400.



--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400)
mailing list To post a message email: WEB400@xxxxxxxxxxxx To
subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/web400.



--
Rob Dixon

www.erros.co.uk
www.boarstall.com
--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing list To post a message email: WEB400@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at https://archive.midrange.com/web400.



[https://www.medtronsoftware.com/img/MedtronMinilogo.bmp] Kevin Bucknum
Senior Programmer Analyst
MEDDATA / MEDTRON
120 Innwood Drive
Covington LA 70433
Local: 985-893-2550
Toll Free: 877-893-2550
https://www.medtronsoftware.com



CONFIDENTIALITY NOTICE

This document and any accompanying this email transmission contain confidential information, belonging to the sender that is legally privileged. This information is intended only for the use of the individual or entity named above. The authorized recipient of this information is prohibited from disclosing this information to any other party and is required to destroy the information after its stated need has been fulfilled. If you are not the intended recipient, or the employee of agent responsible to deliver it to the intended recipient, you are hereby notified that any disclosure, copying, distribution or action taken in reliance on the contents of these documents is STRICTLY PROHIBITED. If you have received this email in error, please notify the sender immediately to arrange for return or destruction of these documents.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.