diff options
Diffstat (limited to 'src/gmutil.c')
-rw-r--r-- | src/gmutil.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/gmutil.c b/src/gmutil.c index 3af42cd1..ed3e7218 100644 --- a/src/gmutil.c +++ b/src/gmutil.c | |||
@@ -36,8 +36,8 @@ void init_Url(iUrl *d, const iString *text) { | |||
36 | iRegExpMatch m; | 36 | iRegExpMatch m; |
37 | init_RegExpMatch(&m); | 37 | init_RegExpMatch(&m); |
38 | if (matchString_RegExp(absoluteUrlPattern_, text, &m)) { | 38 | if (matchString_RegExp(absoluteUrlPattern_, text, &m)) { |
39 | d->protocol = capturedRange_RegExpMatch(&m, 1); | 39 | d->scheme = capturedRange_RegExpMatch(&m, 1); |
40 | d->host = capturedRange_RegExpMatch(&m, 2); | 40 | d->host = capturedRange_RegExpMatch(&m, 2); |
41 | if (!isEmpty_Range(&d->host)) { | 41 | if (!isEmpty_Range(&d->host)) { |
42 | d->host.start += 2; /* skip the double slash */ | 42 | d->host.start += 2; /* skip the double slash */ |
43 | } | 43 | } |
@@ -55,13 +55,13 @@ void init_Url(iUrl *d, const iString *text) { | |||
55 | relativeUrlPattern_ = new_RegExp("([a-z]+:)?([^?]*)(\\?.*)?", 0); | 55 | relativeUrlPattern_ = new_RegExp("([a-z]+:)?([^?]*)(\\?.*)?", 0); |
56 | } | 56 | } |
57 | if (matchString_RegExp(relativeUrlPattern_, text, &m)) { | 57 | if (matchString_RegExp(relativeUrlPattern_, text, &m)) { |
58 | d->protocol = capturedRange_RegExpMatch(&m, 1); | 58 | d->scheme = capturedRange_RegExpMatch(&m, 1); |
59 | d->path = capturedRange_RegExpMatch(&m, 2); | 59 | d->path = capturedRange_RegExpMatch(&m, 2); |
60 | d->query = capturedRange_RegExpMatch(&m, 3); | 60 | d->query = capturedRange_RegExpMatch(&m, 3); |
61 | } | 61 | } |
62 | } | 62 | } |
63 | if (!isEmpty_Range(&d->protocol)) { | 63 | if (!isEmpty_Range(&d->scheme)) { |
64 | d->protocol.end--; /* omit the colon */ | 64 | d->scheme.end--; /* omit the colon */ |
65 | } | 65 | } |
66 | } | 66 | } |
67 | 67 | ||
@@ -115,10 +115,10 @@ void cleanUrlPath_String(iString *d) { | |||
115 | deinit_String(&clean); | 115 | deinit_String(&clean); |
116 | } | 116 | } |
117 | 117 | ||
118 | iRangecc urlProtocol_String(const iString *d) { | 118 | iRangecc urlScheme_String(const iString *d) { |
119 | iUrl url; | 119 | iUrl url; |
120 | init_Url(&url, d); | 120 | init_Url(&url, d); |
121 | return url.protocol; | 121 | return url.scheme; |
122 | } | 122 | } |
123 | 123 | ||
124 | iRangecc urlHost_String(const iString *d) { | 124 | iRangecc urlHost_String(const iString *d) { |
@@ -132,20 +132,20 @@ const iString *absoluteUrl_String(const iString *d, const iString *urlMaybeRelat | |||
132 | iUrl rel; | 132 | iUrl rel; |
133 | init_Url(&orig, d); | 133 | init_Url(&orig, d); |
134 | init_Url(&rel, urlMaybeRelative); | 134 | init_Url(&rel, urlMaybeRelative); |
135 | if (equalCase_Rangecc(rel.protocol, "data") || equalCase_Rangecc(rel.protocol, "about")) { | 135 | if (equalCase_Rangecc(rel.scheme, "data") || equalCase_Rangecc(rel.scheme, "about")) { |
136 | /* Special case, the contents should be left unparsed. */ | 136 | /* Special case, the contents should be left unparsed. */ |
137 | return urlMaybeRelative; | 137 | return urlMaybeRelative; |
138 | } | 138 | } |
139 | const iBool isRelative = !isDef_(rel.host); | 139 | const iBool isRelative = !isDef_(rel.host); |
140 | iRangecc protocol = range_CStr("gemini"); | 140 | iRangecc scheme = range_CStr("gemini"); |
141 | if (isDef_(rel.protocol)) { | 141 | if (isDef_(rel.scheme)) { |
142 | protocol = rel.protocol; | 142 | scheme = rel.scheme; |
143 | } | 143 | } |
144 | else if (isRelative && isDef_(orig.protocol)) { | 144 | else if (isRelative && isDef_(orig.scheme)) { |
145 | protocol = orig.protocol; | 145 | scheme = orig.scheme; |
146 | } | 146 | } |
147 | iString *absolute = collectNew_String(); | 147 | iString *absolute = collectNew_String(); |
148 | appendRange_String(absolute, protocol); | 148 | appendRange_String(absolute, scheme); |
149 | appendCStr_String(absolute, "://"); { | 149 | appendCStr_String(absolute, "://"); { |
150 | const iUrl *selHost = isDef_(rel.host) ? &rel : &orig; | 150 | const iUrl *selHost = isDef_(rel.host) ? &rel : &orig; |
151 | appendRange_String(absolute, selHost->host); | 151 | appendRange_String(absolute, selHost->host); |
@@ -154,7 +154,7 @@ const iString *absoluteUrl_String(const iString *d, const iString *urlMaybeRelat | |||
154 | appendRange_String(absolute, selHost->port); | 154 | appendRange_String(absolute, selHost->port); |
155 | } | 155 | } |
156 | } | 156 | } |
157 | if (isDef_(rel.protocol) || isDef_(rel.host) || startsWith_Rangecc(rel.path, "/")) { | 157 | if (isDef_(rel.scheme) || isDef_(rel.host) || startsWith_Rangecc(rel.path, "/")) { |
158 | appendRange_String(absolute, rel.path); /* absolute path */ | 158 | appendRange_String(absolute, rel.path); /* absolute path */ |
159 | } | 159 | } |
160 | else { | 160 | else { |