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

RE: http_url_post_raw api does not think it received valid data whenit really did



Sender: Scott Klement <klemscot@xxxxxxxxxxxx>


>
> They were checking for return code to not be 1 indicating that
> this is an error.  Can you confirm
> that RC=1 is good return code and what would a bad RC be?

RC = -1 means that an error was encountered by HTTPAPI.
RC = 0  means that the time-out period has elapsed
RC = 1  means that the communication was successful
RC > 1  means that the HTTP server returned an error. RC will
         contain the numeric HTTP error code.

When I tried your example, I received "RC=1" which means that the
communication was successful.

>
> I am using timeout to 1 second.  What do you recommend
> and when does the timeout come in to play?
>

Whenever HTTPAPI is waiting for the remote server.  If no data can be sent
to the server, or received from the server (depending on what it's doing)
within the timeout period, it will give up and send an error.

So, if you specify 1 second, then if there's 1 second where it can't
either send 1 byte to the server, or receive 1 byte from the server, it
will exit.

Sometimes there are lags on the Internet that you'll want to wait for.
Maybe a packet needs to be re-sent, etc.   That's why the default timeout
value is set to 60 seconds... However, if you're running on a LAN, or a
wait is unacceptable, you can override this setting.

Here's an example of using the default timeout & user-agent, but
specifying your own custom content-type, and then checking for error:

C                   eval      rc = http_url_post_raw(
C                             'http://transport.alk.com/'
C                              'Fleetsuite.asmx/GetDirFromAdrToAdr?'
C                               : %addr(data): %len(%trimr(data))
C                               : 1
C                               : %paddr('INCOMING')
C                               : HTTP_TIMEOUT
C                               : HTTP_USERAGENT
C                               : 'application/x-www-form-urlencoded')
 *
C                   if        rc <> 1
C                   eval      msg = http_error
C                   dsply                   msg
c                   endif

The constants "HTTP_TIMEOUT" and "HTTP_USERAGENT" are in CONFIG_H which is
automatically included when you include HTTPAPI_H.


-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubsribe from the list send mail
to majordomo@xxxxxxxxxxxxx with the body: unsubscribe ftpapi mymailaddr
-----------------------------------------------------------------------