Skip to content

Commit

Permalink
Merge pull request #1 from vibe-d/fix_ci
Browse files Browse the repository at this point in the history
Fix CI
  • Loading branch information
s-ludwig authored Feb 17, 2024
2 parents b1674c0 + 1ee430b commit 09207e0
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions source/vibe/inet/url.d
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ struct URL {
lowerschema = schema.toLower();
catch (Exception e)
assert(false, e.msg);

if (auto set = atomicLoad(map_commonInternetSchemas))
if (set.contains(lowerschema))
return set.get(lowerschema);
Expand Down Expand Up @@ -481,7 +481,7 @@ struct URL {
{
if (input.length < i + 3)
assert(false, "Invalid percent encoding");

char conv = cast(char) input[i + 1 .. i + 3].to!ubyte(16);
switch (conv)
{
Expand Down Expand Up @@ -518,16 +518,17 @@ struct URL {
- Adding slash when path is empty
- Adding slash to path when path represents a directory
- Decoding percent encoded triplets for unreserved characters
A-Z a-z 0-9 - . _ ~
A-Z a-z 0-9 - . _ ~
Params:
isDirectory = Path of the URL represents a directory, if one is
not already present, a trailing slash will be appended when `true`
isDirectory = Path of the URL represents a directory, if one is
not already present, a trailing slash will be appended when
`true`
*/
void normalize(bool isDirectory = false)
{
import std.uni : toLower;

// Lowercase host and schema
this.m_schema = this.m_schema.toLower();
this.m_host = this.m_host.toLower();
Expand All @@ -547,7 +548,7 @@ struct URL {

// Add trailing slash to empty path
if (this.m_path.empty || isDirectory)
this.m_path.endsWithSlash = true;
this.m_path.endsWithSlash = true;
}

/** Returns the normalized form of the URL.
Expand Down Expand Up @@ -834,7 +835,7 @@ private {
}

/* Encodes `input` with puny encoding
If input is all characters below `initial_n`
input is returned as is.
Expand All @@ -849,10 +850,10 @@ private {
uint b;
dchar m = dchar.max; // minchar
bool delta_overflow;

uint input_len = 0;
auto output = appender!string();

output.put("xn--");

foreach (dchar cp; input)
Expand Down Expand Up @@ -1106,16 +1107,16 @@ unittest { // URL Normalization

url = URL.parse("HTTP://[email protected]/Foo");
assert(url.normalized.toString() == "http://[email protected]/Foo");

url = URL.parse("http://example.com/%7Efoo");
assert(url.normalized.toString() == "http://example.com/~foo");

url = URL.parse("http://example.com/foo/./bar/baz/../qux");
assert(url.normalized.toString() == "http://example.com/foo/bar/qux");

url = URL.parse("http://example.com");
assert(url.normalized.toString() == "http://example.com/");

url = URL.parse("http://example.com:80/");
assert(url.normalized.toString() == "http://example.com/");

Expand Down

0 comments on commit 09207e0

Please sign in to comment.