Apply the same optimization to InetPathFormat.encodeSegment.

This commit is contained in:
Sönke Ludwig 2021-01-18 14:50:57 +01:00
parent 4bb5fc9ce8
commit dc0fe5ad73

View file

@ -1881,15 +1881,13 @@ struct InetPathFormat {
import std.array : appender;
foreach (i, char c; segment) {
if (isAsciiAlphaNum(c)) continue;
switch (c) {
default:
auto ret = appender!string;
ret.put(segment[0 .. i]);
encodeSegment(ret, segment[i .. $]);
return ret.data;
case 'a': .. case 'z':
case 'A': .. case 'Z':
case '0': .. case '9':
case '-', '.', '_', '~':
case '!', '$', '&', '\'', '(', ')', '*', '+', ',', ';', '=':
case ':', '@':