Related interview questions about the interview summary 8-http protocol

Reprinted: https://www.cnblogs.com/yoyoketang/p/10137927.html

Foreword

Enter the PC browser address bar string URL, and then press Enter to render the page, this process nothing happened? This is a lot of interviewers like to ask a question
if the test just stay on the surface little point, I do not know the logic behind it, it is unable to find the hidden bug, only to find some point of view to get the bug page.
Testers If you want to be technically upgrade, will have to know everything Interface (API) test, which is also the recent years more and more companies realize the importance of interface testing, recruitment time to recruit a senior tester the interface test is a necessary skill.

Enter the url browser press ENTER experience behind what?

1. In the PC browser address bar input string URL, and then press Enter to render the page, this process nothing happened?

1, first of all, input url in the browser address bar, to parse url, url address to detect whether legitimate
2, the first browser to view the browser cache - System Cache - Cache router, if there is a cache, the page will be displayed directly on the screen content. If not, the operation jumps to the third step.
Browser cache: Browsers DNS record for some time, therefore, only the first place to resolve DNS requests;
operating system cache: If you do not include this record in the browser cache, the system will call the operating system, access to the operating system record (saves the last DNS query cache);
router cache: If the above two steps do not successfully obtain DNS records, continue to search for the router cache;
ISP cache: If the above fails, continue to search ISP.
3, before sending a http request, need DNS (DNS resolution), parsing and obtaining the corresponding IP address.
4, the browser initiates tcp connection to the server, and establish a three-way handshake tcp browser.
5, after the handshake is successful, the browser sends http request to the server, the request packet.
6, the server processes the received request, and return the data to the browser
7, the browser receives the HTTP response
8, decodes the browser response, if the response can be cached, the cached.
9, the browser sends a request for access to resources embedded in HTML (html, css, javascript, pictures, music ??????), for an unknown type, the dialog box will pop up.
10, the browser sends an asynchronous request.
11, page rendering all over.

The difference between GET and POST

2.get and post requests difference, this is asking a bad question

First, this seemingly simple question, in fact, is a proposition to send! If you Baidu search to the standard answer might be something like (this reference standard answer from w3schools):

  • GET is harmless when the browser is rolled back and the POST request will be submitted again.
  • GET URL address can be generated Bookmark, and not POST.
  • GET requests are active cache browser, POST will not, unless manually.
  • GET request can only be url encoded, and POST supports multiple encoding.
  • GET request parameters are intact in the browser history, and the POST parameters will not be retained.
  • GET request parameters passed in the URL length is limited, but what there is POST.
  • The data type of the parameter, GET accepts only ASCII characters, but there is no limit POST.
  • GET more secure than POST, because the parameters directly exposed on the URL, it can not be used to transmit sensitive information.
  • GET parameters passed via the URL, POST Request body in place.

What if I told you that you memorize these so-called "standard answer" is not the interviewer wants, you certainly satisfied, first of all from a security nature, get and post are the same, nothing which is more secure so-called
get request parameters url on the address, direct exposure, POST request body parameters of the discharge section, F12 directly exposed, so nothing security at all

"GET parameters passed via the URL, POST Request body placed in" this fact was not allowed to, post requests can not body, it can also be passed in the url?

What if I told you get and post request request no difference in essence, you would not believe!
GET and POST there is a significant difference, simply say:
GET generate a TCP packet; POST generates two TCP packets.
Long said:
For the GET request, the browser will http header and data sent together, the server response 200 (return data);
and for the POST, the browser transmits the first header, the server response 100 continue, then send the browser data, the server response 200 ok (return data).

For more information please refer to this, very good writing "The difference between GET and POST methods are two basic requests."

The difference between cookies and session mechanisms mechanisms

3.cookies difference between the mechanism and the mechanism of the session, this is often asked

  • cookies stored in the client data, session data is stored on the server side;
  • cookies can relieve pressure on the server, but secure, easy cookies to deceive;
  • session safer, but take up server resources

HTTP status code

4.HTTP status code 2xx, 3xx, 4xx, 5xx, respectively, what does this mean? This is the most basic, this was mastered, it is hard to tell if this status code, basic skills on the weak, the impression branch greatly reduced!

  • 200 request was successful, the request or response header desired data volume will vary with the response returns.
  • 201 requests have been implemented, and there is a new resource has been established based on the needs and requests, and the URI has returned with Location header
  • The server 202 has accepted the request, but not yet processed
  • 301 (Moved Permanently) permanently requested page has been moved to a new location. When the server returns this response (response to a GET or HEAD request), it automatically forwards the requestor to the new location.
  • 302 (Temporary Mobile) respond to requests from the web server is currently a different location, but the requestor should continue to use the original location for future requests.
  • 303 (See other location) requestor to retrieve the response should separate GET request to a different location, the server returns this code.
  • 304 (Not Modified) since the last request, the requested page has not been modified. When the server returns this response, it does not return to the page content.
  • 305 (use proxy) The requestor can only access the requested page using a proxy. If the server returns this response, it said requester use the agent.
  • 307 (temporary redirect) server response to a request from a web page different from the current position, but the requestor should continue to use the original location for future requests.

  • It requires user authentication 401 for the current request. If the current request has been included Authorization credentials, then the 401 response indicates that the server has verified that the certificate rejected
  • 403 server has understood the request, but refused to implement it. The difference is that with the 401 response, authentication does not provide any help, but this should not be repeated request submitted
  • 404 request fails, the request would have liked resource is not found on the server
  • 500 The server encountered an unexpected condition that causes it could not complete the processing of the request. Generally, this problem will occur when the server program code error.
  • 501 Server does not support a feature request for the current need. When the server does not recognize the request method, and can not support its request for any resource.
  • When attempting to perform a request 502 as a gateway or proxy server work received from the upstream to the server invalid response.
  • 503 due to a temporary overloading or maintenance of the server, the server is currently unable to handle the request. This situation is temporary, and will be restored at a later time.

http protocol request mode

5.http agreement, which has several requests way?
GET, POST and HEAD party, OPTIONS, PUT, DELETE, TRACE, and CONNECT method.

the difference between http and https

6.http and https difference?

HTTP data transmission protocol is unencrypted, plain text is therefore transmitted using the HTTP protocol is insecure private information, in order to ensure the privacy of data transmission can be encrypted, so designed Netscape SSL (Secure Sockets Layer) protocol with HTTP protocol for data transmission is encrypted, thus was born HTTPS. In simple terms, HTTPS protocol is constructed from SSL + HTTP protocol can be encrypted transmission, network authentication protocol than http protocol security.

The main difference between HTTPS and HTTP as follows:

Overall: HTTPS = SSL + HTTP

1, https protocol ca need to apply for a certificate, generally less free certificates, thus requiring a fee.

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

3, http and https use is completely different connections, with the port are not the same, the former is 80, which is 443.
(This is just not the same as the default port, the port is actually can be changed)

4, http connection is very simple, is stateless; is constructed by the HTTPS protocol SSL + HTTP encrypted transmission protocol, a network authentication protocol, the http protocol than security.

Packets

7.HTTP request packet and response packet format
request message comprises three parts:
A, request line: the request comprises a method, URI, HTTP version information
b, request headers (headers) field
c, the requested content entity (body)
response the message comprising three parts:
a, status line: comprises HTTP version, status code, a reason phrase status code
B, response header (headers) field
C, response content (body) entity

post request body

8. POST common way to submit data

application/x-www-form-urlencoded
multipart/form-data
application/json
text/xml

DNS

9. What is DNS?
Domain Name Service. Convert host names to IP addresses. Such as converting http://www.cnblogs.com/ host name to an IP address: 211.137.51.78

no status

10. What is Http protocol stateless protocol? How to solve Http protocol stateless protocol?

(1), stateless protocol for transaction processing without memories. The lack of state means that if the subsequent processing of information required in front of
(2), stateless protocol solution: save by 1, Cookie 2 Session by session.

Guess you like

Origin www.cnblogs.com/yuany66/p/11389318.html
Recommended