handy-http-transport 1.0.2
Implementations of HTTP transport protocols.
To use this package, run the following command in your project's root directory:
Manual usage
Put the following dependency into your project's dependences section:
http-transport
This library provides implementations of various versions of HTTP transport, acting as a "glue" for connecting clients and servers. Practically speaking, the handy-http-transport library provides HTTP server implementations you can use interchangeably with other handy-http libraries.
For now, see the section on HTTP/1.1, as that's the only HTTP version implemented so far.
HTTP/1.1
Use the Http1Transport
implementation of HttpTransport
to serve content
using the HTTP/1.1 protocol. See the example below:
import handy_http_primitives;
import handy_http_transport;
class MyHandler : HttpRequestHandler {
void handle(ref ServerHttpRequest req, ref Server HttpResponse resp) {
response.status = HttpStatus.OK;
response.headers.add("Content-Type", "text/plain");
response.outputStream.writeToStream(cast(ubyte[]) "Hello world!");
}
}
void main() {
HttpTransport tp = new Http1Transport(new MyHandler(), 8080);
tp.start();
}
- Registered by Andrew Lalis
- 1.0.2 released 48 minutes ago
- handy-http/handy-http-transport
- CC0
- Copyright © 2024, Andrew Lalis
- Authors:
- Dependencies:
- photon, streams, handy-http-primitives
- Versions:
-
1.0.2 2025-Jan-14 1.0.1 2025-Jan-13 1.0.0 2025-Jan-10 ~main 2025-Jan-14 - Download Stats:
-
-
1 downloads today
-
1 downloads this week
-
1 downloads this month
-
1 downloads total
-
- Score:
- 0.1
- Short URL:
- handy-http-transport.dub.pm