Download presentation
Presentation is loading. Please wait.
Published byΙπποκράτης Μεσσηνέζης Modified over 6 years ago
1
Kevin Harville Source: Webmaster in a Nutshell, O'Rielly Books
HTTP HEADERS Kevin Harville Source: Webmaster in a Nutshell, O'Rielly Books
2
HTTP HyperText Transfer Protocol
3
Requests 1. The client contacts the server with a request header. The first line has the following: Request Method File Requested HTTP Version (typically 1.0 or 1.1) GET /index.html HTTP/1.1
4
Optional information 2. The client follows this with the actual request header: User-Agent: Mozilla/4.05(WinNT; I) Accept: image/gif, image/jpeg [etc.] The header is followed by a blank line
5
A third section A third section can follow the blank line of the header. This is called the entity body.
6
Response The server sends back a header that includes the response code indicating success or failure of the request. The first line is the status line. HTTP/ OK
7
Response This is followed by the header information.
This header contains information about 2 things: The Requested File The Server
8
Response Example The header ends with a blank line.
HTTP/ OK Date: Fri, 20 Sep :17:58 GMT Server: NCSA/1.5.2 Last-modified: Mon, 17 Jun :53:08 GMT Content-type: text/html Content-length: 2482 <html> The header ends with a blank line. The blank line is followed by the content.
9
GET Requests GET Requests are the typical method to request any page.
The href may include information to be passed on in the header: GET /page.cgi?name=Kevin&age=29 HTTP/1.1
10
In the header... Since our querystring is passed over in the header, when we refresh the page the information is automatically updated. GET /page.cgi?name=Kevin&age=29 HTTP/1.1
11
POST GET /index.html HTTP/1.1 User-Agent: Mozilla/4.05(WinNT; I)
Accept: image/gif, image/jpeg [etc.] name=kevin&age=29 Remember, the first section is the request method, file, and protocol. The second section is the optional header information The third section is the entity body -- the data we pass on in our request.
12
Refreshing Information
Since the POST information in the entity body is not part of the header request, it is not automatically renewed when we return to the page. This is why some pages we return to come up with a request we refresh them.
13
General Headers Additional request header lines may indicate many things: Cache-control - If a new version should be requested. Connection Keep-Alives - If the server should stand by for a few seconds awaiting a related request (i.e. for a gif file on a page) Date Info Encoding - Languages etc Content Information --regarding the entity body. Accept -- What types of media the browser explicity understands.
14
Cookies Cookies are actually sent and read through HTTP Headers!
"Each time a browser goes to a web page it checks its cookies file for any cookies stored for that URL. If there are any, the browser includes a Cookie header in the request containing the cookies name=value pairs." Cookie: name=fred; age=28
15
Cookies - Response Set-Cookie: name=fred; age=28
Remember, this is all in the header.
16
Summary HTTP Requests are made by the client and Responded to by the server. In both cases headers and a possible entity body are included. HTTP is THE protocol by which we communicate between the server and client.* An understanding of these concepts is necessary to create dynamically generated Web sites. *TCP/IP has to do with packets and addresses
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.