{"id":85871,"date":"2020-05-13T20:25:09","date_gmt":"2020-05-13T12:25:09","guid":{"rendered":"http:\/\/4563.org\/?p=85871"},"modified":"2020-05-13T20:25:09","modified_gmt":"2020-05-13T12:25:09","slug":"%e6%9c%89%e6%b2%a1%e6%9c%89%e5%b0%86-cgi-proxy-%e8%bd%ac%e5%8c%96%e4%b8%ba%e6%99%ae%e9%80%9a-http-proxy-%e7%9a%84%e5%b7%a5%e5%85%b7%e5%91%a2%ef%bc%9f","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=85871","title":{"rendered":"\u6709\u6ca1\u6709\u5c06 CGI Proxy \u8f6c\u5316\u4e3a\u666e\u901a HTTP Proxy \u7684\u5de5\u5177\u5462\uff1f"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u6709\u6ca1\u6709\u5c06 CGI Proxy \u8f6c\u5316\u4e3a\u666e\u901a HTTP Proxy \u7684\u5de5\u5177\u5462\uff1f               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : CoolSpring <\/span>  <span><i><\/i> 5<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u6839\u636e Wikipedia\uff0cCGI Proxy \u7684\u5b9a\u4e49\u662f\u201cA CGI web proxy accepts target URLs using a Web form in the user&#8217;s browser window, processes the request, and returns the results to the user&#8217;s browser.\u201d\uff08 CGI \u4ee3\u7406\u4f7f\u7528\u6d4f\u89c8\u5668\u4e2d\u7684 Web \u8868\u5355\u63a5\u53d7\u76ee\u6807 URL\uff0c\u5904\u7406\u8bf7\u6c42\uff0c\u5e76\u5c06\u7ed3\u679c\u8fd4\u56de\u7ed9\u7528\u6237\u6d4f\u89c8\u5668\u3002\uff09<\/p>\n<p>\u6211\u4eec\u5b66\u6821\u4f7f\u7528\u7684\u662f\u6df1\u4fe1\u670d\u7684 SSLVPN \u4ea7\u54c1\uff0c\u5bf9\u4e8e\u5728\u6821\u5916\u63a5\u5165\u6821\u56ed\u7f51\u73af\u5883\u7684\u9700\u6c42\uff0c\u63d0\u4f9b\u4e86\u4e24\u79cd\u65b9\u5f0f\u2014\u2014<\/p>\n<ol>\n<li>\u4f7f\u7528 EasyConnect \u5ba2\u6237\u7aef\uff0c\u7136\u800c\u8fd9\u4e2a\u5ba2\u6237\u7aef\u7684\u98ce\u8bc4\u4e0d\u600e\u4e48\u597d\uff1b<\/li>\n<li>\u624b\u673a\u7248\u8bbf\u95ee https:\/\/rvpn.zju.edu.cn \uff0c\u767b\u5f55\u540e\u53ef\u4ee5\u5f97\u5230\u8fd9\u6837\u4e00\u4e2a\u754c\u9762\uff1a https:\/\/i.loli.net\/2020\/05\/10\/x6LkImzYV1QD2Pq.png \u3002\u518d\u8f93\u5165\u7f51\u5740\u4f8b\u5982 cnki.net \uff0c\u70b9\u51fb\u201c\u8bbf\u95ee\u201d\u4f1a\u8df3\u8f6c\u5230\u8fd9\u6837\u7684 URL \u683c\u5f0f https:\/\/rvpn.zju.edu.cn\/web\/1\/https\/0\/cnki.net\/ \u3002\u6240\u4ee5\u8fd9\u5927\u6982\u662f\u53ef\u4ee5\u5f52\u4e3a\u4e0a\u9762\u6240\u8ff0\u7684 CGI Proxy \u4e00\u7c7b\u3002<\/li>\n<\/ol>\n<p>\u4e8e\u662f\u7a81\u7136\u6709\u4e00\u4e2a\u60f3\u6cd5\uff1a\u53ef\u4e0d\u53ef\u4ee5\u901a\u8fc7\u5728\u672c\u5730\u8fd0\u884c\u4e00\u4e2a\u7a0b\u5e8f\u4f2a\u88c5\u6210 HTTP Proxy\uff0c\u628a\u8bf7\u6c42\u8f6c\u53d1\u7ed9\u65b9\u6cd5 2 \u7684\u8fd9\u4e2a CGI Proxy \u5462\uff1f<\/p>\n<p>\u5373<\/p>\n<p><code>\u6d4f\u89c8\u5668 &lt;--\uff08\u666e\u901a\u7684 HTTP \u4ee3\u7406\u8bf7\u6c42\uff09--&gt; \u8868\u73b0\u4e3a HTTP Proxy \u7684\u8f6c\u53d1\u7a0b\u5e8f &lt;--\uff08\u9644\u5e26\u4e0a\u9a8c\u8bc1\u6240\u9700\u7684 Cookie \u7684 Web \u8bf7\u6c42\uff09--&gt; CGI Proxy &lt;----&gt; \u6821\u5185\u7f51\u7ad9<\/code><\/p>\n<p>\u5177\u4f53\u9700\u6c42\uff1a<\/p>\n<ol>\n<li>\u8bfb\u6d4f\u89c8\u5668\u53d1\u9001\u7684\u8bf7\u6c42 1\uff0c\u4ece\u4e2d\u62bd\u53d6 Method, URL, Headers, Cookies<\/li>\n<li>\u5411\u539f\u8bf7\u6c42 1 \u7684 Cookies \u52a0\u5165\u4e00\u4e2a\u5f62\u5982 &#8220;TWFID=xxxxxxxxx&#8221; \u7684\u901a\u8fc7\u9a8c\u8bc1\u7528\u7684 Cookie \u4e4b\u540e\uff0c\u5c06\u8fd9\u4e2a\u8bf7\u6c42 2 \u8f6c\u53d1\u5230 https:\/\/{Web_Portal_Endpoint}\/web\/1\/http(s)\/0\/{URL} \uff08\u6216\u8005\u8bf4\u662f\u65b0\u751f\u6210\u4e00\u4e2a\u8bf7\u6c42 2\uff0c\u603b\u4e4b\u8fbe\u5230\u76ee\u7684\u5373\u53ef\uff09<\/li>\n<li>\u8bfb\u8bf7\u6c42 2 \u8fd4\u56de\u7684\u5185\u5bb9\uff0c\u8fdb\u884c\u4e00\u5b9a\u7684\u8fc7\u6ee4\u5904\u7406\uff08\u8fd9\u4e2a\u7f51\u9875\u7248 SSLVPN \u4f1a\u63d2\u5165\u4e00\u4e9b JS \u6587\u4ef6\u548c HTML Tag\uff0c\u539f\u672c\u662f\u4e3a\u4e86 URL Rewrite\uff0c\u4f46\u6709\u65f6\u8fd9\u4e9b\u811a\u672c\u4f1a\u5f71\u54cd\u7f51\u9875\u7684\u6b63\u5e38\u529f\u80fd\uff0c\u56e0\u6b64\u9700\u8981\u53bb\u9664\uff0c\u4e5f\u53ef\u4ee5\u53bb\u9664\uff09\u4e4b\u540e\u5c06\u6539\u52a8\u540e\u7684 Response \u53d1\u56de\u7ed9\u6d4f\u89c8\u5668\u3002<\/li>\n<\/ol>\n<p>\u76ee\u524d\u7528 Uvicorn + Requests \u5df2\u53ef\u4ee5\u5b9e\u73b0\u7b80\u5355\u7684 HTTP GET\/POST \u8bf7\u6c42\u8f6c\u53d1\uff0c\u4f46\u662f\u4e0d\u652f\u6301 HTTPS\uff0c\u56e0\u4e3a HTTPS \u9700\u8981\u7528\u5230 CONNECT \u65b9\u6cd5\uff0c\u800c\u6211\u4e0d\u77e5\u9053\u5b83\u5728\u6211\u8fd9\u79cd\u60c5\u666f\u4e0b\u8be5\u5982\u4f55\u5b9e\u73b0\u3002<\/p>\n<p>\u6240\u4ee5\u6765\u8bf7\u6559\u5927\u5bb6\uff0c\u6211\u7684\u8fd9\u79cd\u60f3\u6cd5\u6709\u6ca1\u6709\u73b0\u6210\u7684\u5de5\u5177\u5462\uff1f\u6216\u8005\u8bf4\uff0c\u5e94\u8be5\u4ece\u54ea\u4e2a\u62bd\u8c61\u7684\u5c42\u7ea7\u5165\u624b\uff08\u5355\u4ece Python \u6765\u8bf4\uff0c\u67e5\u5230\u4e86 socket, h11, twisted \u7b49\u5e93\u4e0d\u77e5\u5982\u4f55\u9009\u62e9\u3002\u5b83\u4eec\u7684\u5c01\u88c5\u7a0b\u5ea6\u5404\u4e0d\u76f8\u540c\uff0c\u60f3\u8981\u80fd\u8fbe\u5230\u76ee\u6807\u5374\u53c8\u4e0d\u60f3\u6d89\u53ca\u5230\u592a\u7e41\u6742\u7684\u65e0\u5173\u7684\u5e95\u5c42\u5904\u7406\uff09<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>2<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"1499852\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : oott123 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8fd9\u5e94\u8be5\u4e0d\u662f CGI Proxy\uff0c\u66f4\u50cf\u662f\u4e00\u79cd reverse proxy\uff0c\u5373\u53cd\u5411\u4ee3\u7406<\/p>\n<p>\u73b0\u6210\u5de5\u5177\u6ca1\u6709\u542c\u8bf4\u8fc7                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"1499853\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Latin <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5148\u6293\u5305\uff0c\u4e00\u822c\u8fd9\u79cd vpn \u5927\u591a\u8d70\u7684\u90fd\u662f pac                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u6709\u6ca1\u6709\u5c06 CGI Proxy \u8f6c\u5316&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/85871"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=85871"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/85871\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=85871"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=85871"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=85871"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}