HTTP/1.1 302 Moved Temporarily

Discussions related to HTTPAPI (An HTTP Client Package for RPG programming.) http://www.scottklement.com/httpapi/
Post Reply
rreddy
Posts: 3
Joined: Tue Feb 15, 2022 1:34 am

HTTP/1.1 302 Moved Temporarily

Post by rreddy »

Hi Scott,

Thanks in advance for help. I have been using the API since one year. Since Last week I started getting an HTTP/1.1 302 Moved Temporarily error.
So I have asked AS/400 admin to download new SSL certificates but it did not resolve the issue.

HTTPAPI Ver 1.41 released 2020-06-05
NTLM Ver 1.4.0 released 2014-12-22
OS/400 Ver V7R4M0

http_persist_open(): entered
http_long_ParseURL(): entered
DNS resolver retrans: 2
DNS resolver retry : 2
DNS resolver options: x'00000136'
DNS default domain: xxx.COM
DNS server found: 172.xx.111.10
DNS server found: 172.xx.10.141
https_init(): entered
QSSLPCL = *OPSYS
SSL version 2 support disabled
SSL version 3 support disabled
Old interface to TLS version 1.0 support enabled
TLS version 1.0 support enabled
TLS version 1.1 support enabled
TLS version 1.2 support enabled
initializing GSK environment
GSK Environment now available

Protocol Used: TLS Version 1.2
http_persist_req(POST) entered.
http_long_ParseURL(): entered
http_long_ParseURL(): entered
do_oper(POST): entered
There are 0 cookies in the cache
POST /ShippingAPI.dll?API=TrackV2&XML=<TrackRequest%20USERID="765COACH7405"><TrackID%20ID="9261290290704506332556"></TrackID></TrackRequest> HTTP/1.1
Host: secure.shippingapis.com
User-Agent: http-api/1.41
Content-Type: application/xml
Content-Length: 400000

senddoc(): entered
<TrackRequest USERID="765COACH7405"><TrackID ID="9261290290704506332556"></TrackID></TrackRequest> recvresp(): entered
HTTP/1.1 302 Moved Temporarily
Date: Mon, 14 Feb 2022 23:26:47 GMT
Connection: close
Via: HTTPS/1.1 localhost.localdomain
Location: http://172.27.109.85:15871/cgi-bin/bloc ... 3341558858
Content-Length: 0


SetError() #13: HTTP/1.1 302 Moved Temporarily
recvresp(): end with 302
recvdoc parms: identity 0
header_load_cookies() entered
recvdoc(): entered
SetError() #0:
recvdoc(): Receiving 0 bytes.
recvdoc(): Nothing to receive, exiting...
SetError() #13: HTTP/1.1 302 Moved Temporarily
http_close(): entered

Thanks,
Rama Reddy.
Scott Klement
Site Admin
Posts: 636
Joined: Sun Jul 04, 2021 5:12 am

Re: HTTP/1.1 302 Moved Temporarily

Post by Scott Klement »

The server you're connecting to is sending you a "redirect". It says instead of the URL you provided, it wants you to connect to "http://172.27.109.85:15871/cgi-bin/bloc ... 3341558858"

Your program can do something like this:

Code: Select all

url = 'the-original-url-here';
dou rc <> 302;
  rc = http_req(...etc...  with URL in above variable);
  if rc = 302;
    url = http_redir_loc();
  endif;
enddo;
So the idea is... when you get a 302 code redirecting you to another location, you retrieve the new URL and use that, instead.
rreddy
Posts: 3
Joined: Tue Feb 15, 2022 1:34 am

Re: HTTP/1.1 302 Moved Temporarily

Post by rreddy »

Hi Scott,

Thanks for quick response. I have tried to change new url which is redirected. However I am getting same error. When I pasted the same request URL on web browser.

https://secure.shippingapis.com/Shippin ... Request%3E

We browser getting response which eliminates URL validation.

Do you think any settings required on DCM certificates?

Thanks again for help.

Thanks,
Rama Reddy.
Scott Klement
Site Admin
Posts: 636
Joined: Sun Jul 04, 2021 5:12 am

Re: HTTP/1.1 302 Moved Temporarily

Post by Scott Klement »

Browsers automatically follow redirects. In HTTPAPI, you have to code it.
rreddy
Posts: 3
Joined: Tue Feb 15, 2022 1:34 am

Re: HTTP/1.1 302 Moved Temporarily

Post by rreddy »

HI Scott,

Thanks for help. Just let you know we are able to resolve it. It is a network issue. Once network person bypass from Proxy Server. It is started working without making any changes.

Thanks again.

thanks,
Rama Reddy.
Post Reply