I have been using the below listed article [1] to figure out how to pass
parameters to my RPG-CGI program. I have a problem getting the
CONTENT_LENGTH. It always seems to return 0. We are on V5R4.
[1]
http://systeminetwork.com/node/26490
P*--------------------------------------------------
P* Procedure name: CgiParseInz
P* Purpose:
http://systeminetwork.com/node/26490
P* Returns:
P*--------------------------------------------------
P CgiParseInz B EXPORT
D CgiParseInz PI 10I 0
D cgiBuffer S 4096A
D reqMethod S 10A
D nContentLen S 10I 0
D nBytesRead S 10I 0
D api_error S 64A Inz(*ALLX'00')
/free
reqMethod = %str(getenv('REQUEST_METHOD'));
nContentLen = %int(%str(getenv('CONTENT_LENGTH')));
if (reqMethod = 'POST' and nContentLen > 0);
//if (reqMethod = 'POST');
cgiParse('-i ':'CGII0100': cgiBuffer: %size(cgiBuffer) :
nBytesRead : api_error);
if (nBytesRead > 0);
putenv(%subst(cgiBuffer:1:nBytesRead)); // Set QRY_STR
putenv('REQUEST_METHOD=GET'); // Override method
endif;
endif;
return nBytesRead;
/end-free
P CgiParseInz E
I am claiming stupid here so I am not sure what I maybe doing wrong. I am
using Poster (a Mozilla plugin)(
http://code.google.com/p/poster-extension/)
to test POST to this program.
--
Mike Wills
http://mikewills.info
P: (507) 933-0880 | Skype: koldark
As an Amazon Associate we earn from qualifying purchases.