@@ -20,13 +20,11 @@ import (
20
20
"net/http"
21
21
"net/http/httptest"
22
22
"os"
23
- "os/exec"
24
23
"reflect"
25
24
"runtime"
26
25
"strconv"
27
26
"strings"
28
27
"sync"
29
- "sync/atomic"
30
28
"testing"
31
29
"time"
32
30
@@ -2704,96 +2702,6 @@ func readBodyHandler(t *testing.T, want string) func(w http.ResponseWriter, r *h
2704
2702
}
2705
2703
}
2706
2704
2707
- // TestServerWithCurl currently fails, hence the LenientCipherSuites test. See:
2708
- //
2709
- // https://github.com/tatsuhiro-t/nghttp2/issues/140 &
2710
- // http://sourceforge.net/p/curl/bugs/1472/
2711
- func TestServerWithCurl (t * testing.T ) { testServerWithCurl (t , false ) }
2712
- func TestServerWithCurl_LenientCipherSuites (t * testing.T ) { testServerWithCurl (t , true ) }
2713
-
2714
- func testServerWithCurl (t * testing.T , permitProhibitedCipherSuites bool ) {
2715
- if runtime .GOOS != "linux" {
2716
- t .Skip ("skipping Docker test when not on Linux; requires --net which won't work with boot2docker anyway" )
2717
- }
2718
- if testing .Short () {
2719
- t .Skip ("skipping curl test in short mode" )
2720
- }
2721
- requireCurl (t )
2722
- var gotConn int32
2723
- testHookOnConn = func () { atomic .StoreInt32 (& gotConn , 1 ) }
2724
-
2725
- const msg = "Hello from curl!\n "
2726
- ts := httptest .NewUnstartedServer (http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
2727
- w .Header ().Set ("Foo" , "Bar" )
2728
- w .Header ().Set ("Client-Proto" , r .Proto )
2729
- io .WriteString (w , msg )
2730
- }))
2731
- ConfigureServer (ts .Config , & Server {
2732
- PermitProhibitedCipherSuites : permitProhibitedCipherSuites ,
2733
- })
2734
- ts .TLS = ts .Config .TLSConfig // the httptest.Server has its own copy of this TLS config
2735
- ts .StartTLS ()
2736
- defer ts .Close ()
2737
-
2738
- t .Logf ("Running test server for curl to hit at: %s" , ts .URL )
2739
- container := curl (t , "--silent" , "--http2" , "--insecure" , "-v" , ts .URL )
2740
- defer kill (container )
2741
- res , err := dockerLogs (container )
2742
- if err != nil {
2743
- t .Fatal (err )
2744
- }
2745
-
2746
- body := string (res )
2747
- // Search for both "key: value" and "key:value", since curl changed their format
2748
- // Our Dockerfile contains the latest version (no space), but just in case people
2749
- // didn't rebuild, check both.
2750
- if ! strings .Contains (body , "foo: Bar" ) && ! strings .Contains (body , "foo:Bar" ) {
2751
- t .Errorf ("didn't see foo: Bar header" )
2752
- t .Logf ("Got: %s" , body )
2753
- }
2754
- if ! strings .Contains (body , "client-proto: HTTP/2" ) && ! strings .Contains (body , "client-proto:HTTP/2" ) {
2755
- t .Errorf ("didn't see client-proto: HTTP/2 header" )
2756
- t .Logf ("Got: %s" , res )
2757
- }
2758
- if ! strings .Contains (string (res ), msg ) {
2759
- t .Errorf ("didn't see %q content" , msg )
2760
- t .Logf ("Got: %s" , res )
2761
- }
2762
-
2763
- if atomic .LoadInt32 (& gotConn ) == 0 {
2764
- t .Error ("never saw an http2 connection" )
2765
- }
2766
- }
2767
-
2768
- var doh2load = flag .Bool ("h2load" , false , "Run h2load test" )
2769
-
2770
- func TestServerWithH2Load (t * testing.T ) {
2771
- if ! * doh2load {
2772
- t .Skip ("Skipping without --h2load flag." )
2773
- }
2774
- if runtime .GOOS != "linux" {
2775
- t .Skip ("skipping Docker test when not on Linux; requires --net which won't work with boot2docker anyway" )
2776
- }
2777
- requireH2load (t )
2778
-
2779
- msg := strings .Repeat ("Hello, h2load!\n " , 5000 )
2780
- ts := httptest .NewUnstartedServer (http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
2781
- io .WriteString (w , msg )
2782
- w .(http.Flusher ).Flush ()
2783
- io .WriteString (w , msg )
2784
- }))
2785
- ts .StartTLS ()
2786
- defer ts .Close ()
2787
-
2788
- cmd := exec .Command ("docker" , "run" , "--net=host" , "--entrypoint=/usr/local/bin/h2load" , "gohttp2/curl" ,
2789
- "-n100000" , "-c100" , "-m100" , ts .URL )
2790
- cmd .Stdout = os .Stdout
2791
- cmd .Stderr = os .Stderr
2792
- if err := cmd .Run (); err != nil {
2793
- t .Fatal (err )
2794
- }
2795
- }
2796
-
2797
2705
func TestServer_MaxDecoderHeaderTableSize (t * testing.T ) {
2798
2706
wantHeaderTableSize := uint32 (initialHeaderTableSize * 2 )
2799
2707
st := newServerTester (t , func (w http.ResponseWriter , r * http.Request ) {}, func (s * Server ) {
0 commit comments