##- # Author: Brian Tiffin # Dedicated to the public domain # # Date: August 2016 # Modified: 2016-11-17/12:26-0500 ##+ # # https-json.icn, Try HTTPS with a SourceForge JSON query # # tectonics: # unicon -s https-json.icn -x | jq .downloads[-4:-1] # procedure main() uri := "https://sourceforge.net/projects/unicon/files/stats/json" || "?start_date=2010-10-01&end_date=2110-10-01" web := open(uri, "m-") | stop("Can't open ", uri) showHeaders(web) size := 0 < integer(web["Content-Length"]) | stop("can't get the file size") data := reads(web, size) | stop("failed to reads ", size, " bytes") write(data) close(web) end # write HTTPS response headers to standard error procedure showHeaders(m) local k every k := key(\m) do write(&errout, left(k||":", 32), m[k]) end