Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
WIP k3po h2
  • Loading branch information
attilakreiner committed Jan 18, 2024
commit 5c7c69dc1aeb1d513086a44a2426ab1e68c0fa8f
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,19 @@ public class ValidationIT
@Test
@Configuration("client.validation.yaml")
@Specification({
"${app}/invalid.response/client",
"${net}/invalid.response/server" })
"${app}/invalid.response.header/client",
"${net}/invalid.response.header/server" })
@Configure(name = HTTP_STREAM_INITIAL_WINDOW_NAME, value = "65535")
public void shouldSendErrorForInvalidHeaderResponse() throws Exception
{
k3po.finish();
}

@Test
@Configuration("client.validation.yaml")
@Specification({
"${app}/invalid.response.content/client",
"${net}/invalid.response.content/server" })
@Configure(name = HTTP_STREAM_INITIAL_WINDOW_NAME, value = "65535")
public void shouldAbortForInvalidResponse() throws Exception
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ bindings:
- status: 200
content-type:
- text/plain
headers:
x-hello: test
content: test
versions:
- h2
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#
# Copyright 2021-2023 Aklivity Inc.
#
# Aklivity licenses this file to you under the Apache License,
# version 2.0 (the "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#

connect "zilla://streams/app0"
option zilla:window 8192
option zilla:transmission "half-duplex"

write zilla:begin.ext ${http:beginEx()
.typeId(zilla:id("http"))
.header(":method", "GET")
.header(":scheme", "http")
.header(":path", "/hello")
.header(":authority", "localhost:8080")
.build()}
connected

read zilla:begin.ext ${http:matchBeginEx()
.typeId(zilla:id("http"))
.header(":status", "503")
.header("retry-after", "0")
.build()}

read closed
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#
# Copyright 2021-2023 Aklivity Inc.
#
# Aklivity licenses this file to you under the Apache License,
# version 2.0 (the "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#

accept "zilla://streams/app0"
option zilla:window 8192
option zilla:transmission "half-duplex"
accepted

read zilla:begin.ext ${http:beginEx()
.typeId(zilla:id("http"))
.header(":method", "GET")
.header(":scheme", "http")
.header(":path", "/hello")
.header(":authority", "localhost:8080")
.build()}
connected

write zilla:begin.ext ${http:beginEx()
.typeId(zilla:id("http"))
.header(":status", "503")
.header("retry-after", "0")
.build()}

write close
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ read zilla:begin.ext ${http:beginEx()
.header(":status", "200")
.header("content-type", "text/plain")
.header("content-length", "13")
.header("x-hello", "1234567890123")
.build()}

read "1234567890123"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ write zilla:begin.ext ${http:beginEx()
.header(":status", "200")
.header("content-type", "text/plain")
.header("content-length", "13")
.header("x-hello", "1234567890123")
.build()}

write "1234567890123"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ write "\r\n"
read "HTTP/1.1 200 OK" "\r\n"
read "Content-Length: 7" "\r\n"
read "Content-Type: text/plain" "\r\n"
read "x-hello: invalid" "\r\n"
read "\r\n"
read "invalid"
read closed
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ write "\r\n"
read "HTTP/1.1 200 OK" "\r\n"
read "Content-Length: 13" "\r\n"
read "Content-Type: text/plain" "\r\n"
read "x-hello: 1234567890123" "\r\n"
read "\r\n"
read "1234567890123"
read closed
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#
# Copyright 2021-2023 Aklivity Inc.
#
# Aklivity licenses this file to you under the Apache License,
# version 2.0 (the "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#

connect "zilla://streams/net0"
option zilla:window 8192
option zilla:transmission "duplex"
connected

# server connection preface - SETTINGS frame
read [0x00 0x00 0x12] # length = 18
[0x04] # HTTP2 SETTINGS frame
[0x00] # flags = 0x00
[0x00 0x00 0x00 0x00] # stream_id = 0
[0x00 0x03 0x00 0x00 0x00 0x64] # SETTINGS_MAX_CONCURRENT_STREAMS(0x03) = 100
[0x00 0x04 0x00 0x00 0x00 0x00] # SETTINGS_INITIAL_WINDOW_SIZE(0x03) = 0
[0x00 0x06 0x00 0x00 0x20 0x00] # SETTINGS_MAX_HEADER_LIST_SIZE(0x06) = 8192

# client connection preface
write "PRI * HTTP/2.0\r\n"
"\r\n"
"SM\r\n"
"\r\n"
write flush

# server connection preface - SETTINGS frame
write [0x00 0x00 0x0c] # length = 12
[0x04] # HTTP2 SETTINGS frame
[0x00] # flags = 0x00
[0x00 0x00 0x00 0x00] # stream_id = 0
[0x00 0x03 0x00 0x00 0x00 0x64] # SETTINGS_MAX_CONCURRENT_STREAMS(0x03) = 100
[0x00 0x04 0x00 0x00 0xff 0xff] # SETTINGS_INITIAL_WINDOW_SIZE(0x04) = 65535

read [0x00 0x00 0x00] # length = 0
[0x04] # HTTP2 SETTINGS frame
[0x01] # ACK
[0x00 0x00 0x00 0x00] # stream_id = 0

write [0x00 0x00 0x1a] # length = 26
[0x01] # HEADERS frame
[0x05] # END_HEADERS | END_STREAM
[0x00 0x00 0x00 0x01] # stream_id = 1
[0x82] # :method: GET
[0x86] # :scheme: http
[0x04] [0x06] "/hello" # :path: /hello
[0x01] [0x0e] "localhost:8080" # :authority: localhost:8080

write [0x00 0x00 0x00] # length = 0
[0x04] # HTTP2 SETTINGS frame
[0x01] # ACK
[0x00 0x00 0x00 0x00] # stream_id = 0

read [0x00 0x00 0x23] # length = 35
[0x01] # HTTP2 HEADERS frame
[0x04] # END_HEADERS
[0x00 0x00 0x00 0x01] # stream_id=1
[0x88] # :status: 200
[0x0f 0x10] [0x0a] "text/plain" # content-type
[0x0f 0x0d] [0x01] "7" # content-length
[0x00 0x07] "x-hello" # x-hello: invalid
[0x07] "invalid"

read [0x00 0x00 0x07] # length = 7
[0x00] # HTTP2 DATA frame
[0x01] # END_STREAM
[0x00 0x00 0x00 0x01] # stream_id=1
"invalid"
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
#
# Copyright 2021-2023 Aklivity Inc.
#
# Aklivity licenses this file to you under the Apache License,
# version 2.0 (the "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#

accept "zilla://streams/net0"
option zilla:window 8192
option zilla:transmission "duplex"
accepted
connected

# server connection preface - SETTINGS frame
write [0x00 0x00 0x12] # length = 18
[0x04] # HTTP2 SETTINGS frame
[0x00] # flags = 0x00
[0x00 0x00 0x00 0x00] # stream_id = 0
[0x00 0x03 0x00 0x00 0x00 0x64] # SETTINGS_MAX_CONCURRENT_STREAMS(0x03) = 100
[0x00 0x04 0x00 0x00 0x00 0x00] # SETTINGS_INITIAL_WINDOW_SIZE(0x03) = 0
[0x00 0x06 0x00 0x00 0x20 0x00] # SETTINGS_MAX_HEADER_LIST_SIZE(0x06) = 8192
write flush

# client connection preface
read "PRI * HTTP/2.0\r\n"
"\r\n"
"SM\r\n"
"\r\n"

read [0x00 0x00 0x0c] # length = 12
[0x04] # HTTP2 SETTINGS frame
[0x00] # flags = 0x00
[0x00 0x00 0x00 0x00] # stream_id = 0
[0x00 0x03 0x00 0x00 0x00 0x64] # SETTINGS_MAX_CONCURRENT_STREAMS(0x03) = 100
[0x00 0x04 0x00 0x00 0xff 0xff] # SETTINGS_INITIAL_WINDOW_SIZE(0x04) = 65535

write [0x00 0x00 0x00] # length = 0
[0x04] # HTTP2 SETTINGS frame
[0x01] # ACK
[0x00 0x00 0x00 0x00] # stream_id = 0
write flush

read [0x00 0x00 0x1a] # length = 26
[0x01] # HEADERS frame
[0x05] # END_HEADERS | END_STREAM
[0x00 0x00 0x00 0x01] # stream_id = 1
[0x82] # :method: GET
[0x86] # :scheme: http
[0x04] [0x06] "/hello" # :path: /hello
[0x01] [0x0e] "localhost:8080" # :authority: localhost:8080

read [0x00 0x00 0x00] # length = 0
[0x04] # HTTP2 SETTINGS frame
[0x01] # ACK
[0x00 0x00 0x00 0x00] # stream_id = 0

write [0x00 0x00 0x23] # length = 35
[0x01] # HTTP2 HEADERS frame
[0x04] # END_HEADERS
[0x00 0x00 0x00 0x01] # stream_id=1
[0x88] # :status: 200
[0x0f 0x10] [0x0a] "text/plain" # content-type
[0x0f 0x0d] [0x01] "7" # content-length
[0x00 0x07] "x-hello" # x-hello: invalid
[0x07] "invalid"
write flush

write [0x00 0x00 0x07] # length = 7
[0x00] # HTTP2 DATA frame
[0x01] # END_STREAM
[0x00 0x00 0x00 0x01] # stream_id=1
"invalid"
write flush
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,18 @@ write [0x00 0x00 0x00] # length = 0
[0x01] # ACK
[0x00 0x00 0x00 0x00] # stream_id = 0

read [0x00 0x00 0x13] # length = 19
read [0x00 0x00 0x2a] # length = 42
[0x01] # HTTP2 HEADERS frame
[0x04] # END_HEADERS
[0x00 0x00 0x00 0x01] # stream_id=1
[0x88] # :status: 200
[0x0f 0x10] [0x0a] "text/plain" # content-type
[0x0f 0x0d] [0x02] "13" # content-length
[0x00 0x07] "x-hello" # x-hello: 1234567890123
[0x0d] "1234567890123"

read [0x00 0x00 0x0d] # length = 13
[0x00] # HTTP2 DATA frame
[0x01] # END_STREAM
[0x00 0x00 0x00 0x01] # stream_id=1
read [0x00 0x00 0x0d] # length = 13
[0x00] # HTTP2 DATA frame
[0x01] # END_STREAM
[0x00 0x00 0x00 0x01] # stream_id=1
"1234567890123"
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,15 @@ read [0x00 0x00 0x00] # length = 0
[0x01] # ACK
[0x00 0x00 0x00 0x00] # stream_id = 0

write [0x00 0x00 0x13] # length = 19
write [0x00 0x00 0x2a] # length = 42
[0x01] # HTTP2 HEADERS frame
[0x04] # END_HEADERS
[0x00 0x00 0x00 0x01] # stream_id=1
[0x88] # :status: 200
[0x0f 0x10] [0x0a] "text/plain" # content-type
[0x0f 0x0d] [0x02] "13" # content-length
[0x00 0x07] "x-hello" # x-hello: 1234567890123
[0x0d] "1234567890123"
write flush

write [0x00 0x00 0x0d] # length = 13
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,17 @@ public void shouldProcessValidRequests() throws Exception

@Test
@Specification({
"${app}/invalid.response/client",
"${app}/invalid.response/server" })
"${app}/invalid.response.header/client",
"${app}/invalid.response.header/server" })
public void shouldSendErrorForInvalidHeaderResponse() throws Exception
{
k3po.finish();
}

@Test
@Specification({
"${app}/invalid.response.content/client",
"${app}/invalid.response.content/server" })
public void shouldAbortForInvalidResponse() throws Exception
{
k3po.finish();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,17 @@ public void shouldRejectInvalidRequests() throws Exception

@Test
@Specification({
"${net}/invalid.response/client",
"${net}/invalid.response/server" })
"${net}/invalid.response.header/client",
"${net}/invalid.response.header/server" })
public void shouldSendErrorForInvalidHeaderResponse() throws Exception
{
k3po.finish();
}

@Test
@Specification({
"${net}/invalid.response.content/client",
"${net}/invalid.response.content/server" })
public void shouldAbortForInvalidResponse() throws Exception
{
k3po.finish();
Expand Down
Loading