examplecode / mproxy Goto Github PK
View Code? Open in Web Editor NEWc 语言实现的一个最小的http代理,支持翻墙
c 语言实现的一个最小的http代理,支持翻墙
最近研究了一下代码,发现如果把send 和recv 得到的buffer 长度和字母打印出来,得到的长度是一样的,但实际buffer里的数据长度却不一样。实际收到的字节比发出的字节要多一些。很奇怪啊,为什么会这样?加密不是每个字节一一对应的吗?这样解密是才能得到正确的数据。但是又能正常工作。好奇怪的现象。
recv len = 502
buffer recv = GET http://www.google.com/ HTTP/1.1
Host: www.google.com
User-Agent: Mozilla/5.0 (Android 7.1.1; Mobile; rv:53.0) Gecko/53.0 Firefox/53.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8
Accept-Language: zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Cookie: NID=104=m5-no8IetRfnkhU2ccoy3wv-3pnG1ZdBMETkAchadvIN0NLskY4lsZzGdVMTDK7LpSdXzXA1Z3I_5LBEcL-rsrbcr3E8opwieGQp19hdRFg0qR13CwocB1dP5aIc8W_3
Connection: keep-alive
Upgrade-Insecure-Requests: 1
send len = 502
buffer send = ���r:&&"h}}%%%|5==5>7|1=?}r����}c|c_X�=!&hr%%%|5==5>7|1=?_X!7 �57<&hr�=(;>>3}g|brz�<6 =;6re|c|cir�=0;>7ir $hga|b{r�719=}ga|br�; 74=}ga|b_X�117"&hr&7&}:&?>3"">;13&;=<}:&?>y?>(:i#ob|j3"">;13&;=<}*?>i#ob|kx}xi#ob|j_X�117"&�3<5'357hr(:��7<�i#ob|g7<i#ob|a_X�117"&�<1=6;<5hr5(;"~r674>3&7_X�==9;7hr���ocbfo?g<=j&
因为历史兼容性的原因,根据http1.0/1.1规范,代理必须从absolute uri中提取host,而不是从host head field中提取。
https://tools.ietf.org/html/rfc2616#section-5.1.2
The absoluteURI form is REQUIRED when the request is being made to a proxy.
...
Note that the proxy MAY forward the request on to another proxy or directly to the server specified by the absoluteURI.
1. If Request-URI is an absoluteURI, the host is part of the
Request-URI. Any Host header field value in the request MUST be
ignored.
最近GFW更新算法,mproxy是不是不能用了?? 今天早上到公司,突然就不能用了,
下面 agent端的错误,server端没有日志输出。。。:
Sep 13 2017 15:12:55 Cannot connect to host [clients1.google.com:443]
Sep 13 2017 15:12:55 receive CONNECT request
Sep 13 2017 15:12:55 Host:www.google.com port: 443 io_flag:2
Sep 13 2017 15:12:55 ======= forward request to remote host:www.google.com port:443 =======
Sep 13 2017 15:12:55 receive CONNECT request
Sep 13 2017 15:12:55 Host:s2.googleusercontent.com port: 443 io_flag:2
Sep 13 2017 15:12:55 ======= forward request to remote host:s2.googleusercontent.com port:443 =======
Sep 13 2017 15:12:55 receive CONNECT request
Sep 13 2017 15:12:55 Host:s2.googleusercontent.com port: 443 io_flag:2
Sep 13 2017 15:12:55 receive CONNECT request
Sep 13 2017 15:12:55 Host:s2.googleusercontent.com port: 443 io_flag:2
Sep 13 2017 15:12:55 receive CONNECT request
Sep 13 2017 15:12:55 Host:s2.googleusercontent.com port: 443 io_flag:2
Sep 13 2017 15:12:55 receive CONNECT request
Sep 13 2017 15:12:55 Host:s2.googleusercontent.com port: 443 io_flag:2
Sep 13 2017 15:12:55 ======= forward request to remote host:s2.googleusercontent.com port:443 =======
Sep 13 2017 15:12:55 ======= forward request to remote host:s2.googleusercontent.com port:443 =======
Sep 13 2017 15:12:55 ======= forward request to remote host:s2.googleusercontent.com port:443 =======
Sep 13 2017 15:12:55 ======= forward request to remote host:s2.googleusercontent.com port:443 =======
Sep 13 2017 15:12:55 receive CONNECT request
Sep 13 2017 15:12:55 Host:www.google.com port: 443 io_flag:2
Sep 13 2017 15:12:55 ======= forward request to remote host:www.google.com port:443 =======
Sep 13 2017 15:12:55 receive CONNECT request
Sep 13 2017 15:12:55 Host:clients1.google.com port: 443 io_flag:2
Sep 13 2017 15:12:55 ======= forward request to remote host:clients1.google.com port:443 =======
Sep 13 2017 15:12:55 receive CONNECT request
Sep 13 2017 15:12:55 Host:clients1.google.com port: 443 io_flag:2
Sep 13 2017 15:12:55 ======= forward request to remote host:clients1.google.com port:443 =======
Sep 13 2017 15:12:55 Cannot connect to host [clients1.google.com:443]
Sep 13 2017 15:12:55 Cannot connect to host [clients1.google.com:443]
Sep 13 2017 15:12:55 Read Http header failed
就要不支持win用户
路由器 ./mproxy -l 8000 -d 模式运行
手机端直接填入代理IP和端口,路由器可以收到信息,但是一直报错
`Jun 21 2016 16:18:38 ============ handle new client ============
Jun 21 2016 16:18:38 >>>Header:CONNECT acs.m.taobao.com:443 HTTP/1.1
Host: acs.m.taobao.com:443
Proxy-Connection: Keep-Alive
User-Agent: Dalvik/2.1.0 (Linux; U; Android 10; MI 8 MIUI/V12.0.3.0.QEACNXM)
Jun 21 2016 16:18:38 receive CONNECT request
Jun 21 2016 16:18:38 Host:acs.m.taobao.com port: 443 io_flag:0
Jun 21 2016 16:18:38 ====== Bad remote request,close it! ====
`
不知道是哪里出问题了
Your browser sent a request that this server could not understand.
Request header field is missing ':' separator.
erral|utmcct=/download.html
就是设置连接的时候需要账号和密码
启动之后会自动运行相同的进程多个
454行 buffer[i] ^= 1;
这一句有什么用呢?还望不吝赐教
when I use it to connect youtube it can't work , just show Read Http Header failed.
怎么用mproxy无法打开此网站:http://dafahao.com/?
我用其他的翻#墙程序能打开。
测试SwitchyOmega后,结论是不支持您的客户端.
其他网站可以正常用
我有个需求场景:
将http消息拆包到传输层,对端在传输层接收tcp/udp报文,这是否能通过mproxy实现?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.