Can the browser automatically modify the URL?

Source: Internet
Author: User
Tags error code modify
Browser

Today, a colleague to visit the http://www.ibm.com.cn website, feel very strange, clearly typing is http://www.ibm.com.cn, how IE automatically turned it into a http://www.ibm.com/cn/, And the access results are also correct. He found it very puzzling, ie is not so smart?

As long as you understand the HTTP protocol, the above conversion principle is simple, the process is as follows:

1. In order to get the Web page from the www.ibm.com.cn, the browser does something similar to the following.

Telnet www.ibm.com.cn 80

get/http/1.1

Host:www.ibm.com.cn

Accept-languge:zh_cn

The following content is returned on the Web server:

http/1.1 Moved Permanently

Date:thu Feb 2006 12:14:13 GMT

Server:ibm_http_server

location:http://www.ibm.com/link/redirect.www.ibm.com/www.ibm.com.cn/

content-length:268

Content-type:text/html

<! DOCTYPE HTML PUBLIC "-//ietf//dtd HTML 2.0//en" >

H1>moved permanently

<p>the document has moved

<a href= "http://www.ibm.com/link/redirect.www.ibm.com/www.ibm.com.cn/" >HERE</A>.

</p>

</body>

According to the rules in the HTTP protocol, the error code at the beginning of 3 indicates redirection and tells the browser to retrieve the file from the specified URL.

2. The browser then did something similar to the following.

Telnet www.ibm.com 80

get/link/redirect.www.ibm.com/www.ibm.com.cn/

Host:www.ibm.com.cn

Accept-languge:zh_cn

The following content is returned on the Web server:

<! DOCTYPE HTML PUBLIC "-//ietf//dtd HTML 2.0//en" >

<p>the document has moved

<a href= "http://www.ibm.com/cn/" >here</a>.</p>

</body>

or redirect.

3. The browser then did something similar to the following.

Telnet www.ibm.com 80

get/cn/http/1.1
Host:www.ibm.com.cn

Accept-languge:zh_cn

This time finally got the real content of the net face.

Reference: Error code in RFC 2616:

Status-code =
"100"; Section 10.1.1:continue
| "101"; Section 10.1.2:switching protocols
| "200"; Section 10.2.1:ok
| "201"; Section 10.2.2:created
| "202"; Section 10.2.3:accepted
| "203"; Section 10.2.4:non-authoritative Information
| "204"; Section 10.2.5:no Content
| "205"; Section 10.2.6:reset Content
| "206"; Section 10.2.7:partial Content
| "300"; Section 10.3.1:multiple choices
| "301"; Section 10.3.2:moved Permanently
| "302"; Section 10.3.3:found
| "303"; Section 10.3.4:see
| "304"; Section 10.3.5:not Modified
| "305"; Section 10.3.6:use Proxy
| "307"; Section 10.3.8:temporary Redirect
| "400"; Section 10.4.1:bad Request
| "401"; Section 10.4.2:unauthorized
| "402"; Section 10.4.3:payment Required
| "403"; Section 10.4.4:forbidden
| "404"; Section 10.4.5:not Found
| "405"; Section 10.4.6:method not allowed
| "406"; Section 10.4.7:not acceptable

| "407"; Section 10.4.8:proxy authentication Required
| "408"; Section 10.4.9:request time-out
| "409"; Section 10.4.10:conflict
| "410"; Section 10.4.11:gone
| "411"; Section 10.4.12:length Required
| "412"; Section 10.4.13:precondition Failed
| "413"; Section 10.4.14:request Entity Too Large
| "414"; Section 10.4.15:request-uri Too Large
| "415"; Section 10.4.16:unsupported Media Type
| "416"; Section 10.4.17:requested range not satisfiable
| "417"; Section 10.4.18:expectation Failed
| "500"; Section 10.5.1:internal Server Error
| "501"; Section 10.5.2:not implemented
| "502"; Section 10.5.3:bad Gateway
| "503"; Section 10.5.4:service unavailable
| "504"; Section 10.5.5:gateway time-out
| "505"; Section 10.5.6:http Version not supported
| Extension-code



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.