File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -192,8 +192,9 @@ pub fn sanitize_cookie_value(v string) string {
192192 if v.len == 0 {
193193 return v
194194 }
195- // Check for the existence of a space or comma
196- if val.starts_with (' ' ) || val.ends_with (' ' ) || val.starts_with (',' ) || val.ends_with (',' ) {
195+ // Check for the existence of a space, comma or semicolon
196+ if val.starts_with (' ' ) || v.contains (';' ) || val.ends_with (' ' ) || val.starts_with (',' )
197+ || val.ends_with (',' ) {
197198 return '"${v} "'
198199 }
199200 return v
Original file line number Diff line number Diff line change @@ -224,6 +224,13 @@ const write_set_cookie_tests = [
224224 }
225225 raw: ''
226226 },
227+ SetCookieTestCase{
228+ cookie: & http.Cookie{
229+ name: 'complex-value'
230+ value: 'a b,c;d'
231+ }
232+ raw: 'complex-value="a b,c;d"'
233+ },
227234]
228235const add_cookies_tests = [
229236 AddCookieTestCase{
You can’t perform that action at this time.
0 commit comments