+ All Categories
Home > Documents > WWW & HTTP د. عـــادل يوسف أبو القاسم. W ORLD W IDE W EB ( WWW ) W 3 The World...

WWW & HTTP د. عـــادل يوسف أبو القاسم. W ORLD W IDE W EB ( WWW ) W 3 The World...

Date post: 27-Dec-2015
Category:
Upload: george-black
View: 218 times
Download: 4 times
Share this document with a friend
50
WWW & HTTP د م س ا ق ل و ا ب ا ف س و ب .عادل
Transcript
Page 1: WWW & HTTP د. عـــادل يوسف أبو القاسم. W ORLD W IDE W EB ( WWW ) W 3 The World Wide Web (abbreviated as WWW or W3, commonly known as the web) is a system.

WWW & HTTPالقاسم. د أبو يوسف عـــادل

Page 2: WWW & HTTP د. عـــادل يوسف أبو القاسم. W ORLD W IDE W EB ( WWW ) W 3 The World Wide Web (abbreviated as WWW or W3, commonly known as the web) is a system.

WORLD WIDE WEB (WWW) W3

The World Wide Web (abbreviated as WWW or W3,  commonly known as the web) is a system of interlinked hypertext documents accessed via the Internet.

 With a web browser, one can view web pages that may contain text, images, videos, and other multimedia and navigate between them via hyperlinks.

Page 3: WWW & HTTP د. عـــادل يوسف أبو القاسم. W ORLD W IDE W EB ( WWW ) W 3 The World Wide Web (abbreviated as WWW or W3, commonly known as the web) is a system.

ARCHITECTURE OF WWW

Page 4: WWW & HTTP د. عـــادل يوسف أبو القاسم. W ORLD W IDE W EB ( WWW ) W 3 The World Wide Web (abbreviated as WWW or W3, commonly known as the web) is a system.

URL

Page 5: WWW & HTTP د. عـــادل يوسف أبو القاسم. W ORLD W IDE W EB ( WWW ) W 3 The World Wide Web (abbreviated as WWW or W3, commonly known as the web) is a system.

WEB DOCUMENTS ال الويب documentsتصنف في

هي اصناف ثالثة و staticالىdynamic وactive.

الزمن على يعتمد التصنيف هذاال محتوى تحديد فيه يتم الذي

document .

Page 6: WWW & HTTP د. عـــادل يوسف أبو القاسم. W ORLD W IDE W EB ( WWW ) W 3 The World Wide Web (abbreviated as WWW or W3, commonly known as the web) is a system.

STATIC DOCUMENT

Page 7: WWW & HTTP د. عـــادل يوسف أبو القاسم. W ORLD W IDE W EB ( WWW ) W 3 The World Wide Web (abbreviated as WWW or W3, commonly known as the web) is a system.

Boldface tags

Effect of boldface tags

Page 8: WWW & HTTP د. عـــادل يوسف أبو القاسم. W ORLD W IDE W EB ( WWW ) W 3 The World Wide Web (abbreviated as WWW or W3, commonly known as the web) is a system.

Dynamic document using CGI

Page 9: WWW & HTTP د. عـــادل يوسف أبو القاسم. W ORLD W IDE W EB ( WWW ) W 3 The World Wide Web (abbreviated as WWW or W3, commonly known as the web) is a system.

Dynamic document using server-site script

Dynamic documents are sometimes referred to as server-site dynamic documents

Page 10: WWW & HTTP د. عـــادل يوسف أبو القاسم. W ORLD W IDE W EB ( WWW ) W 3 The World Wide Web (abbreviated as WWW or W3, commonly known as the web) is a system.

Active document using Java applet

Page 11: WWW & HTTP د. عـــادل يوسف أبو القاسم. W ORLD W IDE W EB ( WWW ) W 3 The World Wide Web (abbreviated as WWW or W3, commonly known as the web) is a system.

Active document using client-site script

Active documents are sometimes referred to as client-site dynamic documents

Page 12: WWW & HTTP د. عـــادل يوسف أبو القاسم. W ORLD W IDE W EB ( WWW ) W 3 The World Wide Web (abbreviated as WWW or W3, commonly known as the web) is a system.

2: Application Layer 12

WEB &HTTP ال من مجموعة على تحتوي ويب صفحة .objectsكل الobjects تكون ان  HTML file, JPEG image, Javaيمكن

applet, audio file…, على تحتوي الويب على base HTML-fileصفحة يحتوي

ال من االخرى .objectsعدد كلobjects عنوان .URLله

