When I call QtmhGetEnv (within a CGI program called via an Apache server) to retrieve an HTTP header, I would expect the QtmhGetEnv procedure to return an error if the header does not exist. However, since the value it is returning is blank, and there is no error in the return parm, I am unable to determine if the value is really blank or if the header does not exist. Is there any way to get QtmhGetEnv to return an error when the header is not found, or, better yet, get all HTTP headers into 1 string so I can parse it myself? Here is some sample code:
PHP Code:
dcl-pr getHttpHeaders extproc('QtmhGetEnv');
pHeaderData like(headerData);
pHeaderDataLength like(headerDataLength);
pReturnedDataLength like(headerDataLength);
pHeadername char(30) const;
pHeaderNameLength int(10:0) const;
perror like(apiError);
end-pr;
dcl-ds apiError;
errorByteP int(10:0) inz(40);
errorByteA int(10:0);
errorMsgID char(7);
errorReserved char(1);
errorData char(40);
end-ds;
dcl-s headerData char(64) inz;
dcl-s headerDataLength int(10:0) inz(%size(headerData));
dcl-s returnedDataLength int(10:0) inz;
dcl-c OriginHeader const('HTTP_ORIGIN');
dcl-c OriginHeaderLen const(%size(OriginHeader));
callp getHttpHeaders( headerData
: headerDataLength
: returnedDataLength
: OriginHeader
: OriginHeaderLen
: APIError );
Comment