Issue #1546 quotes in cookies
This commit is contained in:
parent
6dd22b95d0
commit
06f721e3c2
|
@ -148,17 +148,16 @@ public class CookieCutter
|
|||
tokenend=i;
|
||||
quoted=false;
|
||||
|
||||
// handle quote as last character specially
|
||||
if (i==last)
|
||||
if (invalue)
|
||||
value = hdr.substring(tokenstart+1, tokenend).replace("\\\"","\"");
|
||||
else
|
||||
{
|
||||
if (invalue)
|
||||
value = hdr.substring(tokenstart, tokenend+1);
|
||||
else
|
||||
{
|
||||
name = hdr.substring(tokenstart, tokenend+1);
|
||||
name = hdr.substring(tokenstart+1, tokenend).replace("\\\"","\"");
|
||||
if (i==last)
|
||||
value = "";
|
||||
}
|
||||
}
|
||||
tokenstart=-1;
|
||||
tokenend=-1;
|
||||
break;
|
||||
|
||||
case '\\':
|
||||
|
@ -272,11 +271,7 @@ public class CookieCutter
|
|||
|
||||
// If after processing the current character we have a value and a name, then it is a cookie
|
||||
if (value!=null && name!=null)
|
||||
{
|
||||
|
||||
name=QuotedCSV.unquote(name);
|
||||
value=QuotedCSV.unquote(value);
|
||||
|
||||
{
|
||||
try
|
||||
{
|
||||
if (name.startsWith("$"))
|
||||
|
|
|
@ -1240,14 +1240,14 @@ public class RequestTest
|
|||
response=_connector.getResponse(
|
||||
"GET / HTTP/1.1\n"+
|
||||
"Host: whatever\n"+
|
||||
"Cookie: name=quoted=\"\\\"value\\\"\"\n" +
|
||||
"Cookie: name=quoted=\"\\\"badly\\\"\"\n" +
|
||||
"Connection: close\n"+
|
||||
"\n"
|
||||
);
|
||||
assertTrue(response.startsWith("HTTP/1.1 200 OK"));
|
||||
assertEquals(1,cookies.size());
|
||||
assertEquals("name", cookies.get(0).getName());
|
||||
assertEquals("quoted=\"value\"", cookies.get(0).getValue());
|
||||
assertEquals("quoted=\"\\\"badly\\\"\"", cookies.get(0).getValue());
|
||||
|
||||
cookies.clear();
|
||||
response=_connector.getResponse(
|
||||
|
|
Loading…
Reference in New Issue