oh dear bug city

This commit is contained in:
Adam D. Ruppe 2018-12-04 12:00:57 -05:00
parent 1da9f87b22
commit 3d922ec6c6
2 changed files with 15 additions and 0 deletions

5
cgi.d
View File

@ -2408,6 +2408,9 @@ struct Uri {
if(idx > 0 && uri[idx] == ':') {
scheme = uri[0 .. idx];
idx++;
} else {
// we need to rewind; it found a / but no :, so the whole thing is prolly a path...
idx = 0;
}
if(idx + 2 < uri.length && uri[idx .. idx + 2] == "//") {
@ -2545,6 +2548,8 @@ struct Uri {
unittest {
auto uri = Uri("test.html");
assert(uri.path == "test.html");
uri = Uri("path/1/lol");
assert(uri.path == "path/1/lol");
uri = Uri("http://me@example.com");
assert(uri.scheme == "http");
assert(uri.userinfo == "me");

10
http2.d
View File

@ -365,6 +365,9 @@ struct Uri {
if(idx > 0 && uri[idx] == ':') {
scheme = uri[0 .. idx];
idx++;
} else {
// we need to rewind; it found a / but no :, so the whole thing is prolly a path...
idx = 0;
}
if(idx + 2 < uri.length && uri[idx .. idx + 2] == "//") {
@ -1641,7 +1644,13 @@ class HttpApiClient() {
if(uri[0] == '/')
uri = uri[1 .. $];
import std.stdio; writeln(uri);
writeln(urlBase);
auto u = Uri(uri).basedOn(Uri(urlBase));
writeln(u.toString());
auto req = httpClient.navigateTo(u, requestMethod);
if(oauth2Token.length)
@ -1736,6 +1745,7 @@ class HttpApiClient() {
result ~= "=";
result ~= encodeComponent(part[1]);
}
return result;
}