HTTP protocol Preliminary parsing

Source: Internet
Author: User
Tags apache tomcat

First, what is the HTTP protocol

HTTP is a shorthand for the Hypertext Transfer Protocol (Hypertext Transfer Protocol), which is an application- layer protocol to the TCP/IP protocol that defines how Web clients request Web pages from a Web server. And how the server delivers Web pages to clients.

noun Interpretation in the definition:
What is hypertext? Hypertext is a Web text that organizes the text information of various spaces together by means of hyperlinks. What is the application layer protocol? Network designers use hierarchical way to organize network protocols and implement the hardware and software of these protocols, historically, a more important protocol organization model is the five-layer Internet protocol stack, from the top level to the bottom, respectively, the application layer, Transport layer, network layer, link layer, physical layer. Among them, the common protocol of Application layer is HTTP, SMTP, FTP, etc., Transport layer protocol has TCP, UDP, etc., network layer has IP and so on. Second, the HTTP protocol features 1. HTTP uses TCP as its transport layer protocol, and TCP provides reliable data transfer services for HTTP. Using a hierarchical structure, the HTTP protocol does not have to worry about data loss or the details of how TCP recovers from data loss and sequence failures in the network. 2. HTTP is a Stateless Protocol, the server sends the requested file to the client without saving any information about the customer (the cookie should be used if it needs to be saved). 3. http/1.0 use non-persistent connection, http/1.1 use Continuous Connection。 Using persistent connections, you do not have to allocate TCP buffers and keep TCP variables multiple times in the client and server, while avoiding twice times the RTT delivery delay for each transport object. The default mode for HTTP is to use a continuous connection with pipelining.   HTTP message Format  1. The request message   example is as follows: GET  /somedir/page.html  http/1.1host:  www.someschool.educonnection: CLOSEUSER-AGENT:MOZILLA/5.0ACCEPT-LANGUAGE:FR-------------------------------------------------------First line: Request Lineother Lines:header line  Requests Line: Method field-URL field-HTTP version field where the Method field is preferable get, post, HEAD, PUT, delete, etc. defaults to get request, after URL With parameters, there is a size limit, no more than 1K form submission indicated with post, passed in the entity, no size limit the head method is often used for debugging, returning only HTTP messages, not returning the request object Connection:close means not using persistent connections   Common request headers: accept:text/html,image/*   Customer acceptable data types Accept-charset:iso-8859-1   The character set encoding accept-encoding to be used to accept data: Gzip,compress   Accepted data compression formats ACCEPT-LANGUAGE:EN-US,ZH-CN   accepted locales host:www.it315.org:80   Virtual host name If-modified-since:tue, 18:23:51 GMT   cache resource Last acquisition time referer:http://www.it315.org/index.jsp   The current request from which link user-agent:mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)   Client Information cookie connection:close/kEep-alive   Specify whether to stay connected Date:tue, 18:23:51 GMT   Current time  2. Response messages   Examples are as follows: http/1.1 OkConnection:closeDate:Tue, 15:44:04 gmtserver:apache/2.2.3 (CentOS) last-modif Ied:tue, 15:11:03 gmtcontent-length:6821content-type:text/html (data, data, data ...) -------------------------------------------------------First line:status linelast line: entity bodyother Lines :  header line  status Line: Protocol version-Status code-status information status codes and status information common are: OK301 Moved Permanently400 bad Request404 not found505 HTTP Version not supported-------------------------------------------------------100 ~ 199 indicates successful reception, the client needs to continue committing to complete the process, 200 ~ 299 indicates successful reception and completion of the entire process 300 ~ 399 to complete the request, the customer needs further refinement of the request, such as 302 request redirection, 304, 307 notification using cache 400 ~ 499 client request with Error 500 ~ 599 Server Side Error   Common response header: Lo cation:http://www.it315.org/index.jsp   Mate 302 implements request redirection Server:apache Tomcat   Server basic information Content-encoding:gzip   Compressed format used by the server to send data content-length:80   Send data size CONTENT-LANGUAGE:ZH-CN   send data using locale Content-type:text/html; charset=gb2312   Basic information about the data currently being sent Last-modified:tue, 18:23:51 GMT   cache related refresh:1;url=http:// www.it315.org   timed Refresh to a urlcontent-disposition:attachment;filename=aaa.zip   header transfer-encoding related to downloads: chunked   Data transmission type, one block transmission set-cookie:ss=q0=5lb_nq; Path=/search   Settings cookieetag:w/"83794-1208174400000"   and cache related expires: -1  Specifies the time of the resource cache, If the value is 0 or 1 browse does not cache the resource Cache-control:no-cache   If No-cache then notifies the browser not to cache Pragma:no-cache    If No-cache is notified that the browser is not cached for historical reasons, the above three are used to control the cache while using connection:close/keep-alive   to keep the connection Date:tue, 2000 18:23:51 gmt  Current Time    third, Telnet demo telnet cis.poly.edu 80 

HTTP protocol Preliminary parsing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.