1 / 28

Hyper Text Transfer Protocol

Hyper Text Transfer Protocol. Seree Chinodom seree@buu.ac.th. Network Protocols. Layered Approach to Networks Transport Layer Protocols Application Layer Protocols. Types of Transport Layer Services. Connectionless User Datagram Protocol (UDP)

abdul-nash
Télécharger la présentation

Hyper Text Transfer Protocol

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Hyper Text Transfer Protocol Seree Chinodom seree@buu.ac.th

  2. Network Protocols • Layered Approach to Networks • Transport Layer Protocols • Application Layer Protocols

  3. Types of Transport Layer Services • ConnectionlessUser Datagram Protocol (UDP) • Connection OrientedTransmission Contorl Protocol (TCP)

  4. HTTP • HyperText Transfer Protocal • Application Layer Protocol • เป็น Connection Oriented Service • ทำงานโดยใช้ Request-Response Model

  5. HTTP Versions • HTTP/0.9 เมื่อปี 1990 • HTTP/1.0 (RFC 1945) เมื่อปี 1992 • MINE ทำให้ส่งข้อมูลแบบสื่อผสมได้ • ปัจจุบัน : HTTP/1.1 (RFC 2068) • ปี 1997 • อนาคต: HTTP Next Generation

  6. 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 address Port_Numberหมายเลขพอร์ตที่ใช้ติดต่อกับ Web Server File_Nameใช้ระบุชื่อไฟล์หรือเอกสาร HTML โดยต้องระบุ path ของไฟล์ด้วย

  7. Date and Time • HTTP/1.1 กำหนดวัน เวลาได้ 3แบบ • RFC 1123 • Sun, 06Nov199808:59:59GMT • RFC 1036 • Sunday, 06Nov9808:59:59GMT • asctime() ของ ANSI C • SunNov608:59:591998GMT • GMT :Greenwich Mean Time

  8. Basic HTTP • เป็นการทำงานแบบ Request/Response • HTTP Request Header • บรรจุข้อมูลต่างๆที่จะบอกให้ serverทราบ • เงื่อนไขและข้อมูล • HTTP Response Header • เอกสารที่เบราเซอร์ต้องการ

  9. HTTP Messages • Message HeaderMessage Body • Request/Response Header • Entity Header • Entity Body

  10. Message Format • RequestMethod SP URI SP HTTP-Version CRLFGeneral HeaderRequest HeaderEntity HeaderCRLFEntity Body

  11. Message Format • ResponseHTTP-Version SP Status-Code SP Reason-PhraseCRLFGeneral HeaderResponse HeaderEntity HeaderCRLFEntity Body

  12. Message Headers • Name: Valueเช่น Date: Tue, 15 April 1995 07:45:20 GMT • อาจมีได้หลายบรรทัด • ลำดับของฟิล์ไม่สำคัญ • Comments กำหนดได้โดยเขียนภายในวงเล็บ

  13. General Headers • สามารถกำหนดให้เป็นส่วนหนึ่งของ Request หรือ Response ได้ • ประกอบด้วย • Date • Forwarded • Message-ID • MIME-Version

  14. Request Messages • Method • Resource Identifier • Protocol Version

  15. Methods • GETเอกสารส่งไปยัง serverโดยต่อท้ายไปกับ URI ถ้าเป็น CGI จะเก็บในตัวแปร QUERY_STRING • HEAD ต้องการดูคุณสมบัติของเอกสาร โดยไม่ต้องส่งเอกสาร • POSTส่งข้อมูลไปยัง server โดยข้อมูลที่ส่งไปจะอยู่ถัดจาก Hearder ตรวจสอบได้จากตัวแปร CONTENT_LENGTH • PUT : replace doc with data • DELETE : delete doc • LINK • UNLINK

  16. Request Headers • Accept, Accept-Charset, Accept-Encoding, Accept-Language • Authorization • From • If-Modified-Since • Referer • User-Agent • Accept • Accept-Encoding

  17. ตัวอย่าง ส่งข้อมูลด้วยวิธี Post POST/cgi-bin/script.cgiHTTP/1.0 Accept: text/html Accept:video/mpeg User-Agent:Mozilla/2.0(compatibel;MSIE 3.02;Windows95) Content-type:application/x-www-form-urlencoded Content-lenhth:36 เว้น 1 บรรทัด name=casper &password=ghost

  18. Response Messages • Response Headers • Response Body

  19. Response Headers • Protocol Version • Numeric Status Code • Associated Textual Phrase

  20. Status Codes • 1xx - Informational • 2xx - Successful • 3xx - Redirection • 4xx - Client Error • 5xx - Server Error

  21. 2xx Status Codes • 200 OK • 201 Created: URL created by POST • 202 Accepted: accepted for later processing • 203 Partial Information: “unofficial” info • 204 No Content: done, but no output

  22. Other Status Codes • 304 Not Modified: response to a conditional GET • 401 Unauthorized: ไม่ได้รับอนุญาตเข้าถึงเอกสารนั้น • 403 Forbidden: มีข้อมูล, แต่ไม่สามารถเข้าถึงได้ • 404 Not Found: ไม่พบเอกสารที่ต้องการ • 500 Internal Error: มีข้อผิดพลาดจากการทำงานของ server เอง

  23. Response Headers • Public • Retry-After • Server • WWW-Authenticate

  24. Entity Headers • Allow • Content-Encoding • Content-Length • Content-Type • Expires • Last-Modified

  25. MIME Types • ใช้สำหรับจำแนกข้อมูล(classify data) • ประกอบด้วย • Type • Subtype • แสดงในรูป : Type/Subtype • เช่น : text/html, image/gif

  26. ตัวอย่าง Response Header HTTP/1.0200OK Date:Thu,31Dec199823:30:00GMT Server:Apache/1.2.5 MINE-version:1.0 LastModified:Mon,7Dec199812:00:05GMT Content-type:Text/html Content-lenhth:4578 เว้น 1 บรรทัด <HTML><HEAD><TITLE>...

  27. HTTP Next Generation • Family of protocols • caching and replication of servers • notification of changes • client/server transport • Replacement of HTTP/1.x, not fix

  28. HTTP-NG Proposal • Multiple, asynchronous requests over a single connection • Server responds in any order or interleaved: “parallel” transfer • Session layer protocol implemented with separate channels for control and data • One data channel for each object. • ASN.1 and PER for describing and encoding requests

More Related