http protocol common interview questions

http protocol face questions

Composition 1.http agreement

 

Request line (request line), the request header (header), a blank line portion and four request data.

HTTP (Hypertext Transfer Protocol) is a request response mode based, stateless application layer protocol, usually based on the TCP connection,

HTTP1.1 version is given a mechanism for continuous connection, the vast majority of Web development, Web applications are constructed on top of the HTTP protocol.

 

 2.HTTP request method:

HTTP1.0 request defines three methods: GET, POST, and HEAD method.
HTTP1.1 five new request methods: OPTIONS, PUT, DELETE, TRACE, and CONNECT method.

 

GET     请求指定的页面信息,并返回实体主体。
HEAD     类似于get请求,只不过返回的响应中没有具体的内容,用于获取报头
POST     向指定资源提交数据进行处理请求(例如提交表单或者上传文件)。数据被包含在请求体中。POST请求可能会导致新的资源的建立和/或已有资源的修改。
PUT     从客户端向服务器传送的数据取代指定的文档的内容。
DELETE      请求服务器删除指定的页面。
CONNECT     HTTP/1.1协议中预留给能够将连接改为管道方式的代理服务器。
OPTIONS     允许客户端查看服务器的性能。
TRACE     回显服务器收到的请求,主要用于测试或诊断

 

 And post the difference 3Get

1.get focus on access to resources from the server, post focusing on sending data to the server;

2.GET submitted data will be placed after the URL to? URL division and transmit data to & connected between parameters,

  The EditPosts.aspx? Name = test1 & id = 123456. POST method is the data submitted in the HTTP packet Body

3.GET submitted data size is limited (because the browser restrictions on the length of the URL), and the data submitted by the POST method is not limited.

4.get is unsafe, because the URL is visible, may reveal private information, such as passwords and so on;
POST higher than get security

 

4, HTTP request packet and response packet format

The request message comprises three parts:
A, request line: comprises a request method, the URI, HTTP version information
B, the request header field
C, the requested content entity
response message comprises three parts:
A, status line: comprises HTTP version, status code, status code reason phrase
b, in response header field
c, a content entity in response

5, the respective common HTTP status code

1xx: instructions - indicates that the request has been received, continue processing
2xx: Success - indicates that the request has been successfully received, understood, accepted
3xx: Redirection - to fulfill the request must go a step further
4xx: Client Error - request a syntax error or a request can not be achieved
5xx: server-side error - the server failed to achieve a legitimate request

200: the request is processed normally
204: the request is accepted but no resource can return
206: The client only requests a portion of the resource, the server performs only the GET method of some resource request, the corresponding packet resource Content-Range specified range through.
301: Permanent redirect
302: Temporary Redirect
303: the status code 302 has a similar function, but it is desirable client request when a URI, GET method can be redirected to another URI
304: transmitting untied request, when the return condition is not satisfied, irrespective of redirection
307: temporary redirection, and 302 similar, except using the POST method mandatory
400: request message syntax error, the server does not recognize
401: request requires authentication
403: request prohibit access to the corresponding resource is
404: server was unable to find the corresponding resource
500: internal server error
503: server busy

 

6, the HTTP disadvantage the HTTPS
  the HTTPS HTTP + = the SSL

  1, https have ca certificate, http generally do not

  2, http is the hypertext transfer protocol, information is transmitted in the clear. https is encrypted with security transmission protocol ssl

  3, http default port 80, https port 443 by default

HTTPS is HTTP plus encryption processing (SSL secure communication link typically) + + integrity protection certification

 

7. Type the URL in the browser address bar, then press Enter to go through the following process

1, the browser requests the URL to the DNS server to resolve the domain name corresponding to the IP address;

2, the IP address parsed, based on the established default IP address and port 80, and the server TCP connection ;

3, the browser issues a read file (URL domain name corresponding to the rear portion of the file) of the HTTP request, the request packet as a  TCP three-way handshake third data packets to the server;

4, the server responds to the browser request, and sends the html text corresponding to the browser;

5, releasing  the TCP connection ;

6, the browser displays the html and text content;

 

or

 

 

Reference blog:

https://www.cnblogs.com/sunny-sl/p/6529830.html

https://www.cnblogs.com/gaozhiqiang/p/11750772.html

https://www.cnblogs.com/ranyonsue/p/5984001.html

Guess you like

Origin www.cnblogs.com/xiaokang01/p/12515617.html