Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Grpc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tci-gateway-module
Grpc
Commits
80428e6d
Commit
80428e6d
authored
9 years ago
by
David G. Quintas
Browse files
Options
Downloads
Plain Diff
Merge pull request #4437 from carl-mastrangelo/wombal
Add test to check that all settings frames are acked
parents
6181bbcd
756beae6
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
tools/http2_interop/s6.5.go
+58
-0
58 additions, 0 deletions
tools/http2_interop/s6.5.go
tools/http2_interop/s6.5_test.go
+11
-0
11 additions, 0 deletions
tools/http2_interop/s6.5_test.go
tools/http2_interop/settings.go
+4
-0
4 additions, 0 deletions
tools/http2_interop/settings.go
with
73 additions
and
0 deletions
tools/http2_interop/s6.5.go
+
58
−
0
View file @
80428e6d
package
http2interop
package
http2interop
import
(
import
(
"fmt"
"time"
"time"
)
)
...
@@ -30,3 +31,60 @@ func testSmallMaxFrameSize(ctx *HTTP2InteropCtx) error {
...
@@ -30,3 +31,60 @@ func testSmallMaxFrameSize(ctx *HTTP2InteropCtx) error {
return
nil
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
}
This diff is collapsed.
Click to expand it.
tools/http2_interop/s6.5_test.go
+
11
−
0
View file @
80428e6d
...
@@ -13,3 +13,14 @@ func TestSoonSmallMaxFrameSize(t *testing.T) {
...
@@ -13,3 +13,14 @@ func TestSoonSmallMaxFrameSize(t *testing.T) {
err
:=
testSmallMaxFrameSize
(
ctx
)
err
:=
testSmallMaxFrameSize
(
ctx
)
matchError
(
t
,
err
,
"Got goaway frame"
)
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
)
}
}
This diff is collapsed.
Click to expand it.
tools/http2_interop/settings.go
+
4
−
0
View file @
80428e6d
...
@@ -26,6 +26,10 @@ const (
...
@@ -26,6 +26,10 @@ const (
SettingsMaxHeaderListSize
SettingsIdentifier
=
6
SettingsMaxHeaderListSize
SettingsIdentifier
=
6
)
)
const
(
SETTINGS_FLAG_ACK
byte
=
0x01
)
func
(
si
SettingsIdentifier
)
String
()
string
{
func
(
si
SettingsIdentifier
)
String
()
string
{
switch
si
{
switch
si
{
case
SettingsHeaderTableSize
:
case
SettingsHeaderTableSize
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment