[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Ftpapi] Payload Limitation - Using HTTP_REQ()

Hello Robin,

VARCHAR fields work by storing the length of the string in the first 4 bytes of the field.  HTTPAPI, therefore, uses pointer techniques to read the first 4 bytes to determine the length.  It appears that in your case, those first 4 bytes are set to (hex) x'000186A0' (which is decimal 100000).

In other words, based on the debug screens you've sent us, the reason you're limited to 100000 characters is because you're only assigning 100000 characters to P$Req before calling http_req().

To verify this...  set a breakpoint on the line before you call http_req and do (in the green-screen debugger) and when it its that line, type: eval P$Req:x 4

This will show you the hex value of the length.

To be 100% sure the problem isn't HTTPAPI, I wrote a quick test program (it doesn't do anything useful, but it does demonstrate the length being sent):


ctl-opt dftactgrp(*no) bnddir('HTTPAPI');

/copy httpapi_h

dcl-s over100 varchar(200000);

over100 = *ALL'x';
%subst(over100:199998:3) = 'AAA';

http_debug(*on: '/tmp/testlog.txt');

        : 'http://www.scottklement.com/testreq'
        : '/tmp/testresult.txt'
        : *omit
        : *omit
        : over100
        : 'application/octet-stream' );

*inlr = *on;

When I debugged the code and checked the value of SendLen (the same as you did in your screenshot) it showed SENDLEN = 200000

When I looked at the /tmp/testlog.txt, I could see that the content-length was 200000 and the data contained all of the 'x' characters followed by 'AAA', so indeed, the entire data was sent, even though it was more than 100000.

Scott Klement

On 1/15/2021 10:20 AM, Robin Jacob wrote:

Thanks for the reply.

In fact, I had already changed my service to use the HTTP_REQ instead of HTTPSTRING(), the reason I mentioned it in the subject.
Still, the result is the same after the software update.

The wrapper function I use to call HTTP_REQ

Ftpapi mailing list