RFC 2310

The Safe Response Header Field

πŸ“… published April 1998, from ietf

RFC 2310: The Safe Response Header Field πŸŽ€

Okay bestie, this is RFC 2310 πŸ¦‹, written by K. Holtman (Koen Holtman at TUE, Technische Universiteit Eindhoven 🌸). It's from the Network Working Group, its category is Experimental, and it's dated April 1998. The title block doesn't list any RFCs it obsoletes or updates, so it's standing on its own ✨

Status of this Memo

This memo defines an Experimental Protocol for the Internet community πŸ§ͺ. It does not specify an Internet standard of any kind. Discussion and suggestions for improvement are requested πŸ’¬. Distribution of this memo is unlimited 🌈.

Copyright (C) The Internet Society (1998). All Rights Reserved.

Abstract

So this doc defines a HTTP response header field called Safe πŸ’–. Its whole job is to say whether repeating an HTTP request is safe 🫢. That lets user agents handle retries of some safe requests, especially safe POST requests, in a way that's way more user-friendly ✨.

1 Introduction

Okay, the intro is basically the abstract again πŸ’…. We're defining a HTTP response header field called Safe, which can say that repeating an HTTP request is safe. That info lets user agents handle retries of some safe requests (especially safe POST requests) in a more user-friendly way 🌸.

2 Terminology and Notation

This doc uses the HTTP terminology and BNF notation from [1] πŸ“š. It also uses the key words in RFC 2119 to define how significant each requirement is πŸŽ€.

3 Rationale

Here's the tea β˜•. According to Section 9.1.1 (Safe Methods) of the HTTP/1.1 specification [1], POST requests are assumed to be unsafe by default πŸ™ˆ. In this case, unsafe means causes side effects for which the user will be held accountable.

Sometimes a user agent has to repeat a POST request πŸ”. Some examples of when that happens:

  • when retrying a POST request which gave an indeterminate error result in the previous attempt
  • when the user presses the RELOAD button while a POST result is displayed
  • when the history function is used to redisplay a POST result which is no longer in the history buffer

If the POST request is unsafe, HTTP requires explicit user confirmation before the request is repeated 😬. That confirmation dialog often looks like a repost form data?' box. It confuses a lot of people and slows navigation down anyway πŸ’€.

If the repeated POST request is safe, that user-unfriendly confirmation dialog can be skipped ✨. The problem is that plain HTTP/1.1 [1] has no mechanism that lets agents tell whether POST requests are safe, so they have to be assumed unsafe by default. This doc adds a mechanism to HTTP, the Safe header field, for telling whether a POST request is safe πŸ¦‹.

With the Safe header field, web applications that need a safe POST request (instead of a GET request) for submitting web forms can be made more user-friendly πŸ’…. A POST request might be needed for a few reasons:

  • the contents of the form are potentially very large
  • the form is used to upload a file (see [2])
  • the application needs some internationalization features (see [3]) which are only available if the form contents are transmitted in a request body the information in the form cannot be encoded in a GET request URL because of security considerations.

4 The Safe response header field

The Safe response header field is defined as an addition to the HTTP/1.x protocol suite 🧚.

Origin servers use the Safe response header field to say whether repeating the received HTTP request is safe, in the sense of Section 9.1.1 (Safe Methods) of the HTTP/1.1 specification [1] πŸ”₯. For this spec, an HTTP request counts as a repetition of a previous request if both requests:

  • are issued by the same user agent, and
  • apply to the same resource, and
  • have the same request method, and
  • both have no request body, or both have request bodies which are byte-wise identical after decoding of any content and transfer codings.

The Safe header field has the following syntax πŸŽ€:

Safe        = "Safe" ":" safe-nature
safe-nature = "yes" | "no"

Here's an example of the header field:

Safe: yes
If a Safe header field is absent in the response, the corresponding request MUST be considered unsafe, unless it is a GET or HEAD request. As GET and HEAD requests are safe by definition, user agents SHOULD ignore a Safe: no header field in GET and HEAD responses. 🚨

If a received Safe header field says that repeating a request is safe, the request MAY be repeated automatically without asking for user confirmation 🌈.

5 Security Considerations

For a discussion of the security considerations connected to HTTP form submission, see [1] πŸ”. The Safe header field introduces no new security risks.

Using GET requests for form submission has some security risks that aren't there for submission with other HTTP methods 😱. By taking away a counter-incentive to using GET requests for form submission, the Safe header field may improve overall security πŸ‘‘.

6 References

[1] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., and T. Berners-Lee, "Hypertext Transfer Protocol -- HTTP/1.1", RFC 2068, January 1997.

[2] Nebel, E., and L. Masinter, "Form-based File Upload in HTML", RFC 1867, November 1995.

[3] Yergeau, F., Nicol, G., Adams, G., and M. Duerst, "Internationalization of the Hypertext Markup Language", RFC 2070, January 1997.

7 Author's Address

Koen Holtman
Technische Universiteit Eindhoven
Postbus 513
Kamer HG 6.57
5600 MB Eindhoven (The Netherlands)

EMail: koen@win.tue.nl

Copyright (C) The Internet Society (1998). All Rights Reserved.

This document and translations of it may be copied and furnished to others, and derivative works that comment on or otherwise explain it or assist in its implementation may be prepared, copied, published and distributed, in whole or in part, without restriction of any kind, provided that the above copyright notice and this paragraph are included on all such copies and derivative works. However, this document itself may not be modified in any way, such as by removing the copyright notice or references to the Internet Society or other Internet organizations, except as needed for the purpose of developing Internet standards in which case the procedures for copyrights defined in the Internet Standards process must be followed, or as required to translate it into languages other than English.

The limited permissions granted above are perpetual and will not be revoked by the Internet Society or its successors or assigns.

This document and the information contained herein is provided on an "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. πŸ’œ

πŸ“¦ where this page comes from