]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - shared/core-utils/miscs/http-error-codes.ts
stricter youtubedl format selectors (#3516)
[github/Chocobozzz/PeerTube.git] / shared / core-utils / miscs / http-error-codes.ts
index 8c8b87ba0e9efe82c61f68ed38c763c8520e1093..b2fbdfc5a09e40d41fa3083cb23be9fa3b0198b6 100644 (file)
@@ -1,6 +1,8 @@
 /**
  * Hypertext Transfer Protocol (HTTP) response status codes.
  * @see {@link https://en.wikipedia.org/wiki/List_of_HTTP_status_codes}
+ *
+ * WebDAV and other codes useless with regards to PeerTube are not listed.
  */
 export enum HttpStatusCode {
 
@@ -47,15 +49,6 @@ export enum HttpStatusCode {
    */
   ACCEPTED_202 = 202,
 
-  /**
-   * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.4
-   *
-   * SINCE HTTP/1.1
-   * The server is a transforming proxy that received a 200 OK from its origin,
-   * but is returning a modified version of the origin's response.
-   */
-  NON_AUTHORITATIVE_INFORMATION_203 = 203,
-
   /**
    * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.3.5
    *
@@ -77,18 +70,6 @@ export enum HttpStatusCode {
    */
   PARTIAL_CONTENT_206 = 206,
 
-  /**
-   * The message body that follows is an XML message and can contain a number of separate response codes,
-   * depending on how many sub-requests were made.
-   */
-  MULTI_STATUS_207 = 207,
-
-  /**
-   * The server has fulfilled a request for the resource,
-   * and the response is a representation of the result of one or more instance-manipulations applied to the current instance.
-   */
-  IM_USED_226 = 226,
-
   /**
    * Indicates multiple options for the resource from which the client may choose (via agent-driven content negotiation).
    * For example, this code could be used to present multiple video format options,
@@ -128,20 +109,6 @@ export enum HttpStatusCode {
    */
   NOT_MODIFIED_304 = 304,
 
-  /**
-   * @deprecated
-   * SINCE HTTP/1.1
-   * The requested resource is available only through a proxy, the address for which is provided in the response.
-   * Many HTTP clients (such as Mozilla and Internet Explorer) do not correctly handle responses with this status
-   * code, primarily for security reasons.
-   */
-  USE_PROXY_305 = 305,
-
-  /**
-   * No longer used. Originally meant "Subsequent requests should use the specified proxy."
-   */
-  SWITCH_PROXY_306 = 306,
-
   /**
    * SINCE HTTP/1.1
    * In this case, the request should be repeated with another URI; however, future requests should still use the original URI.
@@ -175,6 +142,8 @@ export enum HttpStatusCode {
   UNAUTHORIZED_401 = 401,
 
   /**
+   * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.2
+   *
    * Reserved for future use. The original intention was that this code might be used as part of some form of digital
    * cash or micro payment scheme, but that has not happened, and this code is not usually used.
    * Google Developers API uses this status if a particular developer has exceeded the daily limit on requests.
@@ -210,11 +179,6 @@ export enum HttpStatusCode {
    */
   NOT_ACCEPTABLE_406 = 406,
 
-  /**
-   * The client must first authenticate itself with the proxy.
-   */
-  PROXY_AUTHENTICATION_REQUIRED_407 = 407,
-
   /**
    * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.7
    *
@@ -222,12 +186,18 @@ export enum HttpStatusCode {
    * It means that the server would like to shut down this unused connection. This response is used much more since
    * some browsers, like Chrome, Firefox 27+, or IE9, use HTTP pre-connection mechanisms to speed up surfing. Also
    * note that some servers merely shut down the connection without sending this message.
+   *
+   * @
    */
   REQUEST_TIMEOUT_408 = 408,
 
   /**
+   * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.5.8
+   *
    * Indicates that the request could not be processed because of conflict in the request,
    * such as an edit conflict between multiple simultaneous updates.
+   *
+   * @see HttpStatusCode.UNPROCESSABLE_ENTITY_422 to denote a disabled feature
    */
   CONFLICT_409 = 409,
 
@@ -284,52 +254,45 @@ export enum HttpStatusCode {
   RANGE_NOT_SATISFIABLE_416 = 416,
 
   /**
-   * The server cannot meet the requirements of the Expect request-header field.
+   * The server cannot meet the requirements of the `Expect` request-header field.
    */
   EXPECTATION_FAILED_417 = 417,
 
   /**
+   * Official Documentation @ https://tools.ietf.org/html/rfc2324
+   *
    * This code was defined in 1998 as one of the traditional IETF April Fools' jokes, in RFC 2324, Hyper Text Coffee Pot Control Protocol,
    * and is not expected to be implemented by actual HTTP servers. The RFC specifies this code should be returned by
    * teapots requested to brew coffee. This HTTP status is used as an Easter egg in some websites, including PeerTube instances ;-).
    */
   I_AM_A_TEAPOT_418 = 418,
 
-  /**
-   * The request was directed at a server that is not able to produce a response (for example because a connection reuse).
-   */
-  MISDIRECTED_REQUEST_421 = 421,
-
   /**
    * Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.3
    *
    * The request was well-formed but was unable to be followed due to semantic errors.
+   * The server understands the content type of the request entity (hence a 415 (Unsupported Media Type) status code is inappropriate),
+   * and the syntax of the request entity is correct (thus a 400 (Bad Request) status code is inappropriate) but was unable to process
+   * the contained instructions. For example, this error condition may occur if an JSON request body contains well-formed (i.e.,
+   * syntactically correct), but semantically erroneous, JSON instructions.
+   *
+   * Can also be used to denote disabled features (akin to disabled syntax).
+   *
+   * @see HttpStatusCode.UNSUPPORTED_MEDIA_TYPE_415 if the `Content-Type` was not supported.
+   * @see HttpStatusCode.BAD_REQUEST_400 if the request was not parsable (broken JSON, XML)
    */
   UNPROCESSABLE_ENTITY_422 = 422,
 
   /**
-   * The resource that is being accessed is locked.
+   * Official Documentation @ https://tools.ietf.org/html/rfc4918#section-11.3
+   *
+   * The resource that is being accessed is locked. WebDAV-specific but used by some HTTP services.
+   *
+   * @deprecated use `If-Match` / `If-None-Match` instead
+   * @see {@link https://evertpot.com/http/423-locked}
    */
   LOCKED_423 = 423,
 
-  /**
-   * The request failed due to failure of a previous request (e.g., a PROPPATCH).
-   */
-  FAILED_DEPENDENCY_424 = 424,
-
-  /**
-   * The client should switch to a different protocol such as TLS/1.0, given in the Upgrade header field.
-   */
-  UPGRADE_REQUIRED_426 = 426,
-
-  /**
-   * The origin server requires the request to be conditional.
-   * Intended to prevent "the 'lost update' problem, where a client
-   * GETs a resource's state, modifies it, and PUTs it back to the server,
-   * when meanwhile a third party has modified the state on the server, leading to a conflict."
-   */
-  PRECONDITION_REQUIRED_428 = 428,
-
   /**
    * Official Documentation @ https://tools.ietf.org/html/rfc6585#section-4
    *
@@ -359,6 +322,8 @@ export enum HttpStatusCode {
   INTERNAL_SERVER_ERROR_500 = 500,
 
   /**
+   * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.6.2
+   *
    * The server either does not recognize the request method, or it lacks the ability to fulfill the request.
    * Usually this implies future availability (e.g., a new feature of a web-service API).
    */
@@ -385,11 +350,6 @@ export enum HttpStatusCode {
    */
   HTTP_VERSION_NOT_SUPPORTED_505 = 505,
 
-  /**
-   * Transparent content negotiation for the request results in a circular reference.
-   */
-  VARIANT_ALSO_NEGOTIATES_506 = 506,
-
   /**
    * Official Documentation @ https://tools.ietf.org/html/rfc2518#section-10.6
    *
@@ -397,23 +357,8 @@ export enum HttpStatusCode {
    * server is unable to store the representation needed to successfully complete the request. This condition is
    * considered to be temporary. If the request which received this status code was the result of a user action,
    * the request MUST NOT be repeated until it is requested by a separate user action.
+   *
+   * @see HttpStatusCode.PAYLOAD_TOO_LARGE_413 for quota errors
    */
   INSUFFICIENT_STORAGE_507 = 507,
-
-  /**
-   * The server detected an infinite loop while processing the request.
-   */
-  LOOP_DETECTED_508 = 508,
-
-  /**
-   * Further extensions to the request are required for the server to fulfill it.
-   */
-  NOT_EXTENDED_510 = 510,
-
-  /**
-   * The client needs to authenticate to gain network access.
-   * Intended for use by intercepting proxies used to control access to the network (e.g., "captive portals" used
-   * to require agreement to Terms of Service before granting full Internet access via a Wi-Fi hotspot).
-   */
-  NETWORK_AUTHENTICATION_REQUIRED_511 = 511
 }