Example URL:

www.someschool.edu/someDept/pic.gif

host name path name

Page 13: WWW & HTTP د. عـــادل يوسف أبو القاسم. W ORLD W IDE W EB ( WWW ) W 3 The World Wide Web (abbreviated as WWW or W3, commonly known as the web) is a system.

13

HTTP HYPERTEXT TRANSFER PROTOCOL في يعمل برتكول عن عبارة

. التطبيق طبقة The Hypertext Transfer

Protocol (HTTP) is a protocol used mainly to access data on the World Wide Web.

client/server modelclient: browser that requests, receives, “displays” Web objects

server: Web server sends objects in response to requests

PC runningExplorer

Server running

Apache Webserver

Mac runningNavigator

HTTP request

HTTP re

quest

HTTP response

HTTP re

sponse

Page 14: WWW & HTTP د. عـــادل يوسف أبو القاسم. W ORLD W IDE W EB ( WWW ) W 3 The World Wide Web (abbreviated as WWW or W3, commonly known as the web) is a system.

WEB COMMUNICATION

Internet

Get http://www.google.com/index.html

HTTP Request:

HTTP Reply

Client: browser (Firefox) on local computer

Web server: apache on www.google.com

Page 15: WWW & HTTP د. عـــادل يوسف أبو القاسم. W ORLD W IDE W EB ( WWW ) W 3 The World Wide Web (abbreviated as WWW or W3, commonly known as the web) is a system.

HTTP VS HTML

HTML:  hypertext markup languageDefinitions of tags that are added to Web documents to control their appearance

HTTP:  hypertext transfer protocolThe rules governing the conversation between a Web client and a Web server 

Page 16: WWW & HTTP د. عـــادل يوسف أبو القاسم. W ORLD W IDE W EB ( WWW ) W 3 The World Wide Web (abbreviated as WWW or W3, commonly known as the web) is a system.

16

HTTP OVERVIEW (CONTINUED)Uses TCP:

الclients بانشاء serverلل TCP connectionيقومال .80رقم portفي

الServer ال اليه TCP connectionيقبل وردت التيال . clientمن

ال ويعتبر HTTPرسائل المتصفح بين تبادلها يتمHTTP client ويعتبر الويب HTTP serverومخدم

ال اغالق يتم ذلك TCP connectionبعد

Page 17: WWW & HTTP د. عـــادل يوسف أبو القاسم. W ORLD W IDE W EB ( WWW ) W 3 The World Wide Web (abbreviated as WWW or W3, commonly known as the web) is a system.

HTTP transaction

Page 18: WWW & HTTP د. عـــادل يوسف أبو القاسم. W ORLD W IDE W EB ( WWW ) W 3 The World Wide Web (abbreviated as WWW or W3, commonly known as the web) is a system.

HTTP is “stateless” الserver لالتصاالت معلومات اي علي يحتوي ال

لل .clientsالسابقة

النوع من ألنه , statefullالبرتكوالت معقدة تعتبرالسابقة . االتصاالت مع التعامل يتم ان يجب

if server/client crashes, their views of “state” may be inconsistent, must be reconciled

HTTP OVERVIEW (CONTINUED)

Page 19: WWW & HTTP د. عـــادل يوسف أبو القاسم. W ORLD W IDE W EB ( WWW ) W 3 The World Wide Web (abbreviated as WWW or W3, commonly known as the web) is a system.

19

HTTP CONNECTIONSNonpersistent HTTPAt most one object is sent over a TCP connection.

HTTP/1.0 uses nonpersistent HTTP

Persistent HTTPMultiple objects can be sent over single TCP connection between client and server.

HTTP/1.1 uses persistent connections in default mode

Page 20: WWW & HTTP د. عـــادل يوسف أبو القاسم. W ORLD W IDE W EB ( WWW ) W 3 The World Wide Web (abbreviated as WWW or W3, commonly known as the web) is a system.

20

NONPERSISTENT HTTPSuppose user enters URL www.someSchool.edu/someDepartment/home.index

1a. HTTP client initiates TCP connection to HTTP server (process) at www.someSchool.edu on port 80

2. HTTP client sends HTTP request message (containing URL) into TCP connection socket. Message indicates that client wants object someDepartment/home.index

1b. HTTP server at host www.someSchool.edu waiting for TCP connection at port 80.  “accepts” connection, notifying client

3. HTTP server receives request message, forms response message containing requested object, and sends message into its socket

time

