mirror of
https://github.com/nadoo/glider.git
synced 2025-02-23 01:15:41 +08:00
http: fixed a compatibility issue with some http proxy server. #62
This commit is contained in:
parent
70a88f4789
commit
15b98359b1
4
conf.go
4
conf.go
@ -78,6 +78,7 @@ func confInit() {
|
||||
if !path.IsAbs(ruleFile) {
|
||||
ruleFile = path.Join(flag.ConfDir(), ruleFile)
|
||||
}
|
||||
|
||||
rule, err := rule.NewConfFromFile(ruleFile)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
@ -90,14 +91,13 @@ func confInit() {
|
||||
if !path.IsAbs(conf.RulesDir) {
|
||||
conf.RulesDir = path.Join(flag.ConfDir(), conf.RulesDir)
|
||||
}
|
||||
ruleFolderFiles, _ := rule.ListDir(conf.RulesDir, ".rule")
|
||||
|
||||
ruleFolderFiles, _ := rule.ListDir(conf.RulesDir, ".rule")
|
||||
for _, ruleFile := range ruleFolderFiles {
|
||||
rule, err := rule.NewConfFromFile(ruleFile)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
conf.rules = append(conf.rules, rule)
|
||||
}
|
||||
}
|
||||
|
@ -242,8 +242,10 @@ func (s *HTTP) Dial(network, addr string) (net.Conn, error) {
|
||||
|
||||
respR := bufio.NewReader(rc)
|
||||
respTP := textproto.NewReader(respR)
|
||||
|
||||
_, code, _, ok := parseFirstLine(respTP)
|
||||
if ok && code == "200" {
|
||||
respTP.ReadMIMEHeader()
|
||||
return rc, err
|
||||
} else if code == "407" {
|
||||
log.F("[http] authencation needed by proxy %s", s.addr)
|
||||
|
@ -58,8 +58,8 @@ func NewRedirServer(s string, dialer proxy.Dialer) (proxy.Server, error) {
|
||||
return NewRedirProxy(s, dialer, false)
|
||||
}
|
||||
|
||||
// NewRedirServer returns a redir server.
|
||||
func NewRedirServer6(s string, dialer proxy.Dialer) (proxy.Server, error) {
|
||||
// NewRedir6Server returns a redir server for ipv6.
|
||||
func NewRedir6Server(s string, dialer proxy.Dialer) (proxy.Server, error) {
|
||||
return NewRedirProxy(s, dialer, true)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user