Unable to clear Response headers

Discussions related to HTTPAPI (An HTTP Client Package for RPG programming.) http://www.scottklement.com/httpapi/
Post Reply
sathis_nsk
Posts: 3
Joined: Fri May 03, 2024 10:45 am

Unable to clear Response headers

Post by sathis_nsk »

Hi Scott,
In our program, we are using the http_header() procedure to retrieve values from the response headers. However, we encountered a situation when making subsequent API calls within the same activation group, where a successful response was immediately followed by a response with return code -1 (rc = -1). When the -1 response occurred, the response headers did not appear to be cleared, resulting in incorrect headers being logged.

We explored possible solutions but found that the header data - stored in the HDR data structure within the HEADERR4 module - was not directly accessible.

Could you please advise if there is any method to explicitly clear the HTTP response headers either before or after invoking HTTP_POST()?
Scott Klement
Site Admin
Posts: 945
Joined: Sun Jul 04, 2021 5:12 am

Re: Unable to clear Response headers

Post by Scott Klement »

Are you running version 1.52 of HTTPAPI?

How do I reproduce the problem?
sathis_nsk
Posts: 3
Joined: Fri May 03, 2024 10:45 am

Re: Unable to clear Response headers

Post by sathis_nsk »

Hi Scott,

Thanks for the response.

HTTPAPI version is 1.38.

Steps to reproduce:

1. Invoke an API and receive a successful response. Retrieve the response headers using the http_header() procedure.
2. Simulate a scenario where rc = -1. (We are unable to determine the exact reason for receiving rc = -1 in production, so we reproduced it by providing an incorrect endpoint—modifying only the subdomain part of the URL.)

Observe the response headers returned by http_header(). The procedure still returns the header values from the previous successful request instead of clearing them.

Kindly note that upgrading the HTTPAPI version is not an option at this point, as it is currently running in production and is used by multiple existing programs.


Scott Klement wrote: Fri Nov 07, 2025 6:31 pm Are you running version 1.52 of HTTPAPI?

How do I reproduce the problem?
Scott Klement
Site Admin
Posts: 945
Joined: Sun Jul 04, 2021 5:12 am

Re: Unable to clear Response headers

Post by Scott Klement »

sathis_nsk wrote: Sat Nov 08, 2025 4:25 pm Kindly note that upgrading the HTTPAPI version is not an option at this point, as it is currently running in production and is used by multiple existing programs.
In this case, there's little I can do to help you.

Please note that in ANY software package, you are expected to be able to install updates. In Windows, Microsoft provides a tool called Windows Update that will automatically download and install updates. On IBM i, IBM provides PTFs on a regular basis that are used to install updates. These are only two examples, but every single software package everywhere expects you to be able to install updates.

HTTPAPI has had 14 patches fixing lots of different bugs between 1.38 (version 1, patch level 38) and the current 1.52 (version 1, patch level 52). I can't support you if you won't install them.
Post Reply