Skip to content
This repository has been archived by the owner on Aug 23, 2018. It is now read-only.

RFC 2616 -> RFC 7231 #10

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 18 additions & 24 deletions src/httpcommon/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::cmp::{PartialEq, Eq, PartialOrd, Ord};
use std::fmt;
use std::mem::transmute;

/// An HTTP status code (`Status-Code` in RFC 2616).
/// An HTTP status code (`Status-Code` in RFC 7231).
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It’s actually status-code in RFC 7231, not Status-Code.

///
/// This enum is absolutely exhaustive, covering all 500 possible values (100–599).
///
Expand Down Expand Up @@ -653,13 +653,13 @@ pub enum StatusCode {
/// 412 Precondition Failed
PreconditionFailed = 412,
/// 413 Request Entity Too Large
RequestEntityTooLarge = 413,
PayloadTooLarge = 413,
/// 414 Request-URI Too Long
RequestUriTooLong = 414,
UriTooLong = 414,
/// 415 Unsupported Media Type
UnsupportedMediaType = 415,
/// 416 Requested Range Not Satisfiable
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These doc comments need updating too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi,

I'should do it by the end of the day Chris

On Tue, Jul 1, 2014 at 2:33 AM, Chris Morgan [email protected]
wrote:

In src/httpcommon/status.rs:

 /// 414 Request-URI Too Long
  • RequestUriTooLong = 414,
  • UriTooLong = 414,
    /// 415 Unsupported Media Type
    UnsupportedMediaType = 415,
    /// 416 Requested Range Not Satisfiable

These doc comments need updating too.


Reply to this email directly or view it on GitHub
https://github.com/teepee/teepee/pull/10/files#r14383834.

RequestedRangeNotSatisfiable = 416,
RangeNotSatisfiable = 416,
/// 417 Expectation Failed
ExpectationFailed = 417,
/// 418 I'm a teapot
Expand Down Expand Up @@ -1359,10 +1359,10 @@ impl StatusCode {
Gone => Some("Gone"),
LengthRequired => Some("Length Required"),
PreconditionFailed => Some("Precondition Failed"),
RequestEntityTooLarge => Some("Request Entity Too Large"),
RequestUriTooLong => Some("Request-URI Too Long"),
PayloadTooLarge => Some("Payload Too Large"),
UriTooLong => Some("URI Too Long"),
UnsupportedMediaType => Some("Unsupported Media Type"),
RequestedRangeNotSatisfiable => Some("Requested Range Not Satisfiable"),
RangeNotSatisfiable => Some("Range Not Satisfiable"),
ExpectationFailed => Some("Expectation Failed"),
ImATeapot => Some("I'm a teapot"),
AuthenticationTimeout => Some("Authentication Timeout"),
Expand Down Expand Up @@ -1663,8 +1663,8 @@ impl ToPrimitive for StatusCode {

/// The class of an HTTP `Status-Code`.
///
/// [RFC 2616, section 6.1.1 (Status Code and Reason
/// Phrase)](https://tools.ietf.org/html/rfc2616#section-6.1.1):
/// [RFC 7231, section 6 (Response Status Codes)]
/// (https://tools.ietf.org/html/rfc7231#section-6):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The body of this quotation has also changed and should be updated.

///
/// > The first digit of the Status-Code defines the class of response. The
/// > last two digits do not have any categorization role.
Expand Down Expand Up @@ -1718,24 +1718,18 @@ impl StatusClass {
/// assert_eq!(ClientError.default_code(), BadRequest);
/// ```
///
/// The use for this is outlined in [RFC 2616, section 6.1.1 (Status Code and Reason
/// Phrase)](https://tools.ietf.org/html/rfc2616#section-6.1.1):
/// The use for this is outlined in [RFC 7231, section 6 (Response Status Code)]
/// (https://tools.ietf.org/html/rfc7231#section-6):
///
/// > HTTP status codes are extensible. HTTP applications are not required
/// > to understand the meaning of all registered status codes, though such
/// > understanding is obviously desirable. However, applications MUST
/// > HTTP status codes are extensible. HTTP clients are not required to
/// > understand the meaning of all registered status codes, though such
/// > understanding is obviously desirable. However, a client MUST
/// > understand the class of any status code, as indicated by the first
/// > digit, and treat any unrecognized response as being equivalent to the
/// > x00 status code of that class, with the exception that an
/// > unrecognized response MUST NOT be cached. For example, if an
/// > unrecognized status code of 431 is received by the client, it can
/// > safely assume that there was something wrong with its request and
/// > treat the response as if it had received a 400 status code. In such
/// > cases, user agents SHOULD present to the user the entity returned
/// > with the response, since that entity is likely to include human-
/// > readable information which will explain the unusual status.
/// > digit, and treat an unrecognized status code as being equivalent to
/// > the x00 status code of that class, with the exception that a
/// > recipient MUST NOT cache a response with an unrecognized status code.
///
/// This is demonstrated thusly (I’ll use 432 rather than 431 as 431 *is* now in use):
/// This is demonstrated thusly (I’ll use 432):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The next paragraph in RFC 7231 contains an example, now using 471; seems to me that including the paragraph and using 471 rather than 432 would be a good idea.

///
/// ```rust
/// # use httpcommon::status::{Code432, BadRequest};
Expand Down