Use telnet to send HTTP requests

Source: Internet
Author: User
Tags http status code 500 unsupported
1. Telnet Google.com 802. Press "Ctrl +]" in the Telnet window, enter the "set localecho" command, and press the Enter key twice in a row. 3. Enter

 

Get, HTTP, 1.1
HOST: www.sohu.com/* is not required */

/* In addition, you can use the webpage data analysis tool to view the corresponding input information, such as httpwatch */

 

Press the Enter key twice in a row to request the root file of the homepage from Google. The protocol used is HTTP 1.1.

"200 OK" Indicates data success "302" Indicates data redirection

Connection: keep-alive

=============================================== ====================

The HTTP Status Code defines five major types of status codes:

Informational
Meaning: Information
Range: 1xx
100 series Codes
The HTTP status code from 100 to 199 is an information report code.
For various reasons, we rarely see the code in most cases. First, if a browser tries to access a website and the website returns the code, the code is usually not displayed on the screen. They are only the internal code referenced by the browser. In addition, this code is not common because the HTTP standard does not allow this range of status codes at first. In itself, they have never been widely used.

Successful
Meaning: Successful
Range: 2XX
200 series Codes
The status code from 200 to 299 is the code for successful operations.
Similarly, in normal Web surfing, you may not see the code on the screen. On the contrary, the code is used inside the browser to confirm the operation is successful and the current request status. Although these codes are usually not displayed, some troubleshooting tools can read them, just like most other HTTP status codes, which are very useful in the error diagnosis process.

Redirection
Meaning: Redirection
Value Range: 3xx
300 series Codes

The status code from 300 to 399 is the redirection code.
Essentially, they tell the web browser to perform other operations to complete the request. Based on the features of this command, it can be automatically executed or requires additional user input. For example, status code 301 indicates that a specific resource has been permanently removed first. Therefore, in the future, all requests to access this resource should be directed to a specific URL.

Client Error
Meaning: client errors
Range: 4xx
400 series Codes

The status code in the range of 400 is the client error code. This type of error code is often related to security.
For example, if a client attempts to access an unauthorized resource, the server returns a Status Code 401. Similarly, if the client tries to access a prohibited resource and the authentication status of the client is the same in this case, the server may return a status code 403, deny access to the resource.

If the request is incorrect or the client times out, the error code level 400 may also be returned. However, there is a 400 level code that is always misleading: 404. Although this code is technically classified as a client error, it can actually indicate errors on the client or server at the same time. However, this error code is simply displayed as the requested resource is not found. When this error occurs on the client, it usually indicates a network connection problem. In other cases, this error may also occur because the resource has been transferred or renamed from the server.

Server Error
Meaning: Server Error
Range: 5xx
500 series Codes

Status Code 500 indicates a server error.
For example, if the web server times out, it will generate a 504 error. Although a 500-level error often indicates a web application running on the server rather than a server issue. For example, my personal website is written in ASP and is responsible for dynamically generating HTML webpages. During debugging, code with bugs always causes my web server to return HTTP status code 500, which generally indicates an internal server error. This Code only has a problem, and HTTP cannot solve the problem.

Give specific meanings of common HTTP Error Codes added to the favorites on the network (the source is unknown)

HTTP status codes English version

"100": continue
101 ": witching protocols

"200": OK
201 ": created
"202": accepted
203 ": Non-authoritative information
"204": NO content
205 ": reset content
"206": Partial content

"300": Multiple Choices
"301": moved permanently
302 ": Found
"303": see other
"304": not modified
305 ": use proxy
"307": Temporary redirect

"400": Bad request
"401": unauthorized
"402": payment required
403 ": forbidden
404 ": not found
"405": method not allowed
"406": not acceptable
"407": proxy authentication required
"408": request time-out
"409": Conflict
410 ": Gone
"411": length required
"412": precondition failed
"413": Request Entity too large
"414": Request-URI Too large
"415": Unsupported media type
"416": Requested range not satisfiable
417 ": Expectation failed

500 ": Internal Server Error
"501": not implemented
"502": Bad Gateway
"503": Service unavailable
"504": Gateway time-out
"505": HTTP Version Not Supported

