Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

In Zend Framework in Response Class there are two different arrays for storing headers: _headers[] and _headersRaw[]. And there are appropriate methods for setting each one:

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

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

What is the reason to have "header" and "raw header"? Is there some special kind of usage in practice for each of these headers?

like image 427
Green Avatar asked Jun 26 '12 12:06

Green


People also ask

What is a raw HTTP header?

Raw means that the header is not URL-encoded, whereas if the word "raw" is omitted, the header is encoded. For example: $header = 'http://www.mywebsite.com?

What is a raw HTTP request?

The Raw HTTP action sends a HTTP request to a web server. How the response is treated depends on the method, but in general the status code and the response headers are returned in variables defined as part of the page load options.

What is HTTP and HTTP header?

HTTP headers are the name or value pairs that are displayed in the request and response messages of message headers for Hypertext Transfer Protocol (HTTP). Usually, the header name and the value are separated by a single colon. HTTP headers are an integral part of HTTP requests and responses.

Which function send a raw HTTP header?

PHP | header() Function. The header() function is an inbuilt function in PHP which is used to send a raw HTTP header. The HTTP functions are those functions which manipulate information sent to the client or browser by the Web server, before any other output has been sent.


1 Answers

using setHeader you set key vale pair without worrying about there formatting e.g

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

while in case of setRawHeader() you put the whole/full header as it is with proper formating

like image 138
Mr Coder Avatar answered Oct 02 '22 02:10

Mr Coder