What is the raw HTTP header? What is the difference between an "HTTP header" and a "raw HTTP header"?

In the Zend Framework, there are two different arrays for storing headers in the response class: _headers[]and _headersRaw[]. And there are appropriate methods for installing each of them:

setHeader(), getHeaders(), clearHeader() and

setRawHeader(), getRawHeaders(), clearRawHeaders().

What is the reason for having a "header" and a "source header"? Is there any particular use in practice for each of these headings?

+5
source share
2 answers

using setHeader, you set the vale key pair without worrying about formatting, like

$this->getResponse()->setHeader('Content-type','json');

setRawHeader() / ,

+2

...

Raw , URL-, "raw" , . :

$header = 'http://www.mywebsite.com?q=string'; // this is raw, no encoding

echo $header; // no encoding so output is -> http://www.mywebsite.com?q=mystring

echo rawurlencode($header); // URL-encoded so output is -> http%3A%2F%2Fwww.mywebsite.com%3Fq%3Dstring

:/? = URL

% 3A % 2F % 3F % 3D

.

0

All Articles