Merged branch 'jetty-9.4.x' into 'master'.
This commit is contained in:
commit
94c9fc548c
|
@ -3,7 +3,7 @@
|
|||
|
||||
<!-- =============================================================== -->
|
||||
<!-- Documentation of this file format can be found at: -->
|
||||
<!-- http://wiki.eclipse.org/Jetty/Reference/jetty.xml_syntax -->
|
||||
<!-- https://www.eclipse.org/jetty/documentation/current/ -->
|
||||
<!-- -->
|
||||
<!-- Additional configuration files are available in $JETTY_HOME/etc -->
|
||||
<!-- and can be mixed in. See start.ini file for the default -->
|
||||
|
|
|
@ -115,11 +115,11 @@ Maximum idle time for a connection.
|
|||
soLinger;;
|
||||
The socket linger time.
|
||||
+
|
||||
You could instead configure the connectors in a standard link:#jetty-xml-config[jetty xml config file] and put its location into the ` jettyXml` parameter.
|
||||
You could instead configure the connectors in a standard link:#jetty-xml-config[jetty xml config file] and put its location into the `jettyXml` parameter.
|
||||
Note that since jetty-9.0 it is no longer possible to configure a link:#maven-config-https[https connector] directly in the pom.xml: you need to link:#maven-config-https[use jetty xml config files to do it].
|
||||
jettyXml::
|
||||
Optional.
|
||||
A comma separated list of locations of `jetty xml` files to apply in addition to any plugin configuration parameters.
|
||||
A comma separated list of locations of Jetty xml files to apply in addition to any plugin configuration parameters.
|
||||
You might use it if you have other webapps, handlers, specific types of connectors etc., to deploy, or if you have other Jetty objects that you cannot configure from the plugin.
|
||||
scanIntervalSeconds::
|
||||
The pause in seconds between sweeps of the webapp to check for changes and automatically hot redeploy if any are detected.
|
||||
|
@ -152,7 +152,7 @@ There are three other ways to configure the RequestLog:
|
|||
See link:#configuring-jetty-request-logs[Configuring Request Logs] for more information.
|
||||
server::
|
||||
Optional as of Jetty 9.3.1.
|
||||
This would configure an instance of the link:{SRCDIR}/jetty-server/src/main/java/org/eclipse/jetty/server/Server.java[`org.eclipse.jetty.server.Server`] for the plugin to use, however it is usually NOT necessary to configure this, as the plugin will automatically configure one for you.
|
||||
This would configure an instance of the link:{GITBROWSEURL}/jetty-server/src/main/java/org/eclipse/jetty/server/Server.java[`org.eclipse.jetty.server.Server`] for the plugin to use, however it is usually NOT necessary to configure this, as the plugin will automatically configure one for you.
|
||||
In particular, if you use the jettyXml element, then you generally DON'T want to define this element, as you are probably using the jettyXml file to configure up a Server with a special constructor argument, such as a custom threadpool.
|
||||
If you define both a server element AND use a jetty xml element which points to a config file that has a line like `<Configure id="Server" class="org.eclipse.jetty.server.Server">` then the the xml configuration will override what you configure for the server in the `pom.xml`.
|
||||
stopPort::
|
||||
|
@ -196,21 +196,29 @@ This example uses files copied directly from the jetty distribution etc/ directo
|
|||
We will use the following files:
|
||||
|
||||
jetty.xml::
|
||||
Sets up various characteristics of the link:{SRCDIR}/jetty-server/src/main/java/org/eclipse/jetty/server/Server.java[`org.eclipse.jetty.server.Server`] instance for the plugin to use.
|
||||
Importantly, it sets up the link:{SRCDIR}/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConfiguration.java[`org.eclipse.jetty.server.HttpConfiguration`] element that we can refer to in subsequent xml files that configure the connectors.
|
||||
Here's the relevant section:
|
||||
Sets up various characteristics of the link:{GITBROWSEURL}/jetty-server/src/main/java/org/eclipse/jetty/server/Server.java[`org.eclipse.jetty.server.Server`] instance for the plugin to use.
|
||||
Importantly, it sets up the link:{GITBROWSEURL}/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConfiguration.java[`org.eclipse.jetty.server.HttpConfiguration`] element that we can refer to in subsequent xml files that configure the connectors.
|
||||
Below is the relevant section taken from link:{GITBROWSEURL}/jetty-server/src/main/config/etc/jetty.xml[jetty.xml].
|
||||
+
|
||||
[source, xml, subs="{sub-order}"]
|
||||
----
|
||||
<Configure id="Server" class="org.eclipse.jetty.server.Server">
|
||||
...
|
||||
<New id="httpConfig" class="org.eclipse.jetty.server.HttpConfiguration">
|
||||
<Set name="secureScheme">https</Set>
|
||||
<Set name="securePort"><Property name="jetty.secure.port" default="8443" /></Set>
|
||||
<Set name="outputBufferSize">32768</Set>
|
||||
<Set name="requestHeaderSize">8192</Set>
|
||||
<Set name="responseHeaderSize">8192</Set>
|
||||
<Set name="sendServerVersion">true</Set>
|
||||
<Set name="sendDateHeader">false</Set>
|
||||
<Set name="headerCacheSize">512</Set>
|
||||
<Set name="secureScheme"><Property name="jetty.httpConfig.secureScheme" default="https" /></Set>
|
||||
<Set name="securePort"><Property name="jetty.httpConfig.securePort" deprecated="jetty.secure.port" default="8443" /></Set>
|
||||
<Set name="outputBufferSize"><Property name="jetty.httpConfig.outputBufferSize" deprecated="jetty.output.buffer.size" default="32768" /></Set>
|
||||
<Set name="outputAggregationSize"><Property name="jetty.httpConfig.outputAggregationSize" deprecated="jetty.output.aggregation.size" default="8192" /></Set>
|
||||
<Set name="requestHeaderSize"><Property name="jetty.httpConfig.requestHeaderSize" deprecated="jetty.request.header.size" default="8192" /></Set>
|
||||
<Set name="responseHeaderSize"><Property name="jetty.httpConfig.responseHeaderSize" deprecated="jetty.response.header.size" default="8192" /></Set>
|
||||
<Set name="sendServerVersion"><Property name="jetty.httpConfig.sendServerVersion" deprecated="jetty.send.server.version" default="true" /></Set>
|
||||
<Set name="sendDateHeader"><Property name="jetty.httpConfig.sendDateHeader" deprecated="jetty.send.date.header" default="false" /></Set>
|
||||
<Set name="headerCacheSize"><Property name="jetty.httpConfig.headerCacheSize" default="512" /></Set>
|
||||
<Set name="delayDispatchUntilContent"><Property name="jetty.httpConfig.delayDispatchUntilContent" deprecated="jetty.delayDispatchUntilContent" default="true"/></Set>
|
||||
<Set name="maxErrorDispatches"><Property name="jetty.httpConfig.maxErrorDispatches" default="10"/></Set>
|
||||
<Set name="blockingTimeout"><Property name="jetty.httpConfig.blockingTimeout" default="-1"/></Set>
|
||||
<Set name="persistentConnectionsEnabled"><Property name="jetty.httpConfig.persistentConnectionsEnabled" default="true"/></Set>
|
||||
<Set name="cookieCompliance"><Call class="org.eclipse.jetty.http.CookieCompliance" name="valueOf"><Arg><Property name="jetty.httpConfig.cookieCompliance" default="RFC6265"/></Arg></Call></Set>
|
||||
|
||||
<!-- Uncomment to enable handling of X-Forwarded- style headers
|
||||
<Call name="addCustomizer">
|
||||
|
@ -218,9 +226,11 @@ Here's the relevant section:
|
|||
</Call>
|
||||
-->
|
||||
</New>
|
||||
...
|
||||
</Configure>
|
||||
----
|
||||
jetty-ssl.xml::
|
||||
Set up ssl which will be used by the https connector.
|
||||
Sets up ssl which will be used by the https connector.
|
||||
Here's the `jetty-ssl.xml` file from the jetty-distribution:
|
||||
+
|
||||
[source, xml, subs="{sub-order}"]
|
||||
|
@ -251,7 +261,7 @@ Now you need to let the plugin know to apply the files above:
|
|||
|
||||
____
|
||||
[CAUTION]
|
||||
Just like with an installed distribution of Jetty, the ordering of the xml files is significant.
|
||||
Just as with an installed distribution of Jetty, the ordering of the xml files is significant.
|
||||
____
|
||||
|
||||
You can also use Jetty xml files to configure a http connector for the plugin to use.
|
||||
|
@ -445,6 +455,7 @@ Here's an example:
|
|||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
...
|
||||
</project>
|
||||
----
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
[[jetty-xml-config]]
|
||||
=== jetty.xml
|
||||
|
||||
`jetty.xml` is the default configuration file for Jetty, typically located at ` $JETTY_HOME/etc/jetty.xml`. Usually the `jetty.xml` configures:
|
||||
`jetty.xml` is the default configuration file for Jetty, typically located at `$JETTY_HOME/etc/jetty.xml`. Usually the `jetty.xml` configures:
|
||||
|
||||
* The Server class (or subclass if extended) and global options.
|
||||
* A ThreadPool (min and max thread).
|
||||
|
|
|
@ -29,7 +29,7 @@ The `webdefault.xml` file is located in `$(jetty.home)/etc/webdefault.xml`.
|
|||
[[using-webdefault-xml]]
|
||||
==== Using webdefault.xml
|
||||
|
||||
You can specify a custom configuration file to use for specific webapps, or for all webapps. If you do not specify an alternate defaults descriptor, the $JETTY-HOME/etc/jetty-deploy.xml file will configure jetty to automatically use $JETTY_HOME/etc/`webdefault.xml`.
|
||||
You can specify a custom configuration file to use for specific webapps, or for all webapps. If you do not specify an alternate defaults descriptor, the `$JETTY-HOME/etc/jetty-deploy.xml` file will configure jetty to automatically use `$JETTY_HOME/etc/webdefault.xml`.
|
||||
|
||||
____
|
||||
[NOTE]
|
||||
|
@ -73,9 +73,9 @@ import org.eclipse.jetty.webapp.WebAppContext;
|
|||
Alternatively, you can use a xref:jetty-classloading[] to find the resource representing your custom `webdefault.xml`.
|
||||
|
||||
[[creating-custom-webdefault-xml-multiple-webapps]]
|
||||
===== Creating a Custom `webdefault.xml` for Multiple WebApps
|
||||
===== Creating a Custom webdefault.xml for Multiple WebApps
|
||||
|
||||
If you want to apply the same custom `webdefault.xml` to a number of webapps, provide the path to the file in xref:jetty-xml-config[] in the $JETTY_HOME/etc/jetty-deploy.xml file:
|
||||
If you want to apply the same custom `webdefault.xml` to a number of webapps, provide the path to the file in xref:jetty-xml-config[] in the `$JETTY_HOME/etc/jetty-deploy.xml` file:
|
||||
|
||||
[source, xml, subs="{sub-order}"]
|
||||
----
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<!-- Configure the Jetty Server -->
|
||||
<!-- -->
|
||||
<!-- Documentation of this file format can be found at: -->
|
||||
<!-- http://wiki.eclipse.org/Jetty/Reference/jetty.xml_syntax -->
|
||||
<!-- https://www.eclipse.org/jetty/documentation/current/ -->
|
||||
<!-- =============================================================== -->
|
||||
|
||||
<Configure id="Server" class="org.eclipse.jetty.server.Server">
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<!-- Configure the Jetty Server -->
|
||||
<!-- -->
|
||||
<!-- Documentation of this file format can be found at: -->
|
||||
<!-- http://wiki.eclipse.org/Jetty/Reference/jetty.xml_syntax -->
|
||||
<!-- https://www.eclipse.org/jetty/documentation/current/ -->
|
||||
<!-- =============================================================== -->
|
||||
|
||||
<Configure id="Server" class="org.eclipse.jetty.server.Server">
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
<!-- =============================================================== -->
|
||||
<!-- Documentation of this file format can be found at: -->
|
||||
<!-- http://wiki.eclipse.org/Jetty/Reference/jetty.xml_syntax -->
|
||||
<!-- https://www.eclipse.org/jetty/documentation/current/ -->
|
||||
<!-- -->
|
||||
<!-- Additional configuration files are available in $JETTY_HOME/etc -->
|
||||
<!-- and can be mixed in. See start.ini file for the default -->
|
||||
|
|
|
@ -23,6 +23,7 @@ import java.util.Locale;
|
|||
|
||||
import javax.servlet.http.Cookie;
|
||||
|
||||
import org.eclipse.jetty.http.CookieCompliance;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.Logger;
|
||||
|
||||
|
@ -40,6 +41,7 @@ public class CookieCutter
|
|||
{
|
||||
private static final Logger LOG = Log.getLogger(CookieCutter.class);
|
||||
|
||||
private final CookieCompliance _compliance;
|
||||
private Cookie[] _cookies;
|
||||
private Cookie[] _lastCookies;
|
||||
private final List<String> _fieldList = new ArrayList<>();
|
||||
|
@ -47,6 +49,12 @@ public class CookieCutter
|
|||
|
||||
public CookieCutter()
|
||||
{
|
||||
this(CookieCompliance.RFC6265);
|
||||
}
|
||||
|
||||
public CookieCutter(CookieCompliance compliance)
|
||||
{
|
||||
_compliance = compliance;
|
||||
}
|
||||
|
||||
public Cookie[] getCookies()
|
||||
|
@ -335,7 +343,11 @@ public class CookieCutter
|
|||
if (name.startsWith("$"))
|
||||
{
|
||||
String lowercaseName = name.toLowerCase(Locale.ENGLISH);
|
||||
if ("$path".equals(lowercaseName))
|
||||
if (_compliance==CookieCompliance.RFC6265)
|
||||
{
|
||||
// Ignore
|
||||
}
|
||||
else if ("$path".equals(lowercaseName))
|
||||
{
|
||||
if (cookie!=null)
|
||||
cookie.setPath(value);
|
||||
|
@ -354,13 +366,6 @@ public class CookieCutter
|
|||
{
|
||||
version = Integer.parseInt(value);
|
||||
}
|
||||
else
|
||||
{
|
||||
cookie = new Cookie(name, value);
|
||||
if (version > 0)
|
||||
cookie.setVersion(version);
|
||||
cookies.add(cookie);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -751,7 +751,7 @@ public class Request implements HttpServletRequest
|
|||
for (String c : metadata.getFields().getValuesList(HttpHeader.COOKIE))
|
||||
{
|
||||
if (_cookies == null)
|
||||
_cookies = new CookieCutter();
|
||||
_cookies = new CookieCutter(getHttpChannel().getHttpConfiguration().getCookieCompliance());
|
||||
_cookies.addCookieField(c);
|
||||
}
|
||||
|
||||
|
@ -2027,7 +2027,7 @@ public class Request implements HttpServletRequest
|
|||
public void setCookies(Cookie[] cookies)
|
||||
{
|
||||
if (_cookies == null)
|
||||
_cookies = new CookieCutter();
|
||||
_cookies = new CookieCutter(getHttpChannel().getHttpConfiguration().getCookieCompliance());
|
||||
_cookies.setCookies(cookies);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,14 +23,15 @@ import static org.junit.Assert.assertThat;
|
|||
|
||||
import javax.servlet.http.Cookie;
|
||||
|
||||
import org.eclipse.jetty.http.CookieCompliance;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
public class CookieCutterTest
|
||||
{
|
||||
private Cookie[] parseCookieHeaders(String... headers)
|
||||
private Cookie[] parseCookieHeaders(CookieCompliance compliance,String... headers)
|
||||
{
|
||||
CookieCutter cutter = new CookieCutter();
|
||||
CookieCutter cutter = new CookieCutter(compliance);
|
||||
for (String header : headers)
|
||||
{
|
||||
cutter.addCookieField(header);
|
||||
|
@ -58,7 +59,7 @@ public class CookieCutterTest
|
|||
{
|
||||
String rawCookie = "$Version=\"1\"; Customer=\"WILE_E_COYOTE\"; $Path=\"/acme\"";
|
||||
|
||||
Cookie cookies[] = parseCookieHeaders(rawCookie);
|
||||
Cookie cookies[] = parseCookieHeaders(CookieCompliance.RFC2965,rawCookie);
|
||||
|
||||
assertThat("Cookies.length", cookies.length, is(1));
|
||||
assertCookie("Cookies[0]", cookies[0], "Customer", "WILE_E_COYOTE", 1, "/acme");
|
||||
|
@ -74,7 +75,7 @@ public class CookieCutterTest
|
|||
"Customer=\"WILE_E_COYOTE\"; $Path=\"/acme\"; " +
|
||||
"Part_Number=\"Rocket_Launcher_0001\"; $Path=\"/acme\"";
|
||||
|
||||
Cookie cookies[] = parseCookieHeaders(rawCookie);
|
||||
Cookie cookies[] = parseCookieHeaders(CookieCompliance.RFC2965,rawCookie);
|
||||
|
||||
assertThat("Cookies.length", cookies.length, is(2));
|
||||
assertCookie("Cookies[0]", cookies[0], "Customer", "WILE_E_COYOTE", 1, "/acme");
|
||||
|
@ -92,7 +93,7 @@ public class CookieCutterTest
|
|||
"Part_Number=\"Rocket_Launcher_0001\"; $Path=\"/acme\"; " +
|
||||
"Shipping=\"FedEx\"; $Path=\"/acme\"";
|
||||
|
||||
Cookie cookies[] = parseCookieHeaders(rawCookie);
|
||||
Cookie cookies[] = parseCookieHeaders(CookieCompliance.RFC2965,rawCookie);
|
||||
|
||||
assertThat("Cookies.length", cookies.length, is(3));
|
||||
assertCookie("Cookies[0]", cookies[0], "Customer", "WILE_E_COYOTE", 1, "/acme");
|
||||
|
@ -110,7 +111,7 @@ public class CookieCutterTest
|
|||
"Part_Number=\"Riding_Rocket_0023\"; $Path=\"/acme/ammo\"; " +
|
||||
"Part_Number=\"Rocket_Launcher_0001\"; $Path=\"/acme\"";
|
||||
|
||||
Cookie cookies[] = parseCookieHeaders(rawCookie);
|
||||
Cookie cookies[] = parseCookieHeaders(CookieCompliance.RFC2965,rawCookie);
|
||||
|
||||
assertThat("Cookies.length", cookies.length, is(2));
|
||||
assertCookie("Cookies[0]", cookies[0], "Part_Number", "Riding_Rocket_0023", 1, "/acme/ammo");
|
||||
|
@ -127,7 +128,7 @@ public class CookieCutterTest
|
|||
"session_id=\"1234\"; " +
|
||||
"session_id=\"1111\"; $Domain=\".cracker.edu\"";
|
||||
|
||||
Cookie cookies[] = parseCookieHeaders(rawCookie);
|
||||
Cookie cookies[] = parseCookieHeaders(CookieCompliance.RFC2965,rawCookie);
|
||||
|
||||
assertThat("Cookies.length", cookies.length, is(2));
|
||||
assertCookie("Cookies[0]", cookies[0], "session_id", "1234", 1, null);
|
||||
|
@ -144,7 +145,7 @@ public class CookieCutterTest
|
|||
String rawCookie = "$Version=\"1\"; session_id=\"1234\", " +
|
||||
"$Version=\"1\"; session_id=\"1111\"; $Domain=\".cracker.edu\"";
|
||||
|
||||
Cookie cookies[] = parseCookieHeaders(rawCookie);
|
||||
Cookie cookies[] = parseCookieHeaders(CookieCompliance.RFC6265,rawCookie);
|
||||
|
||||
assertThat("Cookies.length", cookies.length, is(2));
|
||||
assertCookie("Cookies[0]", cookies[0], "session_id", "1234", 1, null);
|
||||
|
@ -159,7 +160,7 @@ public class CookieCutterTest
|
|||
{
|
||||
String rawCookie = "SID=31d4d96e407aad42";
|
||||
|
||||
Cookie cookies[] = parseCookieHeaders(rawCookie);
|
||||
Cookie cookies[] = parseCookieHeaders(CookieCompliance.RFC6265,rawCookie);
|
||||
|
||||
assertThat("Cookies.length", cookies.length, is(1));
|
||||
assertCookie("Cookies[0]", cookies[0], "SID", "31d4d96e407aad42", 0, null);
|
||||
|
@ -173,7 +174,7 @@ public class CookieCutterTest
|
|||
{
|
||||
String rawCookie = "SID=31d4d96e407aad42; lang=en-US";
|
||||
|
||||
Cookie cookies[] = parseCookieHeaders(rawCookie);
|
||||
Cookie cookies[] = parseCookieHeaders(CookieCompliance.RFC6265,rawCookie);
|
||||
|
||||
assertThat("Cookies.length", cookies.length, is(2));
|
||||
assertCookie("Cookies[0]", cookies[0], "SID", "31d4d96e407aad42", 0, null);
|
||||
|
@ -188,9 +189,22 @@ public class CookieCutterTest
|
|||
{
|
||||
String rawCookie = "key=value";
|
||||
|
||||
Cookie cookies[] = parseCookieHeaders(rawCookie);
|
||||
Cookie cookies[] = parseCookieHeaders(CookieCompliance.RFC6265,rawCookie);
|
||||
|
||||
assertThat("Cookies.length", cookies.length, is(1));
|
||||
assertCookie("Cookies[0]", cookies[0], "key", "value", 0, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Basic name=value, following RFC6265 rules
|
||||
*/
|
||||
@Test
|
||||
public void testDollarName()
|
||||
{
|
||||
String rawCookie = "$key=value";
|
||||
|
||||
Cookie cookies[] = parseCookieHeaders(CookieCompliance.RFC6265,rawCookie);
|
||||
|
||||
assertThat("Cookies.length", cookies.length, is(0));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,6 +58,7 @@ import javax.servlet.http.HttpServletResponse;
|
|||
import javax.servlet.http.Part;
|
||||
|
||||
import org.eclipse.jetty.http.BadMessageException;
|
||||
import org.eclipse.jetty.http.CookieCompliance;
|
||||
import org.eclipse.jetty.http.HttpTester;
|
||||
import org.eclipse.jetty.http.MimeTypes;
|
||||
import org.eclipse.jetty.server.LocalConnector.LocalEndPoint;
|
||||
|
@ -1319,39 +1320,6 @@ public class RequestTest
|
|||
assertNotSame(cookies.get(0), cookies.get(2));
|
||||
assertNotSame(cookies.get(1), cookies.get(3));
|
||||
|
||||
cookies.clear();
|
||||
//NOTE: the javax.servlet.http.Cookie class sets the system property org.glassfish.web.rfc2109_cookie_names_enforced
|
||||
//to TRUE by default, and rejects all cookie names containing punctuation.Therefore this test cannot use "name2".
|
||||
response=_connector.getResponse(
|
||||
"POST / HTTP/1.1\r\n"+
|
||||
"Host: whatever\r\n"+
|
||||
"Cookie: name0=value0; name1 = value1 ; name2 = \"\\\"value2\\\"\" \n" +
|
||||
"Cookie: $Version=2; name3=value3=value3;$path=/path;$domain=acme.com;$port=8080; name4=\"\"; name5 = ; name6\n" +
|
||||
"Cookie: name7=value7;\n" +
|
||||
"Connection: close\r\n"+
|
||||
"\r\n");
|
||||
|
||||
assertEquals("name0", cookies.get(0).getName());
|
||||
assertEquals("value0", cookies.get(0).getValue());
|
||||
assertEquals("name1", cookies.get(1).getName());
|
||||
assertEquals("value1", cookies.get(1).getValue());
|
||||
assertEquals("name2", cookies.get(2).getName());
|
||||
assertEquals("\"value2\"", cookies.get(2).getValue());
|
||||
assertEquals("name3", cookies.get(3).getName());
|
||||
assertEquals("value3=value3", cookies.get(3).getValue());
|
||||
assertEquals(2, cookies.get(3).getVersion());
|
||||
assertEquals("/path", cookies.get(3).getPath());
|
||||
assertEquals("acme.com", cookies.get(3).getDomain());
|
||||
assertEquals("$port=8080", cookies.get(3).getComment());
|
||||
assertEquals("name4", cookies.get(4).getName());
|
||||
assertEquals("", cookies.get(4).getValue());
|
||||
assertEquals("name5", cookies.get(5).getName());
|
||||
assertEquals("", cookies.get(5).getValue());
|
||||
// assertEquals("name6", cookies.get(6).getName());
|
||||
// assertEquals("", cookies.get(6).getValue());
|
||||
assertEquals("name7", cookies.get(6).getName());
|
||||
assertEquals("value7", cookies.get(6).getValue());
|
||||
|
||||
cookies.clear();
|
||||
response=_connector.getResponse(
|
||||
"GET /other HTTP/1.1\n"+
|
||||
|
|
|
@ -96,10 +96,15 @@ public abstract class Credential implements Serializable
|
|||
{
|
||||
if (s1 == s2)
|
||||
return true;
|
||||
if (s1 == null || s2 == null || s1.length() != s2.length())
|
||||
if (s1 == null || s2 == null)
|
||||
return false;
|
||||
boolean result = true;
|
||||
for (int i = 0; i < s1.length(); i++)
|
||||
int l1 = s1.length();
|
||||
int l2 = s2.length();
|
||||
if (l1 != l2)
|
||||
result = false;
|
||||
int l = Math.min(l1, l2);
|
||||
for (int i = 0; i < l; ++i)
|
||||
result &= s1.charAt(i) == s2.charAt(i);
|
||||
return result;
|
||||
}
|
||||
|
@ -115,10 +120,15 @@ public abstract class Credential implements Serializable
|
|||
{
|
||||
if (b1 == b2)
|
||||
return true;
|
||||
if (b1 == null || b2 == null || b1.length != b2.length)
|
||||
if (b1 == null || b2 == null)
|
||||
return false;
|
||||
boolean result = true;
|
||||
for (int i = 0; i < b1.length; i++)
|
||||
int l1 = b1.length;
|
||||
int l2 = b2.length;
|
||||
if (l1 != l2)
|
||||
result = false;
|
||||
int l = Math.min(l1, l2);
|
||||
for (int i = 0; i < l; ++i)
|
||||
result &= b1[i] == b2[i];
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue