× 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.



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.

This thread ...

Follow-Ups:

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.