+ All Categories
Home > Documents > Operating Systems Lesson 12. HTTP vs HTML HTML: hypertext markup language ◦ Definitions of tags...

Operating Systems Lesson 12. HTTP vs HTML HTML: hypertext markup language ◦ Definitions of tags...

Date post: 17-Jan-2016
Category:
Upload: oswald-brooks
View: 218 times
Download: 0 times
Share this document with a friend
19
Operating Systems Operating Systems Lesson 12
Transcript
Page 1: Operating Systems Lesson 12. HTTP vs HTML HTML: hypertext markup language ◦ Definitions of tags that are added to Web documents to control their appearance.

Operating SystemsOperating Systems

Lesson 12

Page 2: Operating Systems Lesson 12. HTTP vs HTML HTML: hypertext markup language ◦ Definitions of tags that are added to Web documents to control their appearance.

HTTP vs HTMLHTTP vs HTML

HTML: hypertext markup language◦ Definitions of tags that are added to Web

documents to control their appearance

HTTP: hypertext transfer protocol◦ The rules governing the conversation

between a Web client and a Web server

Page 3: Operating Systems Lesson 12. HTTP vs HTML HTML: hypertext markup language ◦ Definitions of tags that are added to Web documents to control their appearance.

HTMLHTML<html>

<body><h1>My First Heading</h1><p>My first paragraph.</p><img src="hackanm.gif" width="45“

height="45" /></body>

</html>

Page 4: Operating Systems Lesson 12. HTTP vs HTML HTML: hypertext markup language ◦ Definitions of tags that are added to Web documents to control their appearance.

HTTPHTTP

•HTPP is a text-based protocol: uses text to represent its control messages

•HTTP is a asymmetric: there are a client and server

•HTTP is stateless: a session consist of single request/response pair

•HTTP servers usually listen to incoming TCP connection on port 80

Page 5: Operating Systems Lesson 12. HTTP vs HTML HTML: hypertext markup language ◦ Definitions of tags that are added to Web documents to control their appearance.

URLURL

Page 6: Operating Systems Lesson 12. HTTP vs HTML HTML: hypertext markup language ◦ Definitions of tags that are added to Web documents to control their appearance.

HTTP RequestHTTP Request

Page 7: Operating Systems Lesson 12. HTTP vs HTML HTML: hypertext markup language ◦ Definitions of tags that are added to Web documents to control their appearance.

HTTP ResponseHTTP Response

Page 8: Operating Systems Lesson 12. HTTP vs HTML HTML: hypertext markup language ◦ Definitions of tags that are added to Web documents to control their appearance.

HTTP request formatHTTP request format

Cr=‘\r’ lf=‘\n’

Page 9: Operating Systems Lesson 12. HTTP vs HTML HTML: hypertext markup language ◦ Definitions of tags that are added to Web documents to control their appearance.

HTTP response formatHTTP response format

Page 10: Operating Systems Lesson 12. HTTP vs HTML HTML: hypertext markup language ◦ Definitions of tags that are added to Web documents to control their appearance.

Static vs. Dynamically Static vs. Dynamically Generated HTML pagesGenerated HTML pages

Page 11: Operating Systems Lesson 12. HTTP vs HTML HTML: hypertext markup language ◦ Definitions of tags that are added to Web documents to control their appearance.

Passing Parameters to the Passing Parameters to the Web ServerWeb Server

HTML:

<form name="input" action=“form.asp" method="get"> <input type="text" name="user" /> <input type="submit" value="Submit" /></form>

Browser:

HTTP Request:GET form.asp?user=tom HTTP/1.1

Common Gateway Interface(CGI) Standard for passing query parameters to the scripts/applications Parameters(query string) via environment variable

Submit

Page 12: Operating Systems Lesson 12. HTTP vs HTML HTML: hypertext markup language ◦ Definitions of tags that are added to Web documents to control their appearance.

Some HTTP Request Some HTTP Request MethodsMethods

GET: retrieve information identified by the URL.

HEAD: retrieve meta-information about the URL

POST: send information to a URL and retrieve result.

HTTP 12

Page 13: Operating Systems Lesson 12. HTTP vs HTML HTML: hypertext markup language ◦ Definitions of tags that are added to Web documents to control their appearance.

Response Status LineResponse Status LineHTTP-Version Status-Code Message

◦Status Code is 3 digit number (for computers) 1xx Informational 2xx Success 3xx Redirection 4xx Client Error 5xx Server Error

◦Message is text (for humans)

HTTP 13

Page 14: Operating Systems Lesson 12. HTTP vs HTML HTML: hypertext markup language ◦ Definitions of tags that are added to Web documents to control their appearance.

Example Status LinesExample Status LinesHTTP/1.0 200 OK

HTTP/1.0 301 Moved Permanently

HTTP 1/0 304 Not Modified

HTTP/1.0 400 Bad Request

HTTP/1.0 500 Internal Server Error

HTTP 14

Page 15: Operating Systems Lesson 12. HTTP vs HTML HTML: hypertext markup language ◦ Definitions of tags that are added to Web documents to control their appearance.

Some Request HeadersSome Request HeadersUser-Agent

◦Identification of the browser software

Accept◦MIME types that browser is ready to

accept

If-Modified-Since◦Date of cached reqource

Page 16: Operating Systems Lesson 12. HTTP vs HTML HTML: hypertext markup language ◦ Definitions of tags that are added to Web documents to control their appearance.

Some Response HeadersSome Response HeadersContent-Type:

◦ Type of the returned content◦ MIME identifier◦ text/html, video/mpeg

Content-Length◦ Size of the content in bytes

Last-Modified◦ Date of last modification

Page 17: Operating Systems Lesson 12. HTTP vs HTML HTML: hypertext markup language ◦ Definitions of tags that are added to Web documents to control their appearance.

Persistent ConnectionPersistent ConnectionHTTP 1.0 TCP connection is closed

after each request/response exchange

HTTP 1.1 allows keeping TCP connection for next request/response

Browser: request header◦Connection:Keep-Alive◦Default in HTTP 1.1

Page 18: Operating Systems Lesson 12. HTTP vs HTML HTML: hypertext markup language ◦ Definitions of tags that are added to Web documents to control their appearance.

CookiesCookiesNeed a state over HTTPCookie Mechanism

◦Server instructs browser to keep a named value and send it back to the server along with next request

Cookie Expiration Policy◦Session cookie: forget cookie after

browser is closed◦Expiration time: forget after

prescribed time

Page 19: Operating Systems Lesson 12. HTTP vs HTML HTML: hypertext markup language ◦ Definitions of tags that are added to Web documents to control their appearance.

Cookie HeadersCookie Headers Server (Response Header)

◦Set-Cookie: name_a=value

Client (request Header)

◦ Cookie: name_a=value; name_b=value


Recommended