[tor-commits] [obfs4/master] (meek_lite) Explicitly set Content-Length to zero when there is no data to send.

yawning at torproject.org yawning at torproject.org
Sat Apr 21 03:11:55 UTC 2018


commit 89c21805c212bcc2f5a0c4ffdadf424cbff1c7c9
Author: Yawning Angel <yawning at schwanenlied.me>
Date:   Sat Apr 21 03:11:26 2018 +0000

    (meek_lite) Explicitly set Content-Length to zero when there is no data to send.
    
    https://gitweb.torproject.org/pluggable-transports/meek.git/commit/?h=0.28&id=0ea861efe5873b517fbd08c4bc48027e4db16a95
---
 ChangeLog                   | 2 ++
 transports/meeklite/meek.go | 6 +++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 3a4a178..361ceb4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 Changes in version 0.0.8 - UNRELEASED:
  - Bug 24793: Send the correct authorization HTTP header for basic auth.
+ - (meek_lite) Explicitly set Content-Length to zero when there is no data
+   to send.
 
 Changes in version 0.0.7 - 2016-11-15:
  - Support configuring the obfs4 IAT parameter as the sole
diff --git a/transports/meeklite/meek.go b/transports/meeklite/meek.go
index f0d29db..e068b68 100644
--- a/transports/meeklite/meek.go
+++ b/transports/meeklite/meek.go
@@ -231,7 +231,11 @@ func (c *meekConn) roundTrip(sndBuf []byte) (recvBuf []byte, err error) {
 		if c.args.front != "" {
 			url.Host = c.args.front
 		}
-		req, err = http.NewRequest("POST", url.String(), bytes.NewReader(sndBuf))
+		var body io.Reader
+		if len(sndBuf) > 0 {
+			body = bytes.NewReader(sndBuf)
+		}
+		req, err = http.NewRequest("POST", url.String(), body)
 		if err != nil {
 			return nil, err
 		}



More information about the tor-commits mailing list