@@ -89,7 +89,7 @@ def test_invalid_content_length_header
89
89
HTTP
90
90
req = WEBrick ::HTTPRequest . new ( WEBrick ::Config ::HTTP )
91
91
assert_raise ( WEBrick ::HTTPStatus ::BadRequest ) {
92
- req . parse ( StringIO . new ( msg . gsub ( /^ {8}/ , "" ) . gsub ( " \n " , " \r \n " ) ) )
92
+ req . parse ( StringIO . new ( msg ) )
93
93
}
94
94
end
95
95
end
@@ -102,7 +102,7 @@ def test_bare_lf_request_line
102
102
HTTP
103
103
req = WEBrick ::HTTPRequest . new ( WEBrick ::Config ::HTTP )
104
104
assert_raise ( WEBrick ::HTTPStatus ::BadRequest ) {
105
- req . parse ( StringIO . new ( msg . gsub ( /^ {6}/ , "" ) ) )
105
+ req . parse ( StringIO . new ( msg ) )
106
106
}
107
107
end
108
108
@@ -114,7 +114,7 @@ def test_bare_lf_header
114
114
HTTP
115
115
req = WEBrick ::HTTPRequest . new ( WEBrick ::Config ::HTTP )
116
116
assert_raise ( WEBrick ::HTTPStatus ::BadRequest ) {
117
- req . parse ( StringIO . new ( msg . gsub ( /^ {6}/ , "" ) ) )
117
+ req . parse ( StringIO . new ( msg ) )
118
118
}
119
119
end
120
120
@@ -125,7 +125,7 @@ def test_header_vt_ff_whitespace
125
125
\r
126
126
HTTP
127
127
req = WEBrick ::HTTPRequest . new ( WEBrick ::Config ::HTTP )
128
- req . parse ( StringIO . new ( msg . gsub ( /^ {6}/ , "" ) ) )
128
+ req . parse ( StringIO . new ( msg ) )
129
129
assert_equal ( "\x0b 1\x0c " , req [ "Foo" ] )
130
130
131
131
msg = <<~HTTP
@@ -135,7 +135,7 @@ def test_header_vt_ff_whitespace
135
135
\r
136
136
HTTP
137
137
req = WEBrick ::HTTPRequest . new ( WEBrick ::Config ::HTTP )
138
- req . parse ( StringIO . new ( msg . gsub ( /^ {6}/ , "" ) ) )
138
+ req . parse ( StringIO . new ( msg ) )
139
139
assert_equal ( "\x0b 1\x0c \x0b 2\x0c " , req [ "Foo" ] )
140
140
end
141
141
@@ -147,7 +147,7 @@ def test_bare_cr_request_line
147
147
HTTP
148
148
req = WEBrick ::HTTPRequest . new ( WEBrick ::Config ::HTTP )
149
149
assert_raise ( WEBrick ::HTTPStatus ::BadRequest ) {
150
- req . parse ( StringIO . new ( msg . gsub ( /^ {6}/ , "" ) ) )
150
+ req . parse ( StringIO . new ( msg ) )
151
151
}
152
152
end
153
153
@@ -159,7 +159,7 @@ def test_bare_cr_header
159
159
HTTP
160
160
req = WEBrick ::HTTPRequest . new ( WEBrick ::Config ::HTTP )
161
161
assert_raise ( WEBrick ::HTTPStatus ::BadRequest ) {
162
- req . parse ( StringIO . new ( msg . gsub ( /^ {6}/ , "" ) ) )
162
+ req . parse ( StringIO . new ( msg ) )
163
163
}
164
164
end
165
165
@@ -171,7 +171,7 @@ def test_invalid_request_lines
171
171
HTTP
172
172
req = WEBrick ::HTTPRequest . new ( WEBrick ::Config ::HTTP )
173
173
assert_raise ( WEBrick ::HTTPStatus ::BadRequest ) {
174
- req . parse ( StringIO . new ( msg . gsub ( /^ {6}/ , "" ) ) )
174
+ req . parse ( StringIO . new ( msg ) )
175
175
}
176
176
177
177
msg = <<~HTTP . gsub ( "\n " , "\r \n " )
@@ -181,7 +181,7 @@ def test_invalid_request_lines
181
181
HTTP
182
182
req = WEBrick ::HTTPRequest . new ( WEBrick ::Config ::HTTP )
183
183
assert_raise ( WEBrick ::HTTPStatus ::BadRequest ) {
184
- req . parse ( StringIO . new ( msg . gsub ( /^ {6}/ , "" ) ) )
184
+ req . parse ( StringIO . new ( msg ) )
185
185
}
186
186
187
187
msg = <<~HTTP . gsub ( "\n " , "\r \n " )
@@ -191,7 +191,7 @@ def test_invalid_request_lines
191
191
HTTP
192
192
req = WEBrick ::HTTPRequest . new ( WEBrick ::Config ::HTTP )
193
193
assert_raise ( WEBrick ::HTTPStatus ::BadRequest ) {
194
- req . parse ( StringIO . new ( msg . gsub ( /^ {6}/ , "" ) ) )
194
+ req . parse ( StringIO . new ( msg ) )
195
195
}
196
196
197
197
msg = <<~HTTP . gsub ( "\n " , "\r \n " )
@@ -201,7 +201,7 @@ def test_invalid_request_lines
201
201
HTTP
202
202
req = WEBrick ::HTTPRequest . new ( WEBrick ::Config ::HTTP )
203
203
assert_raise ( WEBrick ::HTTPStatus ::BadRequest ) {
204
- req . parse ( StringIO . new ( msg . gsub ( /^ {6}/ , "" ) ) )
204
+ req . parse ( StringIO . new ( msg ) )
205
205
}
206
206
end
207
207
@@ -427,7 +427,6 @@ def test_null_byte_in_header
427
427
Evil: evil\x00 \r
428
428
\r
429
429
HTTP
430
- msg . gsub! ( /^ {6}/ , "" )
431
430
req = WEBrick ::HTTPRequest . new ( WEBrick ::Config ::HTTP )
432
431
assert_raise ( WEBrick ::HTTPStatus ::BadRequest ) { req . parse ( StringIO . new ( msg ) ) }
433
432
end
0 commit comments