Hi Scott,

Thanks for your reply.

We occasionally get that HTTP_RESP = 13 logged as a warning error.

Clarification: my initial post was incorrect. The HTTP_RESP = 13 gets
occasionally returned from http_error() not http_url_post_raw().

Questions:
Does http_url_post_raw() return a standard HTTP response code if it fails?

If so, I probably should change the code to interrogate those instead of
the http_error() response.

I'm getting the impression that is what you're recommending, i.e. stop
using http_error()?

Documentation at the top of http_url_post_raw says it returns:

"Returns -1 upon failure, 0 upon timeout, or an HTTP response code "

I'm assuming that it could also return 1 for success, correct?

If http_url_post_raw fails, does it return -1 generically, or does it
return a detailed HTTP response / error code?

Here is the basic code in use with non-relevant portions removed:

err = *ZERO;

// Attempt authentication 3 times.
counter = *ZERO;
dow counter < 3;

counter += 1;

// Post the data and retrieve the response.
rc = http_url_post_raw (url :
%addr(postData) :
%len(%trim(postData)) :
1 :
%paddr('PROCESSINCOMINGDATA') :
HTTP_TIMEOUT :
HTTP_USERAGENT :
'application/json' );

if rc = 1;
err = *ZERO;
leave;
else;
http_error (err);

// HTTP_RESP (13) = HTTP response code logged (not an error,
per se)
if err = HTTP_RESP;
leave;
endif;

// Attempt to authenticate 3 times, after that fail
if counter < 3;
iter;
endif;

endif;

enddo;

// HTTP_RESP (13) = HTTP response code logged (not an error, per se)
if err = HTTP_RESP;

// Log warning error here <== occasionally happening

endif;

Mike

date: Thu, 7 Jun 2018 15:32:22 -0500
from: Scott Klement <midrange-l@xxxxxxxxxxxxxxxx>
subject: Re: HTTPAPI return code 13 (HTTP_RESP)

Hi Mike,

HTTPAPI logs the HTTP response by setting it as the "last error that
occurred", this is just in case you might want to know what the actual
response is.? It does this by setting it as HTTPAPI code HTTP_RESP.?
This is a "feature" that isn't ever used, and I wouldn't recommend using
it yourself.? But, I keep it in there because I don't want to break
backward compatability.

You should only be getting this if the http_url_post_raw() routine
returns "success" (i.e. does NOT report an error), and the value will
come from http_error().

My guess (purely a guess, I've not seen your code) is that sometimes
you're calling http_error() when http_url_post_raw() hasn't reported any
errors, and that's why you're seeing this.

--
Scott Klement
http://www.scottklement.com


On 6/7/18 1:07 PM, Mike Jones wrote:
We have a process that uses the HTTPAPI api's.

In calling the "http_url_post_raw" procedure, we occasionally receive
response code 13 back from that procedure, which is documented as:

** HTTP response code logged (not an error, per se)
D HTTP_RESP C CONST(13)

Does anyone have any insight as to what that response code means?

Mike



As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.