K Itsnet - Http Curl
Last published: June 17, 2016 by 'jdougan'
Defines 4 Classes
Extends 6 Classes
The HttpCurl package implements a minimalist http/https clint that relies
on the curl program for the heavy lifting. This means we don't have to directly support
an SSL library or the evolving web/http/https standards. Also, you can
ignore the various international crypto restrictions or at least make
them someone else's problem. The major drawback is
the lag it takes to spin up a curl process and copy data through a pipe.
We mitigate this to some extent by only doing minimal copying
with the binary data once we have it. Currently it is only implemented for
systems for which UnixProcess is valid.
In normal usage you are expected to subclass the client and response
classes, overiding client responseFromBytes:request: or requestFactory
and the response's or requests parsing methods to handle the expected
body format. This is best suited for Web API
type calls where you are not expecting streamed data and you are
likely to not ignore most of it. It is also intended to be simple to
work around bad Web APIs that do not follow reccomended practices.
There is a per client crude throttle system that by default limits calls to one per second. This can be changed in the throttleDelay and throttleDelayMs methods.
A request is either a URL in a string, a URL object or an HttpRequest. The code tries to handle each of these cases without conversions. The URL object support is currently incomplete. The only HTTP operation currently supported is GET, though it is intended that others be supported later.