Transferred from: http://m.blog.csdn.net/zhangliangzi/article/details/51336564
1, say what is the HTTP protocol?
The format specification for data transfer between the client and server side is referred to as the Hypertext Transfer Protocol.
2. What is the HTTP protocol stateless protocol? How to resolve the HTTP protocol stateless protocol? (once went to a startup company to ask)
1, stateless protocol has no memory ability for transaction processing. A lack of state means that the previous information is required for subsequent processing
2, stateless Protocol solution: through 1, Cookie 2, through session sessions to save.
3, say the HTTP protocol 302 status (Ali often asked)
In the HTTP protocol, a return status code of 302 indicates redirection.
In this case, the header information returned by the server contains a location field, which is the URL to redirect to
4. What is the HTTP protocol made of?
The request message contains three parts:
A, request line: Contains the request method, URI, HTTP version information
B. request header Field
C. Request Content Entity
The response message contains three parts:
A, status line: Contains the HTTP version, the status code, the status code of the reason phrase
B, Response header field
C, Response content entity
5. What are the request methods in the HTTP protocol?
Get: Used to request access to a resource that has been identified by a URI (Uniform Resource Identifier) that can be passed to the server via a URL
Post: For transmitting information to the server, the main function is similar to the Get method, but it is generally recommended to use post mode.
PUT: Transfer file, message body contains the contents of the file, save to the corresponding URI location.
HEAD: Gets the message header, similar to the Get method, but does not return the text body, generally used to verify that the URI is valid.
Delete: Delete the file, as opposed to the Put method, to delete the file that corresponds to the URI location.
OPTIONS: Query the HTTP method supported by the corresponding URI.
6. What is the difference between Http1.0 and 1.1 in the HTTP protocol?
In http1.0, when a connection is made, the client sends a request, the server returns a message, closes the connection, and when the browser makes the next request, it is clear that this constant connection will create a lot of problems.
5. In http1.1, the concept of continuous connection is introduced, through which the browser can establish a connection, send the request and get the return information, and then continue to send the request again until the return information, that is, the client can send multiple requests continuously, instead of waiting for each response to come.
7, HTTP protocol implementation principle mechanism?
2.1, the entire process steps
2.2. Domain Name parsing process
2.3. Three-time handshake process
2.4. Initiating an HTTP request
2.5. Respond to HTTP requests and get HTML code
2.6. Browser parsing HTML code
2.7. The browser renders the page rendering to the user
8. What is the difference between get and post requests? (Prerequisite questions for novice programmers)
Difference One:
Get focus on getting resources from the server, post focus on sending data to the server;
Difference Two:
Get transfer data is sent through a URL request, in the form of field (fields) = value, placed after the URL and used with "?" Connection, with "&" connection between multiple request data, such as http://127.0.0.1/Test/login.action?name=admin&password=admin, this process user is visible;
Post transmission data through the post mechanism of HTTP, the field and corresponding values are sealed in the request entity sent to the server, the process is not visible to the user;
Difference Three:
Get transmits a small amount of data because it is limited by URL length, but is more efficient;
Post can transmit a large amount of data, so you can only use post when uploading files;
Difference Four:
Get is unsafe because URLs are visible and may reveal private information, such as passwords, etc.;
Post is higher security than get;
Difference Five:
The Get method can only support ASCII characters, and Chinese characters passed to the server may be garbled.
The post supports the standard character set, which correctly passes Chinese characters.
9, HTTP request message and Response message format?
The request message contains three parts:
A, request line: Contains the request method, URI, HTTP version information
B. request header Field
C. Request Content Entity
The response message contains three parts:
A, status line: Contains the HTTP version, the status code, the status code of the reason phrase
B, Response header field
C, Response content entity
10, Common HTTP protocol status?
200: request is handled normally
204: Request is accepted but no resources can be returned
206: The client is only a part of the requested resource, and the server executes the Get method only for the requested part of the resource, and the corresponding message is Content-range the specified range of resources.
301: Permanent Redirection
302: Temporary redirection
303: Similar to the 302 status code, except that it expects the client to redirect to another URI by the Get method when requesting a URI
304: Returns when the condition is not satisfied when sending a request with a condition, regardless of redirection
307: Temporary redirection, similar to 302, just forcing the use of the Post method
400: The request message syntax is wrong, the server is not recognized
401: Request requires authentication
403: The requested corresponding resource is forbidden to be accessed
404: The server cannot find the corresponding resource
500: Server Internal Error
503: The server is busy
11. HTTP protocol header field?
A, the General header field (the header field used by the request message and the response message)
Date: Create Message time
Connection: Management of connections
Cache-control: Cache Control
Transfer-encoding: Transmission encoding method of message body
B, Request header field (the header field used by the request message)
Host: The server on which the resource is requested
Accept: Types of media that can be processed
Accept-charset: A character set that can be received
Accept-encoding: Acceptable content encoding
Accept-language: Acceptable Natural language
C, Response header field (the header field used by the response message)
Accept-ranges: Acceptable byte range
Location: The URI to which the client is redirected
Installation information for the SERVER:HTTP server
D, the Entity header field (the header field used by the entity portion of the request message and the response message)
Allow: The HTTP method supported by the resource
Content-type: Type of entity main class
Content-encoding: The encoding method that the entity body applies To
Content-language: The natural language of the entity body
Content-length: The number of bytes of the entity Principal
Content-range: The position range of the entity body, which is typically used when making partial requests
12, HTTP and HTTPS pros and cons?
A, the communication using plaintext is not encrypted, the content may be eavesdropping, that is, captured packet analysis.
b, do not verify the identity of the communication party, may be disguised
C, unable to verify message integrity, may be tampered with
HTTPS is HTTP plus cryptographic processing (typically SSL secure communication lines) + Authentication + integrity Protection
13. HTTP Optimization
Optimize and accelerate HTTP applications with load balancing
Use HTTP cache to optimize your Web site
14. What are the features of the HTTP protocol?
1, support customer/server mode, 2, simple and fast, 3, flexible, 4, no connection; 5, no State;
If you are not familiar with the HTTP protocol, please refer to the HTTP protocol http://www.itmayiedu.com/front/articleinfo/49.html article
HTTP Interview Topics