[tor-commits] [meek/utls_2] Test for copyPublicFields.

dcf at torproject.org dcf at torproject.org
Thu Jan 31 08:10:00 UTC 2019


commit 078c8842583b66b25dbadf86a868d85d0634a04e
Author: David Fifield <david at bamsoftware.com>
Date:   Thu Jan 31 00:41:43 2019 -0700

    Test for copyPublicFields.
---
 meek-client/utls_test.go | 41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/meek-client/utls_test.go b/meek-client/utls_test.go
new file mode 100644
index 0000000..8facb88
--- /dev/null
+++ b/meek-client/utls_test.go
@@ -0,0 +1,41 @@
+package main
+
+import (
+	"net/http"
+	"testing"
+)
+
+func TestCopyPublicFieldsHTTPTransport(t *testing.T) {
+	src := http.DefaultTransport.(*http.Transport)
+	dst := &http.Transport{}
+	copyPublicFields(dst, src)
+	// Test various fields that we might care about a copy of http.Transport
+	// having.
+	if dst.DisableKeepAlives != src.DisableKeepAlives {
+		t.Errorf("mismatch on DisableKeepAlives")
+	}
+	if dst.DisableCompression != src.DisableCompression {
+		t.Errorf("mismatch on DisableCompression")
+	}
+	if dst.MaxIdleConns != src.MaxIdleConns {
+		t.Errorf("mismatch on MaxIdleConns")
+	}
+	if dst.MaxIdleConnsPerHost != src.MaxIdleConnsPerHost {
+		t.Errorf("mismatch on MaxIdleConnsPerHost")
+	}
+	if dst.MaxConnsPerHost != src.MaxConnsPerHost {
+		t.Errorf("mismatch on MaxConnsPerHost")
+	}
+	if dst.IdleConnTimeout != src.IdleConnTimeout {
+		t.Errorf("mismatch on IdleConnTimeout")
+	}
+	if dst.ResponseHeaderTimeout != src.ResponseHeaderTimeout {
+		t.Errorf("mismatch on ResponseHeaderTimeout")
+	}
+	if dst.ExpectContinueTimeout != src.ExpectContinueTimeout {
+		t.Errorf("mismatch on ExpectContinueTimeout")
+	}
+	if dst.MaxResponseHeaderBytes != src.MaxResponseHeaderBytes {
+		t.Errorf("mismatch on MaxResponseHeaderBytes")
+	}
+}





More information about the tor-commits mailing list