Page 21: WWW & HTTP د. عـــادل يوسف أبو القاسم. W ORLD W IDE W EB ( WWW ) W 3 The World Wide Web (abbreviated as WWW or W3, commonly known as the web) is a system.

2: Application L

ayer

21

NONPERSISTENT HTTP (CONT.)

5. HTTP client receives response message containing html file, displays html.  Parsing html file, finds 10 referenced jpeg  objects

6. Steps 1-5 repeated for each of 10 jpeg objects

4. HTTP server closes TCP connection. 

time

Page 22: WWW & HTTP د. عـــادل يوسف أبو القاسم. W ORLD W IDE W EB ( WWW ) W 3 The World Wide Web (abbreviated as WWW or W3, commonly known as the web) is a system.

2: Application Layer 22

RESPONSE TIME MODELINGDefinition of RTT: time to send a small packet to travel from client to server and back.

Response time: one RTT to initiate TCP connection

one RTT for HTTP request and first few bytes of HTTP response to return

file transmission timetotal = 2RTT+transmit time

time to transmit file

initiate TCPconnection

RTT

requestfile

RTT

filereceived

time time

Page 23: WWW & HTTP د. عـــادل يوسف أبو القاسم. W ORLD W IDE W EB ( WWW ) W 3 The World Wide Web (abbreviated as WWW or W3, commonly known as the web) is a system.

23

PERSISTENT HTTPNonpersistent HTTP issues: requires 2 RTTs per object OS must work and allocate host resources for each TCP connection

but browsers often open parallel TCP connections to fetch referenced objects

Persistent  HTTP server leaves connection open after sending response

subsequent HTTP messages  between same client/server are sent over connection

Persistent without pipelining: client issues new request only when previous response has been received

one RTT for each referenced object

Persistent with pipelining: default in HTTP/1.1 client sends requests as soon as it encounters a referenced object

as little as one RTT for all the referenced objects

Page 24: WWW & HTTP د. عـــادل يوسف أبو القاسم. W ORLD W IDE W EB ( WWW ) W 3 The World Wide Web (abbreviated as WWW or W3, commonly known as the web) is a system.

2: Application Layer 24

HTTP REQUEST MESSAGE two types of HTTP messages: request, response HTTP request message:

ASCII (human-readable format)

GET /somedir/page.html HTTP/1.1Host: www.someschool.edu User-agent: Mozilla/4.0Connection: close Accept-language:fr

(extra carriage return, line feed)

request line(GET, POST, 

HEAD commands)

header lines

Carriage return, line feed 

indicates end of message

Page 25: WWW & HTTP د. عـــادل يوسف أبو القاسم. W ORLD W IDE W EB ( WWW ) W 3 The World Wide Web (abbreviated as WWW or W3, commonly known as the web) is a system.

27.25

REQUEST AND RESPONSE MESSAGES

Page 26: WWW & HTTP د. عـــادل يوسف أبو القاسم. W ORLD W IDE W EB ( WWW ) W 3 The World Wide Web (abbreviated as WWW or W3, commonly known as the web) is a system.

26

2: Application L

ayerHTTP REQUEST MESSAGE: GENERAL FORMAT

Page 27: WWW & HTTP د. عـــادل يوسف أبو القاسم. W ORLD W IDE W EB ( WWW ) W 3 The World Wide Web (abbreviated as WWW or W3, commonly known as the web) is a system.

Request and status lines

Page 28: WWW & HTTP د. عـــادل يوسف أبو القاسم. W ORLD W IDE W EB ( WWW ) W 3 The World Wide Web (abbreviated as WWW or W3, commonly known as the web) is a system.

28

UPLOADING FORM INPUT

Post method: Web page often includes form input Input is uploaded to server in entity body

URL method: Uses GET method Input is uploaded in URL field of request line:

www.somesite.com/animalsearch?monkeys&banana

Page 29: WWW & HTTP د. عـــادل يوسف أبو القاسم. W ORLD W IDE W EB ( WWW ) W 3 The World Wide Web (abbreviated as WWW or W3, commonly known as the web) is a system.

METHODS

Page 30: WWW & HTTP د. عـــادل يوسف أبو القاسم. W ORLD W IDE W EB ( WWW ) W 3 The World Wide Web (abbreviated as WWW or W3, commonly known as the web) is a system.

Status codes

Page 31: WWW & HTTP د. عـــادل يوسف أبو القاسم. W ORLD W IDE W EB ( WWW ) W 3 The World Wide Web (abbreviated as WWW or W3, commonly known as the web) is a system.

