summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gmutil.c107
1 files changed, 46 insertions, 61 deletions
diff --git a/src/gmutil.c b/src/gmutil.c
index b7ddfa21..bc302bef 100644
--- a/src/gmutil.c
+++ b/src/gmutil.c
@@ -441,111 +441,96 @@ static const struct {
441} errors_[] = { 441} errors_[] = {
442 { unknownStatusCode_GmStatusCode, /* keep this as the first one (fallback return value) */ 442 { unknownStatusCode_GmStatusCode, /* keep this as the first one (fallback return value) */
443 { 0x1f4ab, /* dizzy */ 443 { 0x1f4ab, /* dizzy */
444 "Unknown Status Code", 444 "${error.badstatus}",
445 "The server responded with a status code that is not in the Gemini specification. " 445 "${error.badstatus.msg}" } },
446 "Maybe the server is from the future? Or just malfunctioning." } },
447 { failedToOpenFile_GmStatusCode, 446 { failedToOpenFile_GmStatusCode,
448 { 0x1f4c1, /* file folder */ 447 { 0x1f4c1, /* file folder */
449 "Failed to Open File", 448 "${error.openfile}",
450 "The requested file does not exist or is inaccessible. " 449 "${error.openfile.msg}" } },
451 "Please check the file path." } },
452 { invalidLocalResource_GmStatusCode, 450 { invalidLocalResource_GmStatusCode,
453 { 0, 451 { 0,
454 "Invalid Resource", 452 "${error.badresource}",
455 "The requested resource does not exist." } }, 453 "${error.badresource.msg}" } },
456 { unsupportedMimeType_GmStatusCode, 454 { unsupportedMimeType_GmStatusCode,
457 { 0x1f47d, /* alien */ 455 { 0x1f47d, /* alien */
458 "Unsupported Content Type", 456 "${error.unsupported.media}",
459 "The received content cannot be viewed with this application." } }, 457 "${error.unsupported.media.msg}" } },
460 { unsupportedProtocol_GmStatusCode, 458 { unsupportedProtocol_GmStatusCode,
461 { 0x1f61e, /* disappointed */ 459 { 0x1f61e, /* disappointed */
462 "Unsupported Protocol", 460 "${error.unsupported.protocol}",
463 "The requested protocol is not supported by this application." }, 461 "${error.unsupported.protocol.msg}" } },
464 },
465 { invalidHeader_GmStatusCode, 462 { invalidHeader_GmStatusCode,
466 { 0x1f4a9, /* pile of poo */ 463 { 0x1f4a9, /* pile of poo */
467 "Invalid Header", 464 "${error.badheader}",
468 "The received header did not conform to the Gemini specification. " 465 "${error.badheader.msg}" } },
469 "Perhaps the server is malfunctioning or you tried to contact a "
470 "non-Gemini server." } },
471 { invalidRedirect_GmStatusCode, 466 { invalidRedirect_GmStatusCode,
472 { 0x27a0, /* dashed arrow */ 467 { 0x27a0, /* dashed arrow */
473 "Invalid Redirect", 468 "${error.badredirect}",
474 "The server responded with a redirect but did not provide a valid destination URL. " 469 "${error.badredirect.msg}" } },
475 "Perhaps the server is malfunctioning." } },
476 { schemeChangeRedirect_GmStatusCode, 470 { schemeChangeRedirect_GmStatusCode,
477 { 0x27a0, /* dashed arrow */ 471 { 0x27a0, /* dashed arrow */
478 "Scheme-Changing Redirect", 472 "${error.schemeredirect}",
479 "The server attempted to redirect us to a URL whose scheme is different than the " 473 "${error.schemeredirect.msg}"} },
480 "originating URL's scheme. Here is the link so you can open it manually if appropriate."} },
481 { tooManyRedirects_GmStatusCode, 474 { tooManyRedirects_GmStatusCode,
482 { 0x27a0, /* dashed arrow */ 475 { 0x27a0, /* dashed arrow */
483 "Too Many Redirects", 476 "${error.manyredirects}",
484 "You may be stuck in a redirection loop. The next redirected URL is below if you " 477 "${error.manyredirects.msg}"} },
485 "want to continue manually."} },
486 { tlsFailure_GmStatusCode, 478 { tlsFailure_GmStatusCode,
487 { 0x1f5a7, /* networked computers */ 479 { 0x1f5a7, /* networked computers */
488 "Network/TLS Failure", 480 "${error.tls}",
489 "Failed to communicate with the host. Here is the error message:" } }, 481 "${error.tls.msg}" } },
490 { temporaryFailure_GmStatusCode, 482 { temporaryFailure_GmStatusCode,
491 { 0x1f50c, /* electric plug */ 483 { 0x1f50c, /* electric plug */
492 "Temporary Failure", 484 "${error.temporary}",
493 "The request has failed, but may succeed if you try again in the future." } }, 485 "${error.temporary.msg}" } },
494 { serverUnavailable_GmStatusCode, 486 { serverUnavailable_GmStatusCode,
495 { 0x1f525, /* fire */ 487 { 0x1f525, /* fire */
496 "Server Unavailable", 488 "${error.unavail}",
497 "The server is unavailable due to overload or maintenance. Check back later." } }, 489 "${error.unavail.msg}" } },
498 { cgiError_GmStatusCode, 490 { cgiError_GmStatusCode,
499 { 0x1f4a5, /* collision */ 491 { 0x1f4a5, /* collision */
500 "CGI Error", 492 "${error.cgi}",
501 "Failure during dynamic content generation on the server. This may be due " 493 "${error.cgi.msg}" } },
502 "to buggy serverside software." } },
503 { proxyError_GmStatusCode, 494 { proxyError_GmStatusCode,
504 { 0x1f310, /* globe */ 495 { 0x1f310, /* globe */
505 "Proxy Error", 496 "${error.proxy}",
506 "A proxy request failed because the server was unable to successfully " 497 "${error.proxy.msg}" } },
507 "complete a transaction with the remote host. Perhaps there are difficulties "
508 "with network connectivity." } },
509 { slowDown_GmStatusCode, 498 { slowDown_GmStatusCode,
510 { 0x1f40c, /* snail */ 499 { 0x1f40c, /* snail */
511 "Slow Down", 500 "${error.slowdown}",
512 "The server is rate limiting requests. Please wait..." } }, 501 "${error.slowdown.msg}" } },
513 { permanentFailure_GmStatusCode, 502 { permanentFailure_GmStatusCode,
514 { 0x1f6ab, /* no entry */ 503 { 0x1f6ab, /* no entry */
515 "Permanent Failure", 504 "${error.permanent}",
516 "Your request has failed and will fail in the future as well if repeated." } }, 505 "${error.permanent.msg}" } },
517 { notFound_GmStatusCode, 506 { notFound_GmStatusCode,
518 { 0x1f50d, /* magnifying glass */ 507 { 0x1f50d, /* magnifying glass */
519 "Not Found", 508 "${error.notfound}",
520 "The requested resource could not be found at this time." } }, 509 "${error.notfound.msg}" } },
521 { gone_GmStatusCode, 510 { gone_GmStatusCode,
522 { 0x1f47b, /* ghost */ 511 { 0x1f47b, /* ghost */
523 "Gone", 512 "${error.gone}",
524 "The resource requested is no longer available and will not be available again." } }, 513 "${error.gone.msg}" } },
525 { proxyRequestRefused_GmStatusCode, 514 { proxyRequestRefused_GmStatusCode,
526 { 0x1f6c2, /* passport control */ 515 { 0x1f6c2, /* passport control */
527 "Proxy Request Refused", 516 "${error.proxyrefusal}",
528 "The request was for a resource at a domain not served by the server and the " 517 "${error.proxyrefusal.msg}" } },
529 "server does not accept proxy requests." } },
530 { badRequest_GmStatusCode, 518 { badRequest_GmStatusCode,
531 { 0x1f44e, /* thumbs down */ 519 { 0x1f44e, /* thumbs down */
532 "Bad Request", 520 "${error.badrequest}",
533 "The server was unable to parse your request, presumably due to the " 521 "${error.badrequest.msg}" } },
534 "request being malformed." } },
535 { clientCertificateRequired_GmStatusCode, 522 { clientCertificateRequired_GmStatusCode,
536 { 0x1f511, /* key */ 523 { 0x1f511, /* key */
537 "Certificate Required", 524 "${error.cert.needed}",
538 "Access to the requested resource requires identification via " 525 "${error.cert.needed.msg}" } },
539 "a client certificate." } },
540 { certificateNotAuthorized_GmStatusCode, 526 { certificateNotAuthorized_GmStatusCode,
541 { 0x1f512, /* lock */ 527 { 0x1f512, /* lock */
542 "Certificate Not Authorized", 528 "${error.cert.auth}",
543 "The provided client certificate is valid but is not authorized for accessing " 529 "${error.cert.auth.msg}" } },
544 "the requested resource. " } },
545 { certificateNotValid_GmStatusCode, 530 { certificateNotValid_GmStatusCode,
546 { 0x1f6a8, /* revolving light */ 531 { 0x1f6a8, /* revolving light */
547 "Invalid Certificate", 532 "${error.cert.invalid}",
548 "The provided client certificate is expired or invalid." } }, 533 "${error.cert.invalid.msg}" } },
549}; 534};
550 535
551iBool isDefined_GmError(enum iGmStatusCode code) { 536iBool isDefined_GmError(enum iGmStatusCode code) {