About the private proxy protocol of mobile Gateway: X-Online-host

Source: Internet
Author: User

As we all know, in domestic GPRS network environments, most users access the Internet using cmwap access points. Cmwap is China Mobile's GPRS proxy for Internet access. Therefore, when creating a connection, you must use a proxy for the connection.
Assume that the url I connect is: http://wap.uc.cn /;
In the standard proxy, it is like this:
Conection to 10.0.0.172: 80
Get http://wap.uc.cn/https/1.1
HOST: wap.uc.cn
However, the program does not have control over the TCP layer in j2s. Therefore, China Mobile defines a private protocol field: X-Online-host. From the specifications of mobile requirements, we only need to connect to the Internet in this way:
Conection to 10.0.0.172: 80
Get, HTTP, 1.1
HOST: 10.0.0.172
X-Online-Host: wap.uc.cn
In fact, for the program, we only need to replace the original connection URL and the host in the HTTP header with 10.0.0.172, and add an HTTP header field: X-Online-host, the value is the original host. Then, you can connect to the Internet through direct connection.
The problem is as follows:
Get, HTTP, 1.1
In the standard proxy protocol specification, the request must be a complete Uri.
This problem does not occur normally, but it is obvious when the requested URL is special.
Suppose my connection URL is: http://wap.baidu.com/logo.gif? Http://wap.uc.cn/uc.png IMG =
Networking using the X-Online-host protocol:
Conection to 10.0.0.172: 80
GET/logo.gif? IMG = http://wap.uc.cn/uc.png HTTP/1.1
HOST: 10.0.0.172
X-Online-Host: wap.baidu.com
After such a request arrives at the mobile gateway, it will be mistakenly sent to http://wap.baidu.com/uc.png. But what we actually want to request is a http://wap.baidu.com/logo.gif (? Variable ).
Because the mobile gateway is actually an HTTP proxy server, which processes the X-Online-host protocol as follows:
Intercept the URL field in the Request Header:
If no http: // field exists, the field is used as the relative Uri, which is supplemented with the X-Online-Host field;
If an http: // field exists, use this field as the absolute Uri and replace the host with the X-Online-host value.

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.