summaryrefslogtreecommitdiff
path: root/src/gmutil.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gmutil.c')
-rw-r--r--src/gmutil.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/gmutil.c b/src/gmutil.c
index 718a0a9a..3ca93901 100644
--- a/src/gmutil.c
+++ b/src/gmutil.c
@@ -262,7 +262,20 @@ void urlEncodePath_String(iString *d) {
262 delete_String(encoded); 262 delete_String(encoded);
263} 263}
264 264
265static iBool isSupportedUrlScheme_Rangecc_(iRangecc scheme) { 265iBool isKnownScheme_Rangecc(iRangecc scheme) {
266 if (isKnownUrlScheme_Rangecc(scheme)) {
267 return iTrue;
268 }
269 static const char *uriSchemes[] = { "about", "data" };
270 iForIndices(i, uriSchemes) {
271 if (equalCase_Rangecc(scheme, uriSchemes[i])) {
272 return iTrue;
273 }
274 }
275 return iFalse;
276}
277
278iBool isKnownUrlScheme_Rangecc(iRangecc scheme) {
266 static const char *schemes[] = { "gemini", "gopher", "finger", "http", "https", "file" }; 279 static const char *schemes[] = { "gemini", "gopher", "finger", "http", "https", "file" };
267 iForIndices(i, schemes) { 280 iForIndices(i, schemes) {
268 if (equalCase_Rangecc(scheme, schemes[i])) { 281 if (equalCase_Rangecc(scheme, schemes[i])) {
@@ -277,7 +290,7 @@ const iString *absoluteUrl_String(const iString *d, const iString *urlMaybeRelat
277 iUrl rel; 290 iUrl rel;
278 init_Url(&orig, d); 291 init_Url(&orig, d);
279 init_Url(&rel, urlMaybeRelative); 292 init_Url(&rel, urlMaybeRelative);
280 if (!isEmpty_Range(&rel.scheme) && !isSupportedUrlScheme_Rangecc_(rel.scheme) && 293 if (!isEmpty_Range(&rel.scheme) && !isKnownUrlScheme_Rangecc(rel.scheme) &&
281 isEmpty_Range(&rel.host)) { 294 isEmpty_Range(&rel.host)) {
282 /* Probably not an URL, so we can't make this absolute. */ 295 /* Probably not an URL, so we can't make this absolute. */
283 return urlMaybeRelative; 296 return urlMaybeRelative;
@@ -475,6 +488,9 @@ const char *mediaType_Path(const iString *path) {
475 endsWithCase_String(path, ".hpp")) { 488 endsWithCase_String(path, ".hpp")) {
476 return "text/plain"; 489 return "text/plain";
477 } 490 }
491 else if (endsWithCase_String(path, ".pem")) {
492 return "application/x-pem-file";
493 }
478 else if (endsWithCase_String(path, ".zip")) { 494 else if (endsWithCase_String(path, ".zip")) {
479 return "application/zip"; 495 return "application/zip";
480 } 496 }