Apache2-API
view release on metacpan or search on metacpan
lib/Apache2/API/Status.pm view on Meta::CPAN
500 => "Serverfehler!",
501 => "Anfrage nicht ausführbar!",
502 => "Fehlerhaftes Gateway!",
503 => "Dienst nicht verfügbar!",
504 => "Gateway-Zeitüberschreitung!",
505 => "HTTP-Version nicht unterstützt",
506 => "Variante variiert ebenfalls!",
507 => "Unzureichender Speicherplatz!",
508 => "Endlosschleife erkannt!",
509 => "Bandbreitenlimit überschritten",
510 => "Nicht erweitert",
511 => "Netzwerkauthentifizierung erforderlich",
599 => "Timeout-Fehler bei Netzwerkverbindung",
},
en_GB => {
100 => "Continue",
101 => "Switching Protocols",
102 => "Processing",
103 => "Early Hints",
200 => "OK",
201 => "Created",
202 => "Accepted",
203 => "Non-authoritative Information",
204 => "No Content",
205 => "Reset Content",
206 => "Partial Content",
207 => "Multi-Status",
208 => "Already Reported",
226 => "IM Used",
300 => "Multiple Choices",
301 => "Moved permanently!",
302 => "Found (temporary redirect)!",
303 => "See Other",
304 => "Not Modified",
305 => "Use Proxy",
307 => "Temporary redirect!",
308 => "Permanent redirect!",
400 => "Bad request!",
401 => "Authentication required!",
402 => "Payment required!",
403 => "Access forbidden!",
404 => "Object not found!",
405 => "Method not allowed!",
406 => "Not acceptable!",
407 => "Proxy authentication required!",
408 => "Request time-out!",
409 => "Conflict!",
410 => "Resource is no longer available!",
411 => "Bad Content-Length!",
412 => "Precondition failed!",
413 => "Request entity too large!",
414 => "Submitted URI too long!",
415 => "Unsupported media type!",
416 => "Range not satisfiable!",
417 => "Expectation failed!",
# Humour: April's fool
# <https://en.wikipedia.org/wiki/Hyper_Text_Coffee_Pot_Control_Protocol>
418 => "I'm a teapot",
421 => "Misdirected Request",
422 => "Unprocessable entity!",
423 => "Resource locked!",
424 => "Failed dependency!",
425 => "Too early!",
426 => "Upgrade Required!",
428 => "Precondition Required",
429 => "Too many requests!",
431 => "Request Headers Too Large!",
444 => "Connection Closed Without Response",
451 => "Unavailable for legal reasons!",
499 => "Client Closed Request",
500 => "Server error!",
501 => "Cannot process request!",
502 => "Bad Gateway!",
503 => "Service unavailable!",
504 => "Gateway timeout!",
505 => "HTTP Version Not Supported",
506 => "Variant also varies!",
507 => "Insufficient storage!",
508 => "Loop detected!",
509 => "Bandwidth Limit Exceeded",
510 => "Not Extended",
511 => "Network Authentication Required",
599 => "Network Connect Timeout Error",
},
es_ES => {
100 => "Continuar",
101 => "Cambio de protocolos",
102 => "Procesando",
103 => "Pistas tempranas",
200 => "OK",
201 => "Creado",
202 => "Aceptado",
203 => "Información no autoritativa",
204 => "Sin contenido",
205 => "Restablecer contenido",
206 => "Contenido parcial",
207 => "Multi-estado",
208 => "Ya informado",
226 => "IM usado",
300 => "Múltiples opciones",
301 => "¡Movido permanentemente!",
302 => "¡Encontrado (redirección temporal)!",
303 => "Ver otros",
304 => "No modificado",
305 => "Usar proxy",
307 => "¡Redirección temporal!",
308 => "¡Redirección permanente!",
400 => "¡Petición errónea!",
401 => "¡Autenticación requerida!",
402 => "¡Pago requerido!",
403 => "¡Acceso prohibido!",
404 => "¡Objeto no localizado!",
405 => "¡Método no permitido!",
406 => "¡No aceptable!",
407 => "¡Se requiere autenticación de proxy!",
408 => "¡Tiempo de espera excedido!",
409 => "¡Conflicto!",
410 => "¡El recurso ya no está disponible!",
411 => "¡Error en la longitud del contenido!",
412 => "¡Fallo de precondición!",
413 => "¡La entidad solicitada es demasiado grande!",
lib/Apache2/API/Status.pm view on Meta::CPAN
503 => "æåä¸å¯ç¨ï¼",
504 => "éé龿ï¼",
505 => "䏿¯æHTTPçæ¬",
506 => "è®é«ä¹æè®åï¼",
507 => "å²å空éä¸è¶³ï¼",
508 => "嵿¸¬å°å¾ªç°ï¼",
509 => "è¶
é帶寬éå¶",
510 => "æªæ´å±",
511 => "éè¦ç¶²è·¯é©è",
599 => "ç¶²çµ¡é£æ¥è¶
æé¯èª¤",
},
};
our $MAP_LANG_SHORT =
{
de => 'de_DE',
en => 'en_GB',
fr => 'fr_FR',
it => 'it_IT',
ja => 'ja_JP',
ko => 'ko_KR',
nl => 'nl_NL',
pl => 'pl_PL',
pt => 'pt_PT',
ro => 'ro_RO',
ru => 'ru_RU',
'tr' => 'tr_TR',
zh => 'zh_TW',
};
# So that querying the hash directly with $HTTP_CODES->{ja} works too
foreach my $lang ( keys( %$MAP_LANG_SHORT ) )
{
$HTTP_CODES->{ $lang } = $HTTP_CODES->{ $MAP_LANG_SHORT->{ $lang } };
}
our $STATUS_TO_TYPE =
{
301 => "moved_permanently",
302 => "moved_temporarily",
307 => "redirect_temporarily",
308 => "redirect_permanent",
400 => "bad_request",
401 => "unauthorized",
402 => "payment_required",
403 => "forbidden",
404 => "not_found",
405 => "method_not_allowed",
406 => "not_acceptable",
407 => "proxy_authentication_required",
408 => "request_time_out",
409 => "conflict",
410 => "gone",
411 => "length_required",
412 => "precondition_failed",
413 => "request_entity_too_large",
414 => "request_uri_too_large",
415 => "unsupported_media_type",
416 => "range_not_satisfiable",
417 => "expectation_failed",
422 => "unprocessable_entity",
423 => "locked",
424 => "failed_dependency",
425 => "too_early",
426 => "upgrade_required",
429 => "too_many_requests",
431 => "request_header_fields_too_large",
451 => "unavailable_for_legal_reasons",
500 => "internal_server_error",
501 => "not_implemented",
502 => "bad_gateway",
503 => "service_unavailable",
504 => "gateway_timeout",
505 => "http_version_not_supported",
506 => "variant_also_varies",
507 => "insufficient_storage",
508 => "loop_detected",
};
# Missing constants in Apache2::Const
my $additions =
{
103 => 'EARLY_HINTS',
418 => 'I_AM_A_TEA_POT',
421 => 'MISDIRECTED_REQUEST',
425 => 'TOO_EARLY',
444 => 'CONNECTION_CLOSED_WITHOUT_RESPONSE',
451 => 'UNAVAILABLE_FOR_LEGAL_REASONS',
499 => 'CLIENT_CLOSED_REQUEST',
505 => 'HTTP_VERSION_NOT_SUPPORTED',
509 => 'BANDWIDTH_LIMIT_EXCEEDED',
599 => 'NETWORK_CONNECT_TIMEOUT_ERROR',
};
foreach my $code ( keys( %$additions ) )
{
unless( Apache2::Const->can( $additions->{ $code } ) )
{
eval( "*Apache2::Const::" . $additions->{ $code } . " = sub{$code};" );
warn( "Error adding Apache2::Const for HTTP code $code: $@" ) if( $@ );
}
}
sub init
{
my $self = shift( @_ );
my $r = shift( @_ );
$self->SUPER::init( @_ );
return( $self );
}
sub convert_short_lang_to_long
{
my $self = shift( @_ );
my $lang = shift( @_ );
# Nothing to do; we already have a good value
return( $lang ) if( $lang =~ /^[a-z]{2}_[A-Z]{2}$/ );
return( $MAP_LANG_SHORT->{ lc( $lang ) } ) if( CORE::exists( $MAP_LANG_SHORT->{ lc( $lang ) } ) );
return( '' );
}
sub is_cacheable_by_default
lib/Apache2/API/Status.pm view on Meta::CPAN
=head2 HTTP_I_AM_A_TEAPOT (418)
See L<rfc 2324 on HTCPC/1.0 1-april|https://tools.ietf.org/html/rfc2324>
This status code is not actually a real one, but one that was made by the IETF as an april-fools' joke, and it stuck. Attempts to remove it was met with L<strong resistance|https://save418.com/>.
There has even been L<libraries developed|https://github.com/dkundel/htcpcp-delonghi> to implement the L<HTCPC protocol|https://github.com/HyperTextCoffeePot/HyperTextCoffeePot>.
=head2 HTTP_I_AM_A_TEA_POT (418)
Same as previous.
=head2 HTTP_MISDIRECTED_REQUEST (421)
See L<rfc 7540, section 9.1.2 on HTTP/2|https://tools.ietf.org/html/rfc7540#section-9.1.2>
This is returned when the web server received a request that was not intended for him.
For example:
GET /contact.html HTTP/1.1
Host: foo.example.org
HTTP/1.1 421 Misdirected Request
Content-Type: text/plain
Content-Length: 27
This host unsupported here.
=head2 HTTP_UNPROCESSABLE_ENTITY (422)
See L<rfc 4918, section 11.2|https://tools.ietf.org/html/rfc4918#section-11.2>
This is returned when the web server understood the request, but deemed the body content to not be processable.
For example:
POST /new-article HTTP/1.1
Content-Type: application/json
Content-Length: 26
{ "title": "Hello world!"}
Then, the web server could respond something like:
HTTP/1.1 422 Unprocessable Entity
Content-Type: application/problem+json
Content-Length: 114
{
"type" : "https://example.org/errors/missing-property",
"status": 422,
"title": "Missing property: body"
}
=head2 HTTP_LOCKED (423)
See L<rfc 4918 on WebDAV|https://tools.ietf.org/html/rfc4918>
This is returned under the WebDav protocol when one tries to make change to a locked resource.
=head2 HTTP_FAILED_DEPENDENCY (424)
See L<rfc 4918 on WebDAV|https://tools.ietf.org/html/rfc4918>
This is returned under the WebDav protocol when the processing of one of the resources failed.
=head2 HTTP_TOO_EARLY (425)
See L<rfc 8470, section 5.2 on Using Early Data in HTTP|https://tools.ietf.org/html/rfc8470#section-5.2>
This predominantly occurs during the TLS handshake to notify the client to retry a bit later once the TLS connection is up.
=head2 HTTP_NO_CODE (425)
Same as previous. Used here for compatibility with C<HTTP::Status>
=head2 HTTP_UNORDERED_COLLECTION (425)
Same as previous. Used here for compatibility with C<HTTP::Status>
=head2 HTTP_UPGRADE_REQUIRED (426)
See L<rfc 7231, section 6.5.15|https://tools.ietf.org/html/rfc7231#section-6.5.15>
This is returned to notify the client to use a newer version of the HTTP protocol.
=head2 HTTP_PRECONDITION_REQUIRED (428)
See L<rfc 6585, section 3 on Additional Codes|https://tools.ietf.org/html/rfc6585#section-3>
This is used when the web server requires the client to use condition requests, such as:
=over 4
=item L<If-Match|https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Match>
=item L<If-None-Match|https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-None-Match>
=item L<If-Modified-Since|https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Modified-Since>
=item L<If-Unmodified-Since|https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Unmodified-Since>
=item L<If-Range|https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Range>
=back
=head2 HTTP_TOO_MANY_REQUESTS (429)
See L<rfc 6585, section 4 on Additional Codes|https://tools.ietf.org/html/rfc6585#section-4>
This is returned when the server needs to notify the client to slow down the number of requests. This is predominantly used for API, but not only.
For example:
HTTP/1.1 429 Too Many Requests
Content-Type: text/plain
Content-Length: 44
Retry-After: 3600
You exceeded the limit. Try again in an hour
=head2 HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE (431)
See L<rfc 6585, section 5 on Additional Codes|https://tools.ietf.org/html/rfc6585#section-5>
This is returned when the client issued a request containing HTTP header fields that are too big in size. Most likely culprit are the HTTP cookies.
=head2 HTTP_CONNECTION_CLOSED_WITHOUT_RESPONSE (444)
This is a non-standard status code used by some web servers, such as nginx, to instruct it to close the connection without sending a response back to the client, predominantly to deny malicious or malformed requests.
This status code is actually not seen by the client, but only appears in nginx log files.
=head2 HTTP_UNAVAILABLE_FOR_LEGAL_REASONS (451)
See L<rfc 7725 on Legal Obstacles|https://tools.ietf.org/html/rfc7725>
This is returned when, for some legal reasons, the resource could not be served.
This status code has been chosen on purpose, for its relation with the book L<Fahrenheit 451|https://en.wikipedia.org/wiki/Fahrenheit_451> from Ray Bradbury. In his book, the central theme is the censorship of literature. The book title itself "Fahre...
For example:
HTTP/1.1 451 Unavailable For Legal Reasons
Link: <https://example.org/legal>; rel="blocked-by"
Content-Type text/plain
Content-Length: 48
You are prohibited from accessing this resource.
=head2 HTTP_CLIENT_CLOSED_REQUEST (499)
This is a non-standard status code used by some web servers, such as nginx, when the client has closed the connection while the web server was still processing the request.
This status code is actually not seen by the client, but only appears in nginx log files.
=head2 HTTP_INTERNAL_SERVER_ERROR (500)
See L<rfc 7231, section 6.6.1|https://tools.ietf.org/html/rfc7231#section-6.6.1>
This is returned when an internal malfunction due to some bug of general processing error.
=head2 HTTP_NOT_IMPLEMENTED (501)
See L<rfc 7231, section 6.6.2|https://tools.ietf.org/html/rfc7231#section-6.6.2>
This is returned when the web server unexpectedly does not support certain features, although the request was itself acceptable.
=head2 HTTP_BAD_GATEWAY (502)
See L<rfc 7231, section 6.6.3|https://tools.ietf.org/html/rfc7231#section-6.6.3>
This is returned by proxy servers when the original target server is not operating properly and to notify the client of this.
=head2 HTTP_SERVICE_UNAVAILABLE (503)
See L<rfc 7231, section 6.6.4|https://tools.ietf.org/html/rfc7231#section-6.6.4>
This is returned when the web server is temporally incapable of processing the request, such as due to overload.
For example:
HTTP/1.1 503 Service Unavailable
Content-Type text/plain
Content-Length: 56
Retry-After: 1800
System overload! Give us some time to increase capacity.
=head2 HTTP_GATEWAY_TIME_OUT (504)
See L<rfc 7231, section 6.6.5|https://tools.ietf.org/html/rfc7231#section-6.6.5>
This is returned by a proxy server when the upstream target server is not responding in a timely manner.
=head2 HTTP_VERSION_NOT_SUPPORTED (505)
See L<rfc 7231, section 6.6.6|https://tools.ietf.org/html/rfc7231#section-6.6.6>
This is returned when the web server does not support the HTTP version submitted by the client.
For example:
GET / HTTP/4.0
Host: www.example.org
( run in 0.779 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )