[DOC-CVS] [doc-en] master: fix(reference/stream): HTTP headers are U+0D U+0A (CR LF) separated

[email protected] (hakre via Niels Dossche)
Newsgroups php.doc.cvs
Message-ID <[email protected]>
Author: hakre (hakre)
Committer: Niels Dossche (nielsdos)
Date: 2025-06-22T16:45:06+02:00

Commit: https://github.com/php/doc-en/commit/c49274b06187db6cf96df8a48e5a3b92d1b56b16
Raw diff: https://github.com/php/doc-en/commit/c49274b06187db6cf96df8a48e5a3b92d1b56b16.diff

fix(reference/stream): HTTP headers are U+0D U+0A (CR LF) separated

correction of the formally wrong comment and place in the example code.

streamlining the example code style on separating multiple headers over multiple lines.

compare Section 4.1 of RFC-2616 etc.

        generic-message = start-line
                          *(message-header CRLF)
                          CRLF
                          [ message-body ]

RFC-2616: https://www.rfc-editor.org/rfc/rfc2616#section-4.1
ok: /reference/stream/functions/stream-context-set-default.xml etc.

Changed paths:
  M  reference/stream/functions/stream-context-create.xml


Diff:

diff --git a/reference/stream/functions/stream-context-create.xml b/reference/stream/functions/stream-context-create.xml
index 09eff1e645d0..83d15668cb85 100644
--- a/reference/stream/functions/stream-context-create.xml
+++ b/reference/stream/functions/stream-context-create.xml
@@ -88,8 +88,9 @@
 $opts = [
   'http' => [
     'method' => "GET",
-    // Use newline \n to separate multiple headers
-    'header' => "Accept-language: en\nCookie: foo=bar",
+    // Use CRLF \r\n to separate multiple headers
+    'header' => "Accept-language: en\r\n" .
+                "Cookie: foo=bar",
   ]
 ];
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.