@@ -706,31 +706,37 @@ Session
706706
707707The session information is in its own document: :doc: `/components/http_foundation/sessions `.
708708
709- Safe content preference - RFC 8674
710- ----------------------------------
709+ Safe Content Preference
710+ -----------------------
711711
712- `RFC 8674 `_ (not yet an IETF standard) defines a way for user agents to ask for "safe"
713- content to a server. Symfony offers 2 methods to interact with this preference:
712+ Some web sites have a "safe" mode to assist those who don't want to be exposed
713+ to content to which they might object. The `RFC 8674 `_ specification defines a
714+ way for user agents to ask for safe content to a server.
715+
716+ The specification does not define what content might be considered objectionable,
717+ so the concept of "safe" is not precisely defined. Rather, the term is interpreted
718+ by the server and within the scope of each web site that chooses to act upon this information.
719+
720+ Symfony offers two methods to interact with this preference:
714721
715722* :method: `Symfony\\ Component\\ HttpFoundation\\ Request::preferSafeContent `;
716723* :method: `Symfony\\ Component\\ HttpFoundation\\ Response::setContentSafe `;
717724
718- When the user agent prefers "safe" content, you can detect it and send it a more appropriate
719- reponse::
725+ .. versionadded :: 5.1
726+
727+ The ``preferSafeContent() `` and ``setContentSafe() `` methods were introduced
728+ in Symfony 5.1.
729+
730+ The following example shows how to detect if the user agent prefers "safe" content::
720731
721732 if ($request->preferSafeContent()) {
722733 $response = new Response($alternativeContent);
723- $response->setContentSafe(); // Inform the user we respected their preferences
724-
734+ // this informs the user we respected their preferences
735+ $response->setContentSafe();
736+
725737 return $response;
726738 }
727739
728- .. note ::
729-
730- The RFC 8674 does not define a precise semantic for "safe". Rather, the term is interpreted
731- by the server and within the scope of each web site that chooses to act upon this information.
732-
733-
734740Learn More
735741----------
736742
0 commit comments