From 13f3709acb98e9545f46d5483e18b7f57364687e Mon Sep 17 00:00:00 2001 From: "Adam D. Ruppe" Date: Mon, 11 Feb 2019 14:38:59 -0500 Subject: [PATCH] catchup --- http.d | 2 +- http2.d | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/http.d b/http.d index 624c2dc..28cc3f1 100644 --- a/http.d +++ b/http.d @@ -3,7 +3,7 @@ I no longer work on this, use http2.d instead. +/ -module arsd.http; +deprecated module arsd.http; import std.socket; diff --git a/http2.d b/http2.d index 614781b..1f97919 100644 --- a/http2.d +++ b/http2.d @@ -75,6 +75,20 @@ HttpRequest get(string url) { return request; } +HttpRequest post(string url, string[string] req) { + auto client = new HttpClient(); + ubyte[] bdata; + foreach(k, v; req) { + if(bdata.length) + bdata ~= cast(ubyte[]) "&"; + bdata ~= cast(ubyte[]) encodeComponent(k); + bdata ~= cast(ubyte[]) "="; + bdata ~= cast(ubyte[]) encodeComponent(v); + } + auto request = client.request(Uri(url), HttpVerb.POST, bdata, "application/x-www-form-urlencoded"); + return request; +} + /// gets the text off a url. basic operation only. string getText(string url) { auto request = get(url); @@ -1090,7 +1104,6 @@ class HttpRequest { ubyte[] sendBuffer; HttpResponse responseData; - HttpRequestParameters parameters; private HttpClient parentClient; size_t bodyBytesSent;