Skip to content

Commit

Permalink
c-hyper: ignore case of hex numbers in tests
Browse files Browse the repository at this point in the history
When hyper is used, it emits uppercase hexadecimal numbers for chunked
encoding lengths. Without hyper, lowercase hexadecimal numbers are used.
This change adds splitpart commands to tests where this is an issue, and
normalizes the lengths to lower-case digits.
  • Loading branch information
divergentdave committed May 1, 2021
1 parent 8228002 commit 0b58b5e
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 15 deletions.
4 changes: 4 additions & 0 deletions tests/data/test1073
Expand Up @@ -49,6 +49,10 @@ which is impossible in HTTP/1.0
<errorcode>
25
</errorcode>
# Normalize the case of the chunk encoding length.
<strippart>
s/^7A\r$/7a\r/
</strippart>
<protocol>
PUT /%TESTNUMBER HTTP/1.1
Host: %HOSTIP:%HTTPPORT
Expand Down
4 changes: 4 additions & 0 deletions tests/data/test1591
Expand Up @@ -40,6 +40,10 @@ more than one byte

# Verify data after the test has been "shot"
<verify>
# Normalize the case of the chunk encoding length.
<strippart>
s/^E\r$/e\r/
</strippart>
<protocol>
PUT /bzz/%TESTNUMBER HTTP/1.1
Host: %HOSTIP:%HTTPPORT
Expand Down
4 changes: 4 additions & 0 deletions tests/data/test218
Expand Up @@ -39,6 +39,10 @@ just some tiny teeny contents
#
# Verify data after the test has been "shot"
<verify>
# Normalize the case of the chunk encoding length.
<strippart>
s/^1E\r$/1e\r/
</strippart>
<protocol>
PUT /%TESTNUMBER HTTP/1.1
Host: %HOSTIP:%HTTPPORT
Expand Down
4 changes: 4 additions & 0 deletions tests/data/test510
Expand Up @@ -42,6 +42,10 @@ http://%HOSTIP:%HTTPPORT/%TESTNUMBER
#
# Verify data after the test has been "shot"
<verify>
# Normalize the case of the chunk encoding length.
<strippart>
s/^1D\r$/1d\r/
</strippart>
<protocol>
POST /%TESTNUMBER HTTP/1.1
Host: %HOSTIP:%HTTPPORT
Expand Down
8 changes: 5 additions & 3 deletions tests/data/test645
Expand Up @@ -61,10 +61,12 @@ http://%HOSTIP:%HTTPPORT/%TESTNUMBER
<strippart>
s/^--------------------------[a-z0-9]*/------------------------------/
s/boundary=------------------------[a-z0-9]*/boundary=----------------------------/
s/^19A\r$/19a\r/
</strippart>
# Note that the stripping above removes 12 bytes from every occurrence of the
# boundary string and since 5 of them are in the body contents, we see
# (5*12) == 60 bytes less
# Note that the first two stripping rules remove 12 bytes from every occurrence
# of the boundary string and since 5 of them are in the body contents, we see
# (5*12) == 60 bytes less.
# The third stripping rule normalizes the case of the chunk encoding length.
<protocol>
POST /%TESTNUMBER HTTP/1.1
Host: %HOSTIP:%HTTPPORT
Expand Down
11 changes: 8 additions & 3 deletions tests/data/test650
Expand Up @@ -51,10 +51,15 @@ This is data from a file.
<strippart>
s/^--------------------------[a-z0-9]*/------------------------------/
s/boundary=------------------------[a-z0-9]*/boundary=----------------------------/
s/^A5\r$/a5\r/
s/^AF\r$/af\r/
s/^10F\r$/10f\r/
</strippart>
# Note that the stripping above removes 12 bytes from every occurrence of the
# boundary string and since 5 of them are in the body contents, we see
# (5*12) == 60 bytes less
# Note that the first two stripping rules remove 12 bytes from every occurrence
# of the boundary string and since 5 of them are in the body contents, we see
# (5*12) == 60 bytes less.
# The last three stripping rules normalize the case of the chunk encoding
# length.
<protocol>
POST /%TESTNUMBER HTTP/1.1
Host: %HOSTIP:%HTTPPORT
Expand Down
8 changes: 5 additions & 3 deletions tests/data/test654
Expand Up @@ -64,10 +64,12 @@ This is data from a file
<strippart>
s/^--------------------------[a-z0-9]*/------------------------------/
s/boundary=------------------------[a-z0-9]*/boundary=----------------------------/
s/^1AF\r$/1af\r/
</strippart>
# Note that the stripping above removes 12 bytes from every occurrence of the
# boundary string and since 5 of them are in the body contents, we see
# (5*12) == 60 bytes less
# Note that the first two stripping rules remove 12 bytes from every occurrence
# of the boundary string and since 5 of them are in the body contents, we see
# (5*12) == 60 bytes less.
# The third stripping rule normalizes the case of the chunk encoding length.
<protocol>
POST /%TESTNUMBER HTTP/1.1
Host: %HOSTIP:%HTTPPORT
Expand Down
8 changes: 5 additions & 3 deletions tests/data/test667
Expand Up @@ -54,10 +54,12 @@ http://%HOSTIP:%HTTPPORT/%TESTNUMBER
<strippart>
s/^--------------------------[a-z0-9]*/------------------------------/
s/boundary=------------------------[a-z0-9]*/boundary=----------------------------/
s/^7F\r$/7f\r/
</strippart>
# Note that the stripping above removes 12 bytes from every occurrence of the
# boundary string and since 5 of them are in the body contents, we see
# (5*12) == 60 bytes less
# Note that the first two stripping rules remove 12 bytes from every occurrence
# of the boundary string and since 5 of them are in the body contents, we see
# (5*12) == 60 bytes less.
# The last stripping rule normalizes the case of the chunk encoding length.
<protocol>
POST /%TESTNUMBER HTTP/1.1
Host: %HOSTIP:%HTTPPORT
Expand Down
8 changes: 5 additions & 3 deletions tests/data/test668
Expand Up @@ -57,10 +57,12 @@ This is data from a file
<strippart>
s/^--------------------------[a-z0-9]*/------------------------------/
s/boundary=------------------------[a-z0-9]*/boundary=----------------------------/
s/^C1\r$/c1\r/
</strippart>
# Note that the stripping above removes 12 bytes from every occurrence of the
# boundary string and since 5 of them are in the body contents, we see
# (5*12) == 60 bytes less
# Note that the first two stripping rules remove 12 bytes from every occurrence
# of the boundary string and since 5 of them are in the body contents, we see
# (5*12) == 60 bytes less.
# The last stripping rule normalizes the case of the chunk encoding length.
<protocol>
POST /%TESTNUMBER HTTP/1.1
Host: %HOSTIP:%HTTPPORT
Expand Down

0 comments on commit 0b58b5e

Please sign in to comment.