gap-packages / io

GAP package IO to do input and output
https://gap-packages.github.io/io/
Other
14 stars 14 forks source link

how to GET from a site which redirects http to https? #120

Closed dimpase closed 1 year ago

dimpase commented 1 year ago

getting statuscode=301 (i.e. Moved Permanently).

gap> uri:="/api/gps_smallhash/?_format=json&order=1536&hash=651420946779&_offset=0";;
gap> SingleHTTPRequest("beta.lmfdb.org",80,"GET",uri, rec(), false, false);
rec( 
  body := "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n<html><head>\n<title>301 Moved Permanently</title>\n</head><body>\n<h1>Moved Permane\
ntly</h1>\n<p>The document has moved <a href=\"https://beta.lmfdb.org/api/gps_smallhash/?_format=json&amp;order=1536&amp;hash=651420946779&amp;_offse\
t=0\">here</a>.</p>\n<hr>\n<address>Apache/2.4.29 (Ubuntu) Server at beta.lmfdb.org Port 80</address>\n</body></html>\n", closed := true, 
  header := rec( ("cache-control") := "max-age=0", ("content-length") := "393", ("content-type") := "text/html; charset=iso-8859-1", 
      date := "Thu, 02 Mar 2023 13:22:36 GMT", expires := "Thu, 02 Mar 2023 13:22:36 GMT", 
      location := "https://beta.lmfdb.org/api/gps_smallhash/?_format=json&order=1536&hash=651420946779&_offset=0", 
      server := "Apache/2.4.29 (Ubuntu)" ), protoversion := "1.1", status := "Moved Permanently", statuscode := 301 )
gap> 

is there a simple way out here, or is this due to lack of ssl, etc?

fingolfin commented 1 year ago

IO does not and cannot support https resp. TLS.

You could try the curlInterface package

dimpase commented 1 year ago

Thanks; so far we settled on Download() from utils package.