Web Services and HTTP protocols

Source: Internet
Author: User

Http:hypertext Transfer protocol--Hypertext Transfer Protocol

Hyperlinks: Text that you can jump between documents

Early risers Web: Just a protocol that enables you to jump between documents
http/0.9: Supports only plain text (hyperlinks) consisting of pure ASCII values
Html:hypertext Mark Language Hypertext Markup Language used to write hypertext

Browser: Client users can display the hypertext provided by the Web server through a browser, where those tags are not displayed

But if the name of the text provided on two hosts is the same, how do users differentiate between the two files?

Uri:uniform Resource indentifier Uniform Resource identifiers can uniquely refer to the naming of a single resource at the global scope

Url:uniform Resource Location Uniform Resource Locator is a sub-object of the Uniform Resource identifier that describes the unified representation format for Internet resources on the Internet

Protocol://host:port/path/to/file
Protocol://HOST: Port/path/file name
Http://www.qq.com/download/linux.tar.gz

Web resource: A file that can be accessed by a client by using the Uniform Resource Locator's unique tag
Multiple resources are likely to be consolidated into an HTML document

Web objects: The same concept as Web resources

HTTP method (method of resource access):
Get: Get resources from server to local and display via browser (early HTTP version example: http0.9 only This method)
PUT: Get a file directly from the remote server to the local
POST: Submitting data to the server via the form
Delete: Deletes a file on the remote server.
HEAD: Returns only the header, not the body
TRACE
OPTIONS
CONNECTION

Mime:multipurpose Internet Mail Extension Multi-purpose Internet Message extension

Smtp:simple Mail transmission Protocol can only transfer plain text
MIME: You can re-encode non-textual data into text format before transmission, and the receiver can revert it back to its original format in the opposite way, and can call the appropriate program to open the file
Base64: A text encoding format

Dynamic effects
Flash
Java,applet,jre

Dynamic Web page: a document that is stored on the server side is not HTML, but rather a script developed by a programming language that executes once on the server after accepting parameters from the client, and then generates an HTML-formatted document that sends the resulting document to the client
Note: The Web server does not help you execute these scripts, but instead calls other tools to execute them. Web servers are not responsible for handling dynamic content
Example: web:index.php
Web--Procotol PHP (run index.php)

Static page Response Process:
The user's request must be sent over the network protocol to the server, and the protocol is working in the kernel of the operating system. When the request arrives at the kernel, the kernel space is parsed and the request is found to be a 80 port socket, and the kernel will transfer the user request through the socket to the user space's Web server. The Web server discovers that the user is accessing a Web page file, and the server ends up in the kernel, re-converting it into kernel mode, and loading the file onto the disk. When the kernel finds the file, it returns to the user space, the Web server discovers that the file is removed, and then returns to the kernel space via the socket, returning to the client via the network TCP/IP protocol stack

Dynamic page Response Process:
The user's request must be sent over the network protocol to the server, and the protocol is working in the kernel of the operating system. When the request arrives at the kernel, the kernel space is parsed and the request is found to be a 80 port socket, and the kernel will transfer the user request through the socket to the user space's Web server. When the Web server discovers that a user is accessing a dynamic page, the Web server initiates an interpreter's process through another protocol, then the interpreter falls into the kernel, converts it into kernel mode, loads the file into the interpreter on disk, executes it once, and returns the execution result to the Web server after execution. The Web server then returns this result through the socket to the kernel space, back to the client via the network TCP/IP stack, and closes the interpreter process that was just created


A Dynamic Web page contains static content (which does not need to be changed, does not need to be executed, such as: Pictures) and dynamic content (needs to be executed and returned to the user)

Information about which resource the user specifically wants to access is logged in the header of the HTTP protocol
HTTP message: Divided into request message and response message

Request Message Syntax:

<method> <request-URL> <version>
Resource acquisition method The requested resource is what corresponds to the version number of the request resource agreement
HTTP protocol Header

<entity-body>
Message body

Response Message Syntax:
<version> <status> <reason-phrase>
The version number status code of the corresponding Request resource protocol specifically describes the significance of status
Response message Header

<entity-body>
Message body

There are five types of status codes:
1XX: Pure Information
2XX: "Success" class information (200-Request resource OK)
3xx: The "redirect" class information, the resource exists, but the resource has been removed, the request needs to be re-initiated, and the address you requested (301-Permanent Redirect, 302-Temporary REDIRECT, 304-no change, direct use of cached content)
4XX: Client error class information (404-a file that does not exist is requested)
5XX: Server-side Error class information

For example:
Request message
get/http/1.1
Host:www.qq.com
Connection:keep-alive

Response message
http/1.1 OK
x-powered-by:php/5.2.17
Vary:accept-encoding,cookie,user-agent the contents of the change class for extra tags
Cache-control:max-age=3,must-revalidate
Content-encoding:gzip content encoding mechanism
content-length:6931 Content Length

The first line of the above two messages is usually called the message "start line", the content of the following label format is called the Header field (header field), each header field consists of a name (name) and a value (values), the middle is separated by commas, in addition, Response messages usually have a body of information called body, which is the content that responds to the client.


Main operations of the Web server:
1. Establish a connection-accept or reject client connection requests
2. Receive requests-read HTTP request messages over the network
3, processing requests--parse the request message and respond to the action
4, access to resources-access to the relevant resources in the request message
5. Build response-Generate HTTP response message with correct header
6, send the corresponding--send the generated response message to the client
7. Logging-Logs the completed HTTP transaction into the log file

There may be multiple Web resources in a page requested by the user, each of which is to be requested separately, and the HTTP protocol is based on the TCP protocol, which requires three handshakes per connection and four disconnects when disconnected, which is a waste of time and bandwidth resources
Therefore, in the http/1.1:
1, enhanced the function of the cache
2, introduce a long connection--the client and the server is not directly disconnected after acquiring a resource, but waiting to continue to obtain additional resources


Common client browsers and server-side Web servers
client browser:
1. IE
2. Firefox
3. Chrome
4. Opera
5. Safari

Web server (www.netcraft.com):
1. Apache
2. IIS
3, Nginx
4. LIGHTTPD (Germany)
5. THTTPD (embedded platform)

Application server: Not only can parse static content, but also can handle the dynamic content of a particular format
1. IIS
2. Tomcat (Apache,java Application Server, open source)
3, Websphere (IBM, dedicated to parsing Java enterprise-class applications, commercial products)
4, Weblogic (bea->oracle,jsp application server, commercial products)
5. JBoss (RedHat)

Web Services and HTTP protocols

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.