{"size": 4710, "ext": "scrbl", "max_stars_repo_path": "doc/utils/rfc/http-connections.scrbl", "max_stars_repo_name": "christoff-buerger/sagittarius-scheme", "max_stars_repo_stars_event_min_datetime": "2015-11-07T07:13:35.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-15T03:35:14.000Z", "max_issues_repo_path": "doc/utils/rfc/http-connections.scrbl", "max_issues_repo_name": "christoff-buerger/sagittarius-scheme", "max_issues_repo_issues_event_min_datetime": "2016-04-28T21:59:59.000Z", "max_issues_repo_issues_event_max_datetime": "2021-07-01T08:42:21.000Z", "max_forks_repo_path": "doc/utils/rfc/http-connections.scrbl", "max_forks_repo_name": "christoff-buerger/sagittarius-scheme", "max_forks_repo_forks_event_min_datetime": "2016-12-28T12:41:23.000Z", "max_forks_repo_forks_event_max_datetime": "2020-02-26T20:52:02.000Z"}
{"max_stars_count": 39, "max_issues_count": 3, "max_forks_count": 4, "avg_line_length": 39.25, "max_line_length": 80, "alphanum_fraction": 0.7477707006}
@; -*- coding: utf-8 -*-
@subsection[:tag "rfc.http-connections"]{
(rfc http-connections) - HTTP client utilities
}

@define[Library]{@name{(rfc http)}}
@desc{This library provides common interfaces of 
@secref["rfc.http"]{@code{(rfc http)}} and
@secref["rfc.http2"]{@code{(rfc http2)}} library.
}

@define[Function]{@name{http-connection?} @args{obj}}
@desc{Returns #t if the given object is an HTTP connection.}

@define[Function]{@name{http1-connection?} @args{obj}}
@desc{Returns #t if the given object is an HTTP/1.1 connection.}

@define[Function]{@name{make-http1-connection} @args{server secure?}}
@desc{Creates an HTTP/1.1 connection with destination server @var{server}.

If the @var{secure?} is true value, then it uses TLS socket.

The HTTP/1.1 connection uses @code{http-request} defined in @code{(rfc http)}
library to send an request.
}

@define[Function]{@name{http2-connection?} @args{obj}}
@desc{Returns #t if the given object is an HTTP/2 connection.}

@define[Function]{@name{make-http2-connection} @args{server secure?}}
@desc{Creates an HTTP/2 connection with destination server @var{server}.

If the @var{secure?} is true value, then it uses TLS socket.

The HTTP/1.1 connection uses @code{http2-request} defined in @code{(rfc http2)}
library to send an request.
}

@define[Function]{@name{http-connection-secure?} @args{http-connection}}
@desc{Returns #t if the given @var{http-connection} uses TLS socket to
connect target server.}

@define[Function]{@name{http-connection-server} @args{http-connection}}
@desc{Returns destination server of the @var{http-connection} as string.}

@define[Function]{@name{http-connection-server&port} @args{http-connection}}
@desc{Returns destination server and port of the @var{http-connection}.}

@define[Function]{@name{open-http-connection!} @args{http-connection}}
@desc{Opens given @var{http-connection} and returns it.}

@define[Function]{@name{close-http-connection!} @args{http-connection}}
@desc{Closes given @var{http-connection} and returns it.}

@define[Function]{@name{http-request} @args{http-connection method path . opt}}
@desc{Sends HTTP request to the path @var{path} of destination server
of @var{http-connection} with HTTP method @var{methos}.

The rest value of @var{opt} is passed to underling request sending procedure.

The procedure returns 3 values, HTTP status, HTTP header and content as
bytevector.
}

@define[Generic]{@name{http-null-receiver}}
@define[Method]{@name{http-null-receiver} @args{(conn http1-connection)}}
@define[Method]{@name{http-null-receiver} @args{(conn http2-connection)}}
@desc{Generic method of null http receiver.

The @code{http-null-receiver} forwards @code{http-null-receiver} defined
in @code{(rfc http)} for @code{http1-connection} and
@code{http2-null-receiver} defined
in @code{(rfc http2)} for @code{http2-connection}
}

@define[Generic]{@name{http-oport-receiver}}
@define[Method]{@name{http-oport-receiver}
 @args{(conn http1-connection) sink flusher}}
@define[Method]{@name{http-oport-receiver}
 @args{(conn http2-connection) sink flusher}}
@desc{Generic method of output port http receiver.

The @code{http-oport-receiver} forwards @code{http-oport-receiver} defined
in @code{(rfc http)} for @code{http1-connection} and
@code{http2-data-receiver} defined in @code{(rfc http2)} for
@code{http2-connection}
}

@define[Generic]{@name{http-blob-sender}}
@define[Method]{@name{http-blob-sender} @args{(conn http1-connection) blob}}
@define[Method]{@name{http-blob-sender} @args{(conn http2-connection) blob}}
@desc{Generic method of http blob sender.

The @code{http-blob-sender} forwards @code{http-blob-sender} defined
in @code{(rfc http)} for @code{http1-connection} and
@code{http2-data-sender} defined in @code{(rfc http2)} for
@code{http2-connection}
}

@define[Generic]{@name{http-string-sender}}
@define[Method]{@name{http-string-sender} @args{(conn http1-connection) string}}
@define[Method]{@name{http-string-sender} @args{(conn http2-connection) string}}
@desc{Generic method of http string sender.

The @code{http-string-sender} forwards @code{http-string-sender} defined
in @code{(rfc http)} for @code{http1-connection} and
@code{http2-data-sender} defined in @code{(rfc http2)} with given
@var{string} converted by @code{string->utf8} procedure defined
for @code{http2-connection}
}

@define[Generic]{@name{http-null-sender}}
@define[Method]{@name{http-null-sender} @args{(conn http1-connection)}}
@define[Method]{@name{http-null-sender} @args{(conn http2-connection)}}
@desc{Generic method of http null sender.

The @code{http-null-sender} forwards @code{http-null-sender} defined
in @code{(rfc http)} for @code{http1-connection} and does nothing
for @code{http2-connection}.
}