Status codes (continued)

Page 32: WWW & HTTP د. عـــادل يوسف أبو القاسم. W ORLD W IDE W EB ( WWW ) W 3 The World Wide Web (abbreviated as WWW or W3, commonly known as the web) is a system.

2: Application Layer 32

HTTP RESPONSE MESSAGE

HTTP/1.1 200 OK Connection closeDate: Thu, 06 Aug 1998 12:00:15 GMT Server: Apache/1.3.0 (Unix) Last-Modified: Mon, 22 Jun 1998 …... Content-Length: 6821 Content-Type: text/html data data data data data ...

status line(protocolstatus codestatus phrase)

header lines

data, e.g., requestedHTML file

Page 33: WWW & HTTP د. عـــادل يوسف أبو القاسم. W ORLD W IDE W EB ( WWW ) W 3 The World Wide Web (abbreviated as WWW or W3, commonly known as the web) is a system.

27.33

Header format

Page 34: WWW & HTTP د. عـــادل يوسف أبو القاسم. W ORLD W IDE W EB ( WWW ) W 3 The World Wide Web (abbreviated as WWW or W3, commonly known as the web) is a system.

27.34

General headers

Page 35: WWW & HTTP د. عـــادل يوسف أبو القاسم. W ORLD W IDE W EB ( WWW ) W 3 The World Wide Web (abbreviated as WWW or W3, commonly known as the web) is a system.

27.35

Request headers

Page 36: WWW & HTTP د. عـــادل يوسف أبو القاسم. W ORLD W IDE W EB ( WWW ) W 3 The World Wide Web (abbreviated as WWW or W3, commonly known as the web) is a system.

27.36

Response headers

Page 37: WWW & HTTP د. عـــادل يوسف أبو القاسم. W ORLD W IDE W EB ( WWW ) W 3 The World Wide Web (abbreviated as WWW or W3, commonly known as the web) is a system.

27.37

Entity headers

Page 38: WWW & HTTP د. عـــادل يوسف أبو القاسم. W ORLD W IDE W EB ( WWW ) W 3 The World Wide Web (abbreviated as WWW or W3, commonly known as the web) is a system.

This example retrieves a document. We use the GET method to retrieve an image with the path /usr/bin/image1. The request line shows the method (GET), the URL, and the HTTP version (1.1). The header has two lines that show that the client can accept images in the GIF or JPEG format. The request does not have a body. The response message contains the status line and four lines of header. The header lines define the date, server, MIME version, and length of the document. The body of the document follows the header

Example(1)

Page 39: WWW & HTTP د. عـــادل يوسف أبو القاسم. W ORLD W IDE W EB ( WWW ) W 3 The World Wide Web (abbreviated as WWW or W3, commonly known as the web) is a system.

27.39

Example

Page 40: WWW & HTTP د. عـــادل يوسف أبو القاسم. W ORLD W IDE W EB ( WWW ) W 3 The World Wide Web (abbreviated as WWW or W3, commonly known as the web) is a system.

In this example, the client wants to send data to the server. We use the POST method. The request line shows the method (POST), URL, and HTTP version (1.1). There are four lines of headers. The request body contains the input information. The response message contains the status line and four lines of headers. The created document, which is a CGI document, is included as the body.

Example(2)

Page 41: WWW & HTTP د. عـــادل يوسف أبو القاسم. W ORLD W IDE W EB ( WWW ) W 3 The World Wide Web (abbreviated as WWW or W3, commonly known as the web) is a system.

Example(2)

Page 42: WWW & HTTP د. عـــادل يوسف أبو القاسم. W ORLD W IDE W EB ( WWW ) W 3 The World Wide Web (abbreviated as WWW or W3, commonly known as the web) is a system.

الcookie ب Lايضا webأو HTTP cookie وتعرفcookie ال عن browser cookieاو عبارة  smallهي

piece of data ال في وتخزن ويب موقع من ارسالها يتمbrowser. الموقع لذلك المستخدم تصفح اثناء

يقوم الموقع ذلك بتحميل المستخدم فيها يقوم مرة كلال بارسال معرفة serverلل cookieالمتصفح من ليتمكن

. للمستخدم السابقة النشاطات

Cookies

Page 43: WWW & HTTP د. عـــادل يوسف أبو القاسم. W ORLD W IDE W EB ( WWW ) W 3 The World Wide Web (abbreviated as WWW or W3, commonly known as the web) is a system.

ال ان من الرغم فيروسات cookiesعلى نقل يمكنها التنزيل يمكنها قد malwareوال لكنها المستخدم جهاز في

المستخدم تتبع عمليات في يمكنها trackingتساعد حيثبواسطة historyمعرفة المواقع واستعراض التصفح

المستخدم .

Cookies can also store passwords and forms a user has previously entered, such as a credit card number or an address.

Cookies Cont.

Page 44: WWW & HTTP د. عـــادل يوسف أبو القاسم. W ORLD W IDE W EB ( WWW ) W 3 The World Wide Web (abbreviated as WWW or W3, commonly known as the web) is a system.

44

USER-SERVER STATE: COOKIES

Many major Web sites use cookiesFour components:

1) cookie header line in the HTTP response message2) cookie header line in HTTP request message3) cookie file kept on user’s host and managed by user’s browser4) back-end database at Web site

Example: Susan access Internet always from same PC She visits a specific e-commerce site for first time When initial HTTP requests arrives at site, site creates a unique ID and creates an entry in backend database for ID

Page 45: WWW & HTTP د. عـــادل يوسف أبو القاسم. W ORLD W IDE W EB ( WWW ) W 3 The World Wide Web (abbreviated as WWW or W3, commonly known as the web) is a system.

45

COOKIES: KEEPING “STATE” (CONT.)

client server

usual http request msg

usual http response +Set-cookie: 1678

usual http request msgcookie: 1678

usual http response msg

usual http request msgcookie: 1678

usual http response msg

cookie-specificaction

cookie-spectificaction

servercreates ID

1678 for user

entry in backend

database

access

acce

ss

Cookie file

amazon: 1678ebay: 8734

Cookie file

ebay: 8734

Cookie file

amazon: 1678ebay: 8734

one week later:

Page 46: WWW & HTTP د. عـــادل يوسف أبو القاسم. W ORLD W IDE W EB ( WWW ) W 3 The World Wide Web (abbreviated as WWW or W3, commonly known as the web) is a system.

46

COOKIES (CONTINUED)

What cookies can bring: authorization shopping carts recommendations user session state (Web e-mail)

Cookies and privacy: cookies permit sites to learn a lot 

about you you may supply name and e-mail 

to sites search engines use  redirection & 

cookies to learn yet more advertising  companies  obtain info 

across sites

Page 47: WWW & HTTP د. عـــادل يوسف أبو القاسم. W ORLD W IDE W EB ( WWW ) W 3 The World Wide Web (abbreviated as WWW or W3, commonly known as the web) is a system.

47

WEB CACHES (PROXY SERVER)

user sets browser: Web accesses via  cache

browser sends all HTTP requests to  cache object in cache: cache 

returns object  else cache requests object 

from origin server, then returns object to client

Goal: satisfy client request without involving origin server

client

Proxyserver

client

HTTP request

HTTP re

quest

HTTP response

HTTP re

sponse

HTTP re

quest

HTTP re

sponse

origin server

origin server

Page 48: WWW & HTTP د. عـــادل يوسف أبو القاسم. W ORLD W IDE W EB ( WWW ) W 3 The World Wide Web (abbreviated as WWW or W3, commonly known as the web) is a system.

2: Application Layer

48

MORE ABOUT WEB CACHING Cache acts as both client and server Typically cache is installed by ISP (university, company, residential ISP)

Why Web caching? Reduce response time for client request. Reduce traffic on an institution’s access link. Internet dense with caches enables “poor” content providers to effectively deliver content (but so does P2P file sharing)

Page 49: WWW & HTTP د. عـــادل يوسف أبو القاسم. W ORLD W IDE W EB ( WWW ) W 3 The World Wide Web (abbreviated as WWW or W3, commonly known as the web) is a system.

2: Application Layer

49

CONDITIONAL GET

Goal: don’t send object if cache has up-to-date cached version

cache: specify date of cached copy in HTTP requestIf-modified-since: <date>

server: response contains no object if cached copy is up-to-date: HTTP/1.0 304 Not Modified

cache server

HTTP request msgIf-modified-since:

<date>

HTTP responseHTTP/1.0

304 Not Modified

object not 

modified

HTTP request msgIf-modified-since:

<date>

HTTP responseHTTP/1.0 200 OK

<data>

object modified

Page 50: WWW & HTTP د. عـــادل يوسف أبو القاسم. W ORLD W IDE W EB ( WWW ) W 3 The World Wide Web (abbreviated as WWW or W3, commonly known as the web) is a system.

Thank You


Recommended