当Windows Internet属性 - >连接 - >局域网设置 - >自动配置设置为"自动检测设置"时,Windows如何实际确定/发现设置是什么?它是网络广播还是某种针对在注册表中某处配置的服务器的目标查询,还是其他什么?
如何让git使用socks代理进行http传输?
我成功地使用GIT_PROXY_COMMAND配置git以使用socks代理进行GIT传输.
此外,我已经配置我的.curlrc文件来定义socks代理,我可以直接用curl命令获取信息,如:
curl http://git.kernel.org/pub/scm/git/git.git/info/refs?service=git-upload-pack
Run Code Online (Sandbox Code Playgroud)
但是如何使用带git的socks代理来使用http传输协议检索数据,如:
git clone http://git.kernel.org/pub/scm/git
Run Code Online (Sandbox Code Playgroud) 我的目标是在端口80上运行Node.js.这是因为我发现node.js被阻止某些不允许来自任何其他端口的流量的网络.
看来最好的方法是通过Node.js代理Apache.我曾尝试使用node-http-proxy来做到这一点,但我没有运气.
我正在使用的代码在这里:
var util = require('util'),
http = require('http'),
httpProxy = require('http-proxy');
httpProxy.createServer(9000, 'localhost').listen(80);
http.createServer(function (req, res) {
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.write('request successfully proxied to: ' + req.url + '\n' + JSON.stringify(req.headers, true, 2));
res.end();
}).listen(9000);
Run Code Online (Sandbox Code Playgroud)
但我不断收到端口80的错误"正在使用的地址".我一定是做错了.
如何使用node-http-proxy通过node.js代理Apache?这会让我在端口80上运行node.js吗?node-http-proxy是实现这一目标的最佳方式吗?
谢谢.
我知道你们都会回答"使用像Fiddler这样的调试代理服务器",但事情并非那么简单.
这是我的情况:我有一些代码在服务器上运行,在ASP.NET页面代码隐藏(aspx.cs)中,其中(除其他外)建立与另一个服务器的连接,抓取一些东西,然后格式化它并将其返回给浏览器.
问题是其他服务器做错了,所以我希望能够将调试标志传递到页面中(通过查询字符串,例如?debug = true),这样它就会打印出完全原始的 HTTP请求它发送到其他服务器所以我可以看到什么是错的.这段代码在几个地方运行,所以我希望能够在dev,staging或production上传递这个标志,只看到请求,而不必弄清楚生产服务器是否可以与某处存在的代理服务器通信等
你会认为这样做很容易,对吧?所以我觉得我疯了或者别的什么,但我查看了HttpWebRequest及其父类WebRequest的参考资料 - 什么都没有.没有办法.你会认为微软会想到这一点.最接近的是你可以访问"Headers"集合,但是当我尝试它时,它省略了一些非常重要的标题,如"内容长度" - 所以它必须"撒谎"给我(我知道它在撒谎,因为我知道因为远程服务器返回200状态 - 请求成功,它只返回错误/不同/错误的数据)
这是ask-for代码示例:
HttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://www.whatever.com");
req.Method = ... whatever ...;
... other setup for the request ...
/* At this point we are about to send the request.
What does the raw HTTP request look like? */
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
Run Code Online (Sandbox Code Playgroud) 我正在使用基于Eclipse 3.7的springsource工具套件2.7.2.Maven插件现在开箱即用Eclipse,这很棒,即使使用以前的Eclipse版本也会出现这个问题.
所以这是我的问题:
我已经在我的settings.xml文件中设置了代理信息,并且在命令行上Maven工作得很好.我也在Eclipse配置本身设置了相同的代理详细信息,我知道它是正确的,并且更新与它一起工作,而不是没有.
当然,Eclipse安装中的Maven插件设置为使用正确的settings.xml文件.
但是eclipse中的maven只是没有使用其中任何一个地方的代理设置,每次更改pom文件时这都非常烦人.有没有人有这个问题的解决方案?
这是我的settings.xml文件:
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<profiles>
<profile>
<id>general</id>
<repositories>
<repository>
<snapshots><enabled>false</enabled></snapshots>
<id>ibiblio</id>
<name>Maven ibiblio</name>
<url>http://www.ibiblio.org/maven2</url>
</repository>
<repository>
<snapshots><enabled>true</enabled></snapshots>
<id>ibiblio2</id>
<name>Maven ibiblio2</name>
<url>http://mirrors.ibiblio.org/pub/mirrors/maven2/</url>
</repository>
<repository>
<snapshots><enabled>true</enabled></snapshots>
<id>maven</id>
<name>Maven sunsite</name>
<url>http://repo1.maven.org/maven2/</url>
</repository>
<repository>
<snapshots><enabled>true</enabled></snapshots>
<id>jboss</id>
<name>Maven jboss</name>
<url>http://repository.jboss.org/maven2/</url>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>general</activeProfile>
</activeProfiles>
<proxies>
<proxy>
<id>proxy</id>
<active>true</active>
<protocol>http</protocol>
<host>myproxyserver</host>
<port>80</port>
<username>myusername</username>
<password>mypassword</password>
</proxy>
</proxies>
</settings>
Run Code Online (Sandbox Code Playgroud) 我有一个Rails应用程序在我的服务器上运行,现在我想添加另一个.
我希望Nginx检查请求是什么,并根据域名分割流量
两个站点都有自己的nginx.conf符号链接到启用了站点,但是从nginx启动时出错 Starting nginx: nginx: [emerg] duplicate listen options for 0.0.0.0:80 in /etc/nginx/sites-enabled/bubbles:6
他们都在聆听80但不同的事情.
网站#1
upstream blog_unicorn {
server unix:/tmp/unicorn.blog.sock fail_timeout=0;
}
server {
listen 80 default deferred;
server_name walrus.com www.walrus.com;
root /home/deployer/apps/blog/current/public;
location ^~ /assets/ {
gzip_static on;
expires max;
add_header Cache-Control public;
}
try_files $uri/index.html $uri @blog_unicorn;
location @blog_unicorn {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://blog_unicorn;
}
error_page 500 502 503 504 /500.html;
client_max_body_size 4G;
keepalive_timeout 10;
}
Run Code Online (Sandbox Code Playgroud)
网站二:
upstream bubbles_unicorn {
server …Run Code Online (Sandbox Code Playgroud) 以下代码适用于我:
var webProxy = WebProxy.GetDefaultProxy();
webProxy.UseDefaultCredentials = true;
WebRequest.DefaultWebProxy = webProxy;
Run Code Online (Sandbox Code Playgroud)
不幸的是,WebProxy.GetDefaultProxy()已被弃用.我还应该做什么?
(在部署中不允许使用app.config设置defaultProxy设置)
我正在尝试使用python包管理器pip来安装包,它是来自互联网的依赖项.但是我在我的大学里代理了一个代理,并且已经设置了http_proxy环境变量.但是当我尝试安装这样的包时:
pip install TwitterApi
Run Code Online (Sandbox Code Playgroud)
我在日志文件中收到此错误:
Getting page http://pypi.python.org/simple/TwitterApi
Could not fetch URL http://pypi.python.org/simple/TwitterApi: <urlopen error [Errno 111] Connection refused>
Will skip URL http://pypi.python.org/simple/TwitterApi when looking for download links for TwitterApi
Getting page http://pypi.python.org/simple/
Could not fetch URL http://pypi.python.org/simple/: <urlopen error [Errno 111] Connection refused>
Run Code Online (Sandbox Code Playgroud)
我甚至试着像这样明确地设置我的代理变量:
pip install --proxy http://user:password@proxyserver:port TwitterApi
Run Code Online (Sandbox Code Playgroud)
但我仍然得到同样的错误.如何让pip在代理服务器后面工作.
据我所知,HTTP_X_FORWARDED_FOR代理服务器设置了一个标头,用于标识通过代理发出HTTP请求的主机的IP地址.我听说过标题HTTP_CLIENT_IP是出于类似目的设置的.
HTTP_CLIENT_IP和之间有什么区别HTTP_X_FORWARDED_FOR?我在我的Python脚本中使用了很棒的Requests库:
import requests
r = requests.get("some-site.com")
print r.text
Run Code Online (Sandbox Code Playgroud)
我想用socks代理.但是Requests现在只支持HTTP代理.
我怎样才能做到这一点?