Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8339470: [11u] More defensive fix for 8163921 #374

Merged
merged 1 commit into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -285,7 +285,8 @@ private static Set<String> schemesListToSet(String list) {
}

static final String httpVersion = "HTTP/1.1";
static final String acceptString = "*/*";
static final String acceptString =
"text/html, image/gif, image/jpeg, */*; q=0.2";

// the following http request headers should NOT have their values
// returned for security reasons.
Expand Down
16 changes: 8 additions & 8 deletions test/jdk/sun/net/www/B8185898.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -23,7 +23,7 @@

/**
* @test
* @bug 8185898 8163921
* @bug 8185898 8163921 8339470
* @modules java.base/sun.net.www
* @library /test/lib
* @run main/othervm B8185898
Expand Down Expand Up @@ -143,32 +143,32 @@ static void testMessageHeaderMethods() throws IOException {
// {{inputString1, expectedToString1, expectedPrint1}, {...}}
String[][] strings = {
{"HTTP/1.1 200 OK\r\n"
+ "Accept: */*\r\n"
+ "Accept: text/html, image/gif, image/jpeg, */*; q=0.2\r\n"
+ "Connection: keep-alive\r\n"
+ "Host: 127.0.0.1:12345\r\n"
+ "User-agent: Java/12\r\n\r\nfoooo",
"pairs: {null: HTTP/1.1 200 OK}"
+ "{Accept: */*}"
+ "{Accept: text/html, image/gif, image/jpeg, */*; q=0.2}"
+ "{Connection: keep-alive}"
+ "{Host: 127.0.0.1:12345}"
+ "{User-agent: Java/12}",
"Accept: */*\r\n"
"Accept: text/html, image/gif, image/jpeg, */*; q=0.2\r\n"
+ "Connection: keep-alive\r\n"
+ "Host: 127.0.0.1:12345\r\n"
+ "User-agent: Java/12\r\n\r\n"},
{"HTTP/1.1 200 OK\r\n"
+ "Accept: */*\r\n"
+ "Accept: text/html, image/gif, image/jpeg, */*; q=0.2\r\n"
+ "Connection: keep-alive\r\n"
+ "Host: 127.0.0.1:12345\r\n"
+ "User-agent: Java/12\r\n"
+ "X-Header:\r\n\r\n",
"pairs: {null: HTTP/1.1 200 OK}"
+ "{Accept: */*}"
+ "{Accept: text/html, image/gif, image/jpeg, */*; q=0.2}"
+ "{Connection: keep-alive}"
+ "{Host: 127.0.0.1:12345}"
+ "{User-agent: Java/12}"
+ "{X-Header: }",
"Accept: */*\r\n"
"Accept: text/html, image/gif, image/jpeg, */*; q=0.2\r\n"
+ "Connection: keep-alive\r\n"
+ "Host: 127.0.0.1:12345\r\n"
+ "User-agent: Java/12\r\n"
Expand Down
Loading