Everyday, you browse tons of pages on world wide web, Have you ever wondered how you get these pages or content delivered to your computer, here HTTP Header comes into play, behind the scenes.
If you look at your browser’s address bar that shows something that starts with “http://”, why it was there, so, Today we’re to going to discuss about HTTP Header. What they are? What they do?blah blah blah …….
What is HTTP Header ?
HTTP “Hypertext Transfer Protocol”, the entire World wide Web uses this protocol, even IRON MAN uses this, LoL, almost everything you see in your browser is transmitted to your computer over HTTP.
Keep in mind that HTTP header fields are components of the header section of request and response messages in the Hypertext Transfer Protocol (HTTP).
Let’s understand what happen when you type http://www.google.com/index.html in url field of the web browser. The browser parses the URL link into 3 parts:
Server Name: www.google.com
/index.html: path of the page
When this passed URL comes out of the browser it becomes HTTP Request.
The request is forwarded to the server and server send HTTP Response against particular request in the same way.
For example, when you opened teamultimate.in , your browser probably have sent over 40 HTTP requests and received HTTP responses for each.
HTTP headers are the core part of these HTTP requests and responses, and they carry information about the client browser, the requested page, the server and more.
Now come to HTTP request/response Header
Image Credit: tutsplus.com
HTTP Request Header
When you type a url in your address bar, your browser sends an HTTP request and it may look like this:
GET /tcp-header-3-way-handshake/ HTTP/1.1
User-Agent: Mozilla/6.0 (Windows; U; Windows NT 6.1; en-GB; rv:220.127.116.11) Gecko/20091102 Firefox/3.5.5 (.NET CLR 3.5.30729)
NOTE: your’s maybe different depending upon the Operating system, browser you are using and which page you’re browsing.
First line is the “Request Line” which contains some basic info on the request. And the rest are the HTTP headers.
HTTP Response Header
After that request, your browser receives an HTTP response that may look like this:
HTTP/1.x 200 OK
Date: Sat, 11 Feb 2017 03:46:55 GMT
Expires: Sat, 11 Feb 2017 04:46:55 GMT
Cache-Control: max-age=3600, public
Content-Type: text/html; charset=UTF-8
Last-Modified: Sat, 11 Feb 2017 02:46:55 GMT
X-Pingback: <a href="http://teamultimate.in/xmlrpc.php">http://teamultimate.in/xmlrpc.php</a>
Vary: Accept-Encoding, Cookie, User-Agent
<!</code><code class="html keyword">DOCTYPE</code> <code class="html plain">html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "<a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd</a>">
<</code><code class="html keyword">html</code> <code class="html color1">xmlns</code><code class="html plain">=</code><code class="html string">"<a href="http://www.w3.org/1999/xhtml">http://www.w3.org/1999/xhtml</a>"</code><code class="html plain">>
<</code><code class="html keyword">head</code><code class="html plain">>
<</code><code class="html keyword">meta</code> <code class="html color1">http-equiv</code><code class="html plain">=</code><code class="html string">"Content-Type"</code> <code class="html color1">content</code><code class="html plain">=</code><code class="html string">"text/html; charset=utf-8"</code> <code class="html plain">/>
<</code><code class="html keyword">title</code><code class="html plain">>TCP Header And 3-Way Handshake - Ultimate Hackers</</code><code class="html keyword">title</code><code class="html plain">>
<!-- ... rest of the html ... -->
The first line is the “Status Line”, followed by “HTTP headers”, until the blank line. After that, the “content” starts (the HTML output).
When you look at the source code of a web page in your browser, you will only see the HTML portion and not the HTTP headers, even though they actually have been transmitted together as you see above.
- You can use Firebug Extension for Firefox Browser to analyze HTTP Header
Now you’re introduced with HTTP Header, this will definitely help you in understanding our upcoming post.
If you want to learn more, refer to this Wikipedia article
Hope you’ve enjoyed the post and learned about HTTP Header , why they are necessary, how they works, share this if you found useful, your share will appreciate my work and motivate me to post more, also subscribe to our mailing list to get the upcoming posts directly into your inbox.
Thanks. Keep Visiting. Keep Learning. Keep Exploring.