packages/net/obfs4proxy/patches/bug-24793-send-correct-http-header-for-basic-auth.patch
Jeffery To 9c6d03db9e obfs4proxy: new packages (including dependencies)
obfs4proxy is a Tor pluggable transport proxy, implementing obfs4.

This commit also includes obfs4proxy's build time dependencies:

* golang-github-agl-ed25519: Go implementation of Ed25519 signature
  algorithm
* golang-github-dchest-siphash: Go implementation of SipHash-2-4
* golang-golang-x-crypto: Go supplementary cryptography libraries
* golang-golang-x-net: Go supplementary network libraries
* golang-golang-x-sys: Go packages for interaction with the OS
* golang-golang-x-text: Go text processing support
* golang-torproject-pluggable-transports-goptlib: Tor pluggable
  transports library for Go

Signed-off-by: Jeffery To <jeffery.to@gmail.com>
2018-06-25 16:52:59 +08:00

40 lines
1.2 KiB
Diff

From af4824cb0b2c36a0eba4bc1590eb0737302e992e Mon Sep 17 00:00:00 2001
From: Yawning Angel <yawning@schwanenlied.me>
Date: Wed, 10 Jan 2018 15:11:44 +0000
Subject: Bug 24793: Send the correct authorization HTTP header for basic auth.
Apparently I didn't test the "connect via HTTP(s)" proxy with
authentication at all when I added that functionality, so it has been
broken for years.
This should fix it now.
---
obfs4proxy/proxy_http.go | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/obfs4proxy/proxy_http.go b/obfs4proxy/proxy_http.go
index 6f11790..a5c2100 100644
--- a/obfs4proxy/proxy_http.go
+++ b/obfs4proxy/proxy_http.go
@@ -29,6 +29,7 @@ package main
import (
"bufio"
+ "encoding/base64"
"fmt"
"net"
"net/http"
@@ -90,7 +91,9 @@ func (s *httpProxy) Dial(network, addr string) (net.Conn, error) {
}
req.Close = false
if s.haveAuth {
- req.SetBasicAuth(s.username, s.password)
+ // SetBasicAuth doesn't quite do what is appropriate, because
+ // the correct header is `Proxy-Authorization`.
+ req.Header.Set("Proxy-Authorization", base64.StdEncoding.EncodeToString([]byte(s.username + ":" + s.password)))
}
req.Header.Set("User-Agent", "")
--
cgit v1.1