mirror of
https://github.com/darlinghq/darling-openjdk.git
synced 2024-11-23 12:29:56 +00:00
8235976: Directives in WWW-Authenticate should be comma separated
Reviewed-by: chegar
This commit is contained in:
parent
49048adcf2
commit
b73faca452
@ -95,10 +95,7 @@ public abstract class BasicAuthenticator extends Authenticator {
|
||||
*/
|
||||
String auth = rmap.getFirst ("Authorization");
|
||||
if (auth == null) {
|
||||
Headers map = t.getResponseHeaders();
|
||||
var authString = "Basic realm=" + "\"" + realm + "\"" +
|
||||
(isUTF8 ? " charset=\"UTF-8\"" : "");
|
||||
map.set ("WWW-Authenticate", authString);
|
||||
setAuthHeader(t);
|
||||
return new Authenticator.Retry (401);
|
||||
}
|
||||
int sp = auth.indexOf (' ');
|
||||
@ -119,13 +116,18 @@ public abstract class BasicAuthenticator extends Authenticator {
|
||||
);
|
||||
} else {
|
||||
/* reject the request again with 401 */
|
||||
|
||||
Headers map = t.getResponseHeaders();
|
||||
map.set ("WWW-Authenticate", "Basic realm=" + "\""+realm+"\"");
|
||||
setAuthHeader(t);
|
||||
return new Authenticator.Failure(401);
|
||||
}
|
||||
}
|
||||
|
||||
private void setAuthHeader(HttpExchange t) {
|
||||
Headers map = t.getResponseHeaders();
|
||||
var authString = "Basic realm=" + "\"" + realm + "\"" +
|
||||
(isUTF8 ? ", charset=\"UTF-8\"" : "");
|
||||
map.set ("WWW-Authenticate", authString);
|
||||
}
|
||||
|
||||
/**
|
||||
* called for each incoming request to verify the
|
||||
* given name and password in the context of this
|
||||
|
@ -32,7 +32,7 @@ import jdk.test.lib.net.URIBuilder;
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @bug 8199849
|
||||
* @bug 8199849 8235976
|
||||
* @summary
|
||||
* @library /test/lib
|
||||
* @run main/othervm ParamTest
|
||||
@ -42,10 +42,10 @@ import jdk.test.lib.net.URIBuilder;
|
||||
public class ParamTest {
|
||||
|
||||
static final String[] variants = {
|
||||
" charset=utf-8",
|
||||
" charset=UtF-8",
|
||||
" charset=\"utF-8\"",
|
||||
" charset=\"UtF-8\""
|
||||
" ,charset=utf-8",
|
||||
" ,charset=UtF-8",
|
||||
" ,charset=\"utF-8\"",
|
||||
" ,charset=\"UtF-8\""
|
||||
};
|
||||
|
||||
static final int LOOPS = variants.length;
|
||||
|
Loading…
Reference in New Issue
Block a user