aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/buildgen/generate_build_additions.sh2
-rw-r--r--tools/http2_interop/s6.5.go58
-rw-r--r--tools/http2_interop/s6.5_test.go11
-rw-r--r--tools/http2_interop/settings.go4
-rw-r--r--tools/run_tests/sources_and_headers.json75
-rw-r--r--tools/run_tests/tests.json32
6 files changed, 181 insertions, 1 deletions
diff --git a/tools/buildgen/generate_build_additions.sh b/tools/buildgen/generate_build_additions.sh
index b5df150ed1..bd5a78cbc2 100644
--- a/tools/buildgen/generate_build_additions.sh
+++ b/tools/buildgen/generate_build_additions.sh
@@ -28,7 +28,7 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-gen_build_yaml_dirs="test/core/end2end test/core/bad_client"
+gen_build_yaml_dirs="test/core/end2end test/core/bad_client test/core/bad_ssl"
gen_build_files=""
for gen_build_yaml in $gen_build_yaml_dirs
do
diff --git a/tools/http2_interop/s6.5.go b/tools/http2_interop/s6.5.go
index 32468abe83..4295c46f73 100644
--- a/tools/http2_interop/s6.5.go
+++ b/tools/http2_interop/s6.5.go
@@ -1,6 +1,7 @@
package http2interop
import (
+ "fmt"
"time"
)
@@ -30,3 +31,60 @@ func testSmallMaxFrameSize(ctx *HTTP2InteropCtx) error {
return nil
}
+
+// Section 6.5.3 says all settings frames must be acked.
+func testAllSettingsFramesAcked(ctx *HTTP2InteropCtx) error {
+ conn, err := connect(ctx)
+ if err != nil {
+ return err
+ }
+ defer conn.Close()
+ conn.SetDeadline(time.Now().Add(defaultTimeout))
+
+ sf := &SettingsFrame{}
+ if err := http2Connect(conn, sf); err != nil {
+ return err
+ }
+
+ // The spec says "The values in the SETTINGS frame MUST be processed in the order they
+ // appear. [...] Once all values have been processed, the recipient MUST immediately
+ // emit a SETTINGS frame with the ACK flag set." From my understanding, processing all
+ // of no values warrants an ack per frame.
+ for i := 0; i < 10; i++ {
+ if err := streamFrame(conn, sf); err != nil {
+ return err
+ }
+ }
+
+ var settingsFramesReceived = 0
+ // The server by default sends a settings frame as part of the handshake, and another
+ // after the receipt of the initial settings frame as part of our conneection preface.
+ // This means we expected 1 + 1 + 10 = 12 settings frames in return, with all but the
+ // first having the ack bit.
+ for settingsFramesReceived < 12 {
+ f, err := parseFrame(conn)
+ if err != nil {
+ return err
+ }
+
+ // Other frames come down the wire too, including window update. Just ignore those.
+ if f, ok := f.(*SettingsFrame); ok {
+ settingsFramesReceived += 1
+ if settingsFramesReceived == 1 {
+ if f.Header.Flags&SETTINGS_FLAG_ACK > 0 {
+ return fmt.Errorf("settings frame should not have used ack: %v")
+ }
+ continue
+ }
+
+ if f.Header.Flags&SETTINGS_FLAG_ACK == 0 {
+ return fmt.Errorf("settings frame should have used ack: %v", f)
+ }
+ if len(f.Params) != 0 {
+ return fmt.Errorf("settings ack cannot have params: %v", f)
+ }
+ }
+ }
+
+ return nil
+}
diff --git a/tools/http2_interop/s6.5_test.go b/tools/http2_interop/s6.5_test.go
index 9dadd4e699..063fd5664c 100644
--- a/tools/http2_interop/s6.5_test.go
+++ b/tools/http2_interop/s6.5_test.go
@@ -13,3 +13,14 @@ func TestSoonSmallMaxFrameSize(t *testing.T) {
err := testSmallMaxFrameSize(ctx)
matchError(t, err, "Got goaway frame")
}
+
+func TestSoonAllSettingsFramesAcked(t *testing.T) {
+ defer Report(t)
+ if *testCase != "framing" {
+ t.SkipNow()
+ }
+ ctx := InteropCtx(t)
+ if err := testAllSettingsFramesAcked(ctx); err != nil {
+ t.Fatal(err)
+ }
+}
diff --git a/tools/http2_interop/settings.go b/tools/http2_interop/settings.go
index 97914d960f..544cec01ee 100644
--- a/tools/http2_interop/settings.go
+++ b/tools/http2_interop/settings.go
@@ -26,6 +26,10 @@ const (
SettingsMaxHeaderListSize SettingsIdentifier = 6
)
+const (
+ SETTINGS_FLAG_ACK byte = 0x01
+)
+
func (si SettingsIdentifier) String() string {
switch si {
case SettingsHeaderTableSize:
diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json
index cd11c5dc5a..2ea8715c80 100644
--- a/tools/run_tests/sources_and_headers.json
+++ b/tools/run_tests/sources_and_headers.json
@@ -17278,6 +17278,64 @@
]
},
{
+ "deps": [
+ "bad_ssl_test_server",
+ "gpr",
+ "gpr_test_util",
+ "grpc",
+ "grpc_test_util"
+ ],
+ "headers": [],
+ "language": "c",
+ "name": "bad_ssl_alpn_server",
+ "src": [
+ "test/core/bad_ssl/servers/alpn.c"
+ ]
+ },
+ {
+ "deps": [
+ "bad_ssl_test_server",
+ "gpr",
+ "gpr_test_util",
+ "grpc",
+ "grpc_test_util"
+ ],
+ "headers": [],
+ "language": "c",
+ "name": "bad_ssl_cert_server",
+ "src": [
+ "test/core/bad_ssl/servers/cert.c"
+ ]
+ },
+ {
+ "deps": [
+ "gpr",
+ "gpr_test_util",
+ "grpc",
+ "grpc_test_util"
+ ],
+ "headers": [],
+ "language": "c",
+ "name": "bad_ssl_alpn_test",
+ "src": [
+ "test/core/bad_ssl/bad_ssl_test.c"
+ ]
+ },
+ {
+ "deps": [
+ "gpr",
+ "gpr_test_util",
+ "grpc",
+ "grpc_test_util"
+ ],
+ "headers": [],
+ "language": "c",
+ "name": "bad_ssl_cert_test",
+ "src": [
+ "test/core/bad_ssl/bad_ssl_test.c"
+ ]
+ },
+ {
"deps": [],
"headers": [
"include/grpc/support/alloc.h",
@@ -20844,5 +20902,22 @@
"test/core/bad_client/bad_client.c",
"test/core/bad_client/bad_client.h"
]
+ },
+ {
+ "deps": [
+ "gpr",
+ "gpr_test_util",
+ "grpc",
+ "grpc_test_util"
+ ],
+ "headers": [
+ "test/core/bad_ssl/server.h"
+ ],
+ "language": "c",
+ "name": "bad_ssl_test_server",
+ "src": [
+ "test/core/bad_ssl/server.c",
+ "test/core/bad_ssl/server.h"
+ ]
}
]
diff --git a/tools/run_tests/tests.json b/tools/run_tests/tests.json
index b43cc62845..5f75accbee 100644
--- a/tools/run_tests/tests.json
+++ b/tools/run_tests/tests.json
@@ -18427,5 +18427,37 @@
"posix",
"windows"
]
+ },
+ {
+ "ci_platforms": [
+ "linux",
+ "mac",
+ "posix"
+ ],
+ "exclude_configs": [],
+ "flaky": false,
+ "language": "c",
+ "name": "bad_ssl_alpn_test",
+ "platforms": [
+ "linux",
+ "mac",
+ "posix"
+ ]
+ },
+ {
+ "ci_platforms": [
+ "linux",
+ "mac",
+ "posix"
+ ],
+ "exclude_configs": [],
+ "flaky": false,
+ "language": "c",
+ "name": "bad_ssl_cert_test",
+ "platforms": [
+ "linux",
+ "mac",
+ "posix"
+ ]
}
]