Web development foundation (1)

web development foundation

Browser

The browser is a client browser program for Web information. Through the browser, various requests can be sent to the Web server, and the hypertext information and various multimedia data formats sent back from the server can be interpreted, displayed and played. The browser mainly interacts with the Web server through the HTTP protocol and obtains web pages, which are determined by the URL.

Common browsers on personal computers include Microsoft's Internet Explorer, Mozilla's Firefox, Apple's Safari, Google's Chrome, Opera, Hot Browser, 360 security browser, Sogou browser, Maxthon browser, etc.

Web server

WWW is the Internet's multimedia information query tool, and is the fastest growing and currently most widely used service on the Internet.

WWW service cannot do without web server. The web server specializes in processing Http requests and sends the page to the client so that the client browser can browse. When the web server receives an Http request, it will return an HTTP response, such as an HTML page.

The Web server only provides an environment that can execute the server-side program and return the response generated by the program, and usually has functions such as transaction processing, database connection, and message transmission.

The most widely used Web server under UNIX and LINUX platforms is the Apache server, while the Windows platform is the IIS (Internet Information Serbices) server. Here are the two most commonly used web servers:

  • (1) Micorosoft IIS
    IIS provides a graphical interface management tool called Internet Service Manager, which is used to monitor, configure and control Internet services. At the same time, IIS is a Web service component, including Web server, FTP server, NNTP server and SMTP server, which are used for web browsing, file transfer, news service and mail sending.
  • (2) Apache HTTP Server
    Apache is currently the most used web server software in the world. It originated from the NCSA httpd server. Its success lies in its open source code, a successful development team, and support for cross-platform applications. (It can run on almost all UNIX, Windows, Linux system platforms) and its portability.

HTTP

Introduction to HTTP

The Hypertext Transfer Protocol is the most widely used network protocol on the Internet. The protocol is jointly formulated by the World Wide Web Association and the Internet Working Group.
HTTP is a standard that describes how to implement requests and responses between the client and the server, using a request/response model. The HTTP server listens to requests sent by clients on a specified port (the default port number is 80). By using a web browser, web crawler or other tools, the HTTP client initiates an HTTP request to the specified port on the HTTP server. Then, a TCP connection is established between the HTTP client and the HTTP server designated port.
The main features of the HTTP protocol can be summarized as follows:
1. Simple and fast HTTP protocol is simple, making the HTTP server program small in scale and fast in communication.
2 Flexible HTTP allows the transmission of any type of data object
3 Connectionless connectionless meaning is to limit each link to only process one request. In this way, transmission space can be saved.
4 Stateless: HTTP protocol is a stateless protocol. Statelessness means that the protocol has no memory capacity for transaction processing.

Uniform Resource Positioning

The website address we entered in the address bar of the browser is called URL (Uniform Resource Locator). URL is a special type of URI (Uniform Resource Identifier), which contains enough information to find an Internet resource on the Internet. The format of the URL is as follows:

http://host[":"port][abs_path]

HTTP means to locate network resources through the HTTP protocol. Host represents a legal Internet host domain name or IP address. Port specifies a port number. If it is blank, the default port 80 is used. abs_path specifies the URI of the requested resource.

Here is a specific example of URL: http://www.baidu.com/china/index.htm. Among them:
1. http:// stands for Hypertext Transfer Protocol, which informs the baidu.com server to display a Web page.
2.www represents a Web (World Wide Web) server
3.baidu.com/represents the domain name
of the server with web pages 4.china/represents a subdirectory on the server
5.index.htm represents an HTML file (web page)

HTTP request

An HTTP request consists of three parts, namely: request-line, headers, and body:

request-line
headers (0 or more)
<blank line>
body (only valid for POST method operation)

HTTP response

After receiving and interpreting the request message, the HTTP server returns an HTTP response message. The HTTP response message consists of three parts, namely: status-line, message headers, and response body:

status-line
headers (0 or more)
<empty line>
body

The HTTP response body is the resource content returned by the server.

HTTP message header

HTTP messages can be divided into client-to-server request messages and server-to-client response messages. Both the request message and the response message consist of a start line (for request messages, the start line is the request line, and for response messages, the start line is the status line), message header (optional), blank line (only CRLF line) and message body (Optional) Composed. The HTTP message header is divided into four types: ordinary header, request header, response header and entity header. Each header field is composed of "name" + ":" + space + "value". The name of the message header field is not size-sensitive. write.

Common header: The common header can generally be used for all request and response messages. Common common header fields include Cache-Control common header fields, Date common header fields, and Connection common header fields.

Request header: The request header allows the client to pass the requested additional information and the client's own information to the server. Commonly used request header fields include Accept request header fields, Accept-Charset request header fields, Accept-Encoding request header fields, Accept-Language request header fields, Host request header fields, and User-Agent request header fields.

Response header: The response header allows the server to pass additional response information that cannot be placed in the status line, as well as information about the server and information about the next access to the resource identified by the Request-URI. Commonly used response header domains are: Location response header domain, Server response header domain, WWW-Authenticate response header domain.

Entity header: Both HTTP request and response messages can convey an entity. An entity consists of an entity header field and an entity body, but it does not mean that the entity header field and the entity body should be sent together, and only the entity header field can be sent. The entity header defines meta-information about the entity body and the resource identified by the request. Commonly used entity header fields include Content-Encoding entity header field, Content-Language entity header field, COntent-Type entity header field, Last-Modified entity header field, and Expires entity header field.

Guess you like

Origin blog.csdn.net/qq_48455306/article/details/108678599