JAVA interview His influence (6) - HTTP / TCP / IP network protocols, network security

Difference 14.HTTP GET POST requests

1, GET request, the requested data will be appended to the URL, to? URL and transmit the divided data, a plurality of parameters & connect. URL encoding format uses ASCII encoding instead uniclde, and then transfer that is to say after all the non-ASCII characters to be encoded.
POST request: POST request will request data packet is placed in the body of the HTTP request packet.
Therefore, GET requested data will be exposed in the address bar, and POST request does not.
2, the size of the transfer data
in the HTTP specification, there is no limitation on the length and size of the transmission data of the URL. But in the actual development process, for GET, specific browsers and servers have restrictions on the length of the URL. Thus, when using the GET request, the transmission data is limited by the length of the URL.
For POST, because the URL is not traditional values, in theory, is not restricted, but in fact each server will require the submission of data to limit the size of the POST, Apache, IIS has its own configuration.
3, security,
security is higher than the GET POST. Security here is the real security, the security method differs from the above-mentioned GET security, safety not only the above-mentioned modified data server. For example, during the login operation, through GET request, the user name and password will be exposed longer URL, the login page because there may be reasons for the browser cache and others to view your browser history, in which case the user name and password is very easy the others got.

  

20.SESSION and COOKIE differences and usage scenarios

Session cookie and all session (session) tracking technology .cookie by the client record information to determine the user's identity, and the identity of the user session is determined by recording the information on the server side, but the implementation depends on the session cookie mechanism to save JESESSIONID (session of unique identification, requires the presence of the client)
the difference between: 

1. cookie stored in the client data, session data is stored on the server 
1. cookie is not very safe, and people can be deceived by analyzing the cookie is stored in a local cookie, consider should be used to secure the session 
1. the session will be stored on the server within a certain time, when accessing the increase will affect server performance. considering the server performance, you should use the cookie. 
1. single cookie stored data can not exceed 4k, many browsers displays a site to save up to 20 cookie 
2. important information stored in the session (landing), the other confidence required to retain stored in the cookie (cart, cookie can be disabled on the client side, this time to use cookie + the way to achieve shopping cart database, the data can not be taken as a cookie, they took it from the database)

 


79.cookie和session

1.Cookie is created by the server, through the response object addCookie (Cookie cookie) method to write back to the client, the session is stored in the structure of technical .key-value client 
2.session is based on the cookie, session creation is done by the server can () obtained by request.getSession (from looking for a cookie-Jessionid your request, if you can find this cookie, he will compare the value of holding the id cookie to talk to the server-side session, and if it finds the corresponding session , do not create a session. If you can not find the corresponding session, create session) .session once created will have an id attribute (only) to write back to the way the cookie response by the client (this is called a cookie on sessionid ).
session: session is simply understood as opening a browser (by the last request or multiple requests).

 

78.http agreement
1. No state, no state in order to solve problems http introduction of cookie technology 
2.http1.0 short connection, http1.1 long connector 
3.http protocol is based on B / S Request - Answer Mode

 

97.https和http

HTTP: is the Internet's most widely used network protocol, a client and a server-side request and response standard (TCP), hypertext transfer protocol for transmission from the WWW server to the local browser, it can make browsing It is more efficient, so that network traffic is reduced. 
HTTPS: HTTP is safe for the target channel, simply, is a safe version of HTTP, HTTP added SSL layer, HTTPS security infrastructure is SSL, encryption and therefore the details will need to SSL. 
The main role of the HTTPS protocol can be divided into two types: one is to establish a channel of information security, to ensure the security of data transmission; the other is to confirm the authenticity of the site.
Difference: 
1, ca HTTPS protocol needs 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. 
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.

   

99. The security problems (other sites using the technology reptiles crawl your website how to do? There are no safety measures)

The number of requests per unit time exceeds a certain threshold let enter the verification code, can greatly reduce the speed of the crawl, if a plurality of times over 
through a certain threshold may be added to the blacklist. There is a return json page content usage, often becomes a data format change, or 
are dynamically generated page content js

  

And UDP difference 101.TCP

1.tcp connection-oriented (e.g., a call must first dial-up connection); UDP is connectionless, i.e. no connection before sending data 
2.tcp provide reliable service. That by tcp data transfer, error-free, no loss, no repeat, and arrive out of order; udp best effort delivery, delivery is not guaranteed success 
at 3.tcp surface byte stream, as the data is actually tcp is a series unstructured byte stream; UDP packet oriented, udp no congestion control, and therefore does not cause a congestion transmission source host of the network is reduced rate (real-time applications are useful, such as video conferencing) 
4. each tcp connection can only point to point; udp support one to one, one to many, many-to-many interactive communication 
5.tcp 20-byte header overhead; udp header overhead small, only 8 bytes 
6.tcp full duplex communication channel is reliable channel; UDP is not reliable

 

103. Why wave will be more than a handshake

Because when the terminal receives SYN Server Client terminal connection request message may be sent directly SYN + ACK packet. Wherein the ACK message is used for response, SYN etc is used to synchronize the packet. But the connection is closed, when the Server side FIN packet is received, probably does not close immediately SOCKET, we can only respond to a first ACK packet, told Client-side, "you send FIN messages I have received." Only until the end of all my Server messages are sent over, I can send FIN packets, and therefore can not be sent together. It requires a four-step handshake.

  

 

121, explain the patterns and characteristics of network applications. 
A: Typical web application mode are basically three types: B / S, C / S , P2P. Wherein B represents a browser (Browser), C behalf of the client (Client), S represents the server (Server), P2P peer mode is, does not distinguish between server and client. B / S mode applications that can be considered as a special C / S application mode, just special client C / S application schema into the browser, because almost all systems have a browser, then simply open browser you can use the application, no installation, configuration, upgrade various overheads client brings. P2P application mode, millions of computers are connected to each other in a peer status, the entire network in general does not rely on a dedicated hub server. Each computer on the network can not only act as a network service requestor, but also respond to requests from other computers, to provide resources and services. Often these resources and services include: sharing and exchange of information, computing resources (such as CPU shared), shared storage (such as the use of caching and disk space), etc., this application mode greatest resistance security, versioning and other issues, the current there are many applications using a mix of a variety of application models, the most common network video applications, it is almost three models use both.

Added: keep separate this question, "e-commerce model" area, because there are a lot of people asked this question comes to mind is a B2B (such as Ali Baba), B2C (such as Dangdang, Amazon, Jingdong), C2C (such as Taobao , pat), C2B (such as Wik), O2O (such as the US group, hungry yet). For this type of problem, you can go to Baidu science above it.

 


122, what is the Web Service (Web Services)? 
A: On the surface, Web Service is an application that exposes it to the outside world can be invoked through a Web-API. This means that you can call with a transparent method of programming this application, it does not need to know any details, with the programming language you use does not matter. For example, can provide weather forecasts to create a Web Service, then you develop applications regardless of which programming language can be used to get the weather forecast of the city by calling its API and incoming city information. It is called Web Service, because it is based on the HTTP protocol to transmit data, which allows different applications running on different machines without the aid of additional, specialized third-party software or hardware, you can exchange data with each other or integrated.

Added: this must be referred to a concept of SOA (Service-Oriented Architecture, Service Oriented Architecture), SOA is an idea, the application of different functional units linked by a neutral contract, independent of the hardware platform, operating systems and programming languages, such that various forms of functional units can be better integrated. Clearly, Web Service SOA is a better solution, it is more of a standard rather than a specific technology.

 

Guess you like

Origin www.cnblogs.com/newbie27/p/10835928.html