28
Hyper Text Transfer Protocol Seree Chinodom [email protected]

Hyper Text Transfer Protocol

Embed Size (px)

DESCRIPTION

Hyper Text Transfer Protocol. Seree Chinodom [email protected]. Network Protocols. Layered Approach to Networks Transport Layer Protocols Application Layer Protocols. Types of Transport Layer Services. Connectionless User Datagram Protocol (UDP) - PowerPoint PPT Presentation

Citation preview

Hyper Text Transfer Protocol

Seree [email protected]

Network ProtocolsLayered Approach to

NetworksTransport Layer ProtocolsApplication Layer Protocols

Types of Transport Layer ServicesConnectionless

User Datagram Protocol (UDP)

Connection OrientedTransmission Contorl Protocol (TCP)

HTTPHyperText Transfer ProtocalApplication Layer Protocol เป็�น Connection Oriented

Service ทำ��ง�นโดยใช้� Request-Response

Model

HTTP Versions 09HTTP/ . เมื่��อป็�1990 (10 RFC 1945 เมื่��อป็�1992

MINE ทำ��ให้�ส่�งข้�อมื่�ลแบบส่��อผส่มื่ได� ป็ จจ"บ#น 11: HTTP/ . (RFC 2068)

ป็�1997 อน�คต : HTTP Next Generation

Uniform Resource Identifier : URI Uniform Resource Locator(URL) Uniform Resource Name (URN)

Protocall://<Host[:Port_Number ]>/<File_Name>

Protocall ได�แก่� http, FTP,WAIS,Telnet, Gopher,News

Host_Name ใช้�ระบ"ช้��อเคร��องห้ร�อ IP addressPort_Number ห้มื่�ยเลข้พอร*ตทำ+�ใช้�ต,ดต�อก่#บ Web

ServerFile_Name ใช้�ระบ"ช้��อไฟล*ห้ร�อเอก่ส่�ร HTML โดยต�อง

ระบ" path ข้องไฟล*ด�วย

Date and Time 11HTTP/ . ก่��ห้นดว#น เวล�ได�3แบบ RFC 1123

Sun, 06Nov199808:59:59GMT RFC 1036

Sunday, 06Nov9808:59:59GMT asctime() ข้อง ANSI C

SunNov608:59:591998GMT GMT :Greenwich Mean Time

Basic HTTP เป็�นก่�รทำ��ง�นแบบ

Request/ResponseHTTP Request Header

บรรจ"ข้�อมื่�ลต��งๆทำ+�จะบอก่ให้� serverทำร�บเง��อนไข้และข้�อมื่�ล

HTTP Response Header เอก่ส่�รทำ+�เบร�เซอร*ต�องก่�ร

HTTP MessagesMessage Header

Message Body

Request/Response HeaderEntity HeaderEntity Body

Message FormatRequest

Method SP URI SP HTTP-Version CRLFGeneral HeaderRequest HeaderEntity HeaderCRLFEntity Body

Message FormatResponse

HTTP-Version SP Status-Code SP Reason-PhraseCRLFGeneral HeaderResponse HeaderEntity HeaderCRLFEntity Body

Message HeadersName: Value

เช้�น Date: Tue, 15 April 1995 07:45:20 GMT

อ�จมื่+ได�ห้ล�ยบรรทำ#ด ล��ด#บข้องฟ1ล*ไมื่�ส่��ค#ญComments ก่��ห้นดได�โดยเข้+ยน

ภ�ยในวงเล4บ

General Headers ส่�มื่�รถก่��ห้นดให้�เป็�นส่�วนห้น6�งข้อง

Request ห้ร�อ Response ได� ป็ระก่อบด�วย

DateForwardedMessage-IDMIME-Version

Request MessagesMethodResource IdentifierProtocol Version

Methods GET เอก่ส่�รส่�งไป็ย#ง server โดยต�อทำ��ยไป็ก่#บ URI ถ��

เป็�น CGI จะเก่4บในต#วแป็ร QUERY_STRING HEAD ต�องก่�รด�ค"ณส่มื่บ#ต,ข้องเอก่ส่�ร โดยไมื่�ต�องส่�ง

เอก่ส่�ร POST ส่�งข้�อมื่�ลไป็ย#ง server โดยข้�อมื่�ลทำ+�ส่�งไป็จะอย��ถ#ด

จ�ก่ Hearder ตรวจส่อบได�จ�ก่ต#วแป็รCONTENT_LENGTH

PUT : replace doc with data DELETE : delete doc LINK UNLINK

Request Headers Accept, Accept-Charset, Accept-

Encoding, Accept-Language Authorization From If-Modified-Since Referer -User Agent Accept -Accept Encoding

ต#วอย��ง ส่�งข้�อมื่�ลด�วยว,ธี+PostPOST/cgi-bin/script.cgiHTTP/1.0Accept: text/htmlAccept:video/mpegUser-Agent:Mozilla/

2.0(compatibel;MSIE 3.02;Windows95)

Content-type:application/x-www-form-urlencoded

Content-lenhth:36 เว�น 1 บรรทำ#ด

name=casper&password=ghost

Response MessagesResponse HeadersResponse Body

Response HeadersProtocol VersionNumeric Status CodeAssociated Textual Phrase

Status Codes1xx - Informational2xx - Successful3xx - Redirection4xx - Client Error5xx - Server Error

2xx Status Codes 200 OK 201 Created: URL created by POST ((((((((( (((((((( ((( 202

((((( (((((((((( 203 Partial Information:

((((“” 204 No Content: done, but no

output

((((( (((((( ((((( 304 Not Modified: response to a

((((((((((( ((( 401 Unauthorized: ไมื่�ได�ร#บอน"ญ�ตเข้��

ถ6งเอก่ส่�รน#:น 403 Forbidden: มื่+ข้�อมื่�ล , แต�ไมื่�ส่�มื่�รถ

เข้��ถ6งได� 404 Not Found: ไมื่�พบเอก่ส่�รทำ+�ต�องก่�ร (((((( 500 : มื่+ข้�อผ,ดพล�ดจ�ก่ก่�รทำ��ง�นข้อง

server เอง

Response HeadersPublicRetry-AfterServerWWW-Authenticate

Entity HeadersAllowContent-EncodingContent-LengthContent-TypeExpiresLast-Modified

MIME Types ใช้�ส่��ห้ร#บจ��แนก่ข้�อมื่�ล(classify

data) ป็ระก่อบด�วย

TypeSubtype

แส่ดงในร�ป็ : Type/Subtype เช้�น : text/html, image/gif

ต#วอย��ง Response HeaderHTTP/1.0200OKDate:Thu,31Dec199823:30:00GMTServer:Apache/1.2.5MINE-version:1.0LastModified:Mon,7Dec199812:00

:05GMTContent-type:Text/htmlContent-lenhth:4578

เว�น 1 บรรทำ#ด<HTML><HEAD><TITLE>...

HTTP Next Generation Family of protocols

caching and replication of servers

notification of changes client/server transport

Replacement of HTTP/1.x, notfix

- HTTP NG Proposal Multiple, asynchronous requests

over a single connection Serverrespondsinany order or i nterl eaved:“paral

lel”transfer Session layer protocol

i mpl ementedwi thseparate channe ls for control and data

Onedata channel for eachobj ect. ASN.1andPERfor descri bi ngand

encodi ngrequests