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

Re: recvresp(): end with err



Todd,

The idea is that HTTPAPI can stop in the middle of running it's code, and call a routine (subprocedure) of yours. Depending on what you're trying to do, there are different spots where it can call your routines. These "spots" are called "exit points" (points at which HTTPAPI exits it's own processing and runs your code.) The procedure that it calls is called an "exit procedure."

In this example, you want to add an additional HTTP header to the request header stream. HTTPAPI has an exit point called HTTP_POINT_ADDL_HEADER that's designed specifically for doing this. So before doing your POST (or whatever HTTP calls you're doing) you'll want to call http_xproc() to set up this exit procedure.

Let's say your subprocedure is called AddHttpHeader() for the sake of example, you'd code this:

http_xproc( HTTP_POINT_ADDL_HEADER
          : %paddr(AddHttpHeader) );

Now any time HTTPAPI is sending HTTP headers, it'll call your routine, and your routine is able to add any headers it likes to the request. In this example, you want to add the 'connection: close' header, so you'd do this:



P AddHttpHeader   B
D                 PI
D    Header                  32767a   varying
 /free
    Header = 'Connection: close' + x'0d25';
 /end-free
P                 E

So HTTPAPI will add the Connection: close header to the request. This tells the HTTP server that it should close the connection (i.e. disconnect) after sending your response. I'm guessing that your server is already doing this... but right now HTTPAPI isn't expecting it to. With this header, it should be the expected behavior, so this might work for you.

-SK




On 5/17/2013 12:59 PM, Todd Carmosino wrote:
    Hi Scott -
    Thank you very much for the response! The DHL rep does use the word
    "legacy" often during project meetings.
    Because your examples are so very good, I have not explored some of the
    more esoteric (for me at least) options with HTTPAPI.
    I see EXAMPLE2 has the http_xproc, but what exit point event constant
    should I use.  Also is the exact syntax for the "connection: close"?
    Thank you again...
    Todd Carmosino


-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------