Giter Club home page Giter Club logo

httpproxy's People

Contributors

yryz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

httpproxy's Issues

建议添加一个命令行参数"-c"手动指定配置文件的位置

首先,感谢编写了这个工具,之前一直用polipo做中转,还纳闷过为什么ss客户端的本地部分非得用socks5监听,就不能提供一个http的代理?我倒是琢磨过干脆自己实现一个,结果要么没时间,要么忘记了。看到你这有现成的了真是太好了。

看了一下你的config.go,配置文件硬编码到了~/.httpproxy/config.json。一般命令行工具除了有默认的配置文件路径以外还会提供参数让用户直接传递配置文件路径。所以我建议能加一个-c flag,可以让用户指定配置文件,这样也好方便做系统启动直接运行的服务。

代理http可以,https不行

我代理后,访问https://www.baidu.com不行,会报如下错误

INFO[2019-09-21T16:40:31+08:00] CONNECT www.baidu.com:443                    
ERRO[2019-09-21T16:40:31+08:00] ss dial: dial tcp: lookup tcp/port: nodename nor servname provided, or not known 
2019/09/21 16:40:31 http: response.WriteHeader on hijacked connection from github.com/yryz/httpproxy/proxy.(*ProxyServer).HandleConnect (proxy.go:67)
2019/09/21 16:40:31 http: response.Write on hijacked connection from fmt.Fprintln (print.go:266)

HTTP 301返回会被错认为200

原因:

proxy.go文件第90行,没有把resp, err := tr.RoundTrip(r)respstatus值传递给w http.ResponseWriter,导致返回值全是200。这样会造成比如访问http网站做301跳转https失效。

解决:

应该在107行//copy body的前一行添加w.WriteHeader(resp.StatusCode)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.