Did you know ... Search Documentation:
Packs (add-ons) for SWI-Prolog

Package "http2_client"

Title:An HTTP/2 client
Rating:Not rated. Create the first rating!
Latest version:0.7.0
SHA1 sum:dc6a0ed15438cc678e3fde9df30e5b1252d6540b
Author:James N. V. Cash <james.cash@occasionallycogent.com>
Home page:https://gitlab.com/jamesnvc/prolog_http2_client
Download URL:https://github.com/jamesnvc/http2_client/releases/*.zip
Requires:delay
list_util
Provides:http2_client

Reviews

No reviews. Create the first review!.

Details by download location

VersionSHA1#DownloadsURL
0.1.0c0a17f9f4f868eaf62d8c3d222a75b58c10c0d392https://github.com/jamesnvc/http2_client/archive/v0.1.0.zip
0.4.0faea138bbfda7465660466735dbc1968f7457b521https://github.com/jamesnvc/http2_client/archive/v0.4.0.zip
0.6.0e9c9a4d188488ca44c947a0b6e726d17a512d0ae1https://github.com/jamesnvc/http2_client/archive/v0.6.0.zip
0.6.13642e46c90fee0131dbd1e8f0d7d822b2060906c1https://github.com/jamesnvc/http2_client/archive/v0.6.1.zip
0.6.243bc2997b0715de43fb99d9561bdbaa6c0ccf66a1https://github.com/jamesnvc/http2_client/archive/v0.6.2.zip
0.7.0dc6a0ed15438cc678e3fde9df30e5b1252d6540b3https://github.com/jamesnvc/http2_client/archive/v0.7.0.zip

A Prolog HTTP/2 Client

This library is a work in progress

It currently does not support server push and assumes correct input from servers -- it is not robust in the face of server errors or invalid data being sent.

Only HTTP/2 over TLS is supported, which requires SWI-Prolog 7.7.19 or greater for TLS-ALPN support.

It is available as an SWI pack and can be installed by running ?- pack_install(http2_client).

Contributions extremely welcome

Requires the list_util and delay packs.

Uses the reif library.

Example

:- use_module(library(http2_client)).

test_close_cb(Ctx, Data) :-
    debug(xxx, ">>> server closed ~w", [Data]),
    http2_close(Ctx).
test_cb(Ident, Headers, Body) :-
    debug(xxx, ">>>>> ~w~n>>> headers ~w~n>>>body ~s...", [Ident, Headers, Body]).
test(Ctx) :-
    debug(xxx),
    http2_open('https://nghttp2.org', Ctx, [close_cb(http2_test:test_close_cb(Ctx))]),
    http2_request(Ctx, [':method'-'GET', ':path'-'/httpbin/ip'], [], test_cb(ip)),
    http2_request(Ctx, [':method'-'GET', ':path'-'/httpbin/headers'], [], test_cb(headers)),
    http2_request(Ctx, [':method'-'GET', ':path'-'/httpbin/get'], [], test_cb(get)).

?- test(Ctx).

Contents of pack "http2_client"

Pack contains 12 files holding a total of 81.3K bytes.