HTTP Error Codes

1xx (temporary response)
Status Code indicating a temporary response and requiring the requester to continue the operation.

Code Description
100 (CONTINUE) the requester shall continue to make the request. The server returns this code, indicating that the first part of the request has been received and is waiting for the remaining part.
101 (switching protocol) the requester has requested the server switching protocol. The server has confirmed and is ready to switch.

2XX (successful)
Indicates that the request status code is successfully processed.

Code Description
200 (successful) the server has successfully processed the request. Generally, this indicates that the server provides the requested webpage.
The 201 (created) request is successful and the server creates a new resource.
202 (accepted) the server has accepted the request but has not yet processed it.
203 (unauthorized information) the server has successfully processed the request, but the returned information may come from another source.
204 (NO content) The server successfully processed the request, but did not return any content.
205 (reset content) The server successfully processed the request, but did not return any content.
206 (partial content) The server successfully processes some GET requests.

3xx (redirection)
Indicates that further operations are required to complete the request. These status codes are usually used for redirection.

Code Description
300 (multiple options) for requests, the server can perform multiple operations. The server selects an operation based on the user agent or provides an operation list for the user agent to select.
The webpage of the 301 (permanent mobile) request has been permanently moved to a new location. When the server returns this response (response to a get or head request), it automatically redirects the requester to a new location.
The 302 (temporary mobile) server currently responds to requests from different locations, but the requester should continue to use the original location for subsequent requests.
303 (view other locations) when the requester uses a separate GET request for different locations to retrieve the response, the server returns this code.
304 (not modified) the requested webpage has not been modified since the last request. When the server returns this response, no webpage content is returned.
305 (using a proxy) the requester can only use a proxy to access the requested webpage. If the server returns this response, it also indicates that the requester should use a proxy.
307 (temporary redirection) The server currently responds to requests from different locations, but the requester should continue to use the original location for subsequent requests.

4xx (request error)
These status codes indicate that the request may fail and impede server processing.

Code Description
400 (incorrect request) the server does not understand the request syntax.
401 (unauthorized) requests require authentication. The server may return this response for webpages that require logon.
403 (Forbidden) The server rejects the request.
404 (not found) The server cannot find the requested webpage.
405 (method disabled) disable the method specified in the request.
406 (unacceptable) unable to respond to the requested webpage using the requested content features.
407 (proxy authorization required) this status code is similar to 401 (unauthorized), but the specified requester should authorize the use of proxy.
408 (request timeout) timeout occurred when the server waited for the request.
409 conflict occurs when the server completes the request. The server must contain conflict information in the response.
410 (Deleted) If the requested resource has been permanently deleted, the server returns this response.
The 411 (valid length required) server does not accept requests that do not contain valid Content Length header fields.
412 (not meeting the prerequisites) the server does not meet one of the prerequisites set by the requester in the request.
413 (the Request Entity is too large) The server cannot process the request because the request entity is too large and exceeds the server's processing capability.
414 (the requested URI is too long) The request URI (usually the URL) is too long and cannot be processed by the server.
415 (unsupported media type) The request format is not supported by the request page.
416 (the request range does not meet the requirements) if the page cannot provide the request range, the server returns this status code.
417 (not meeting the expected value) the server does not meet the "expected" request header field requirements.

5xx (server error)
These status codes indicate an internal error occurred when the server attempted to process the request. These errors may be server errors rather than request errors.

Code Description
500 (internal server error) The server encounters an error and cannot complete the request.
501 (not implemented) the server does not have the function to complete the request. For example, this Code may be returned when the server cannot identify the request method.
The 502 (error gateway) server acts as a gateway or proxy and receives an invalid response from the upstream server.
503 (Service unavailable) servers are currently unavailable (due to overload or downtime maintenance ). Generally, this is only a temporary status.
504 (gateway timeout) The server acts as a gateway or proxy, but does not receive a request from the upstream server in time.

505 (HTTP Version Not Supported) the server does not support the HTTP protocol version used in the request.

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.