RFR JDK8015799

Chris Hegarty chris.hegarty at oracle.com
Thu Jun 20 02:56:49 PDT 2013


Thanks John,

I just did a quick test with the testcase attached to the bug report ( 
below), and the server is indeed replying with a Set-Cookie header with 
no value ( treated as empty string ) <sigh!>

Since all header retrieval passes through filterHeaderField, in one way 
or another, I'm a little concerned about changing this. Also, as the 
only issue we know of is with Set-Cookie(2), maybe you could add the 
empty string check to these headers only? ( that is to say, move the 
'value.length() == 0' check into the ' if 
(SET_COOKIE.equalsIgnoreCase(name)..... '

----
public class EmptyCookieHeaderStringTest {
     public static void main(String[] args) throws IOException {
         CookieHandler.setDefault(new TestCookieHandler());
         URL url = new URL("http://www.walmart.com/msharbor/");
         HttpURLConnection c = (HttpURLConnection) url.openConnection();
         c.getHeaderFields();
     }
}

class TestCookieHandler extends CookieHandler {
     @Override
     public Map<String, List<String>> get(URI uri, Map<String, 
List<String>> requestHeaders) {
         return new HashMap<String, List<String>>();
     }

     @Override
     public void put(URI uri, Map<String, List<String>> responseHeaders) {
     }
}
-----

-Chris.

On 06/19/2013 04:27 PM, John Zavgren wrote:
> Greetings:
>
> Please review the following changes for a bug that's caused by empty
> cookie header strings. The proposed change detects this condition and
> returns "early".
>
>
> http://cr.openjdk.java.net/~jzavgren/8015799/webrev.01/
> <http://cr.openjdk.java.net/%7Ejzavgren/8015799/webrev.01/>
>
> --
> John Zavgren
> john.zavgren at oracle.com
> 603-821-0904
> US-Burlington-MA
>



More information about the net-dev mailing list