[HtmlUnit] SVN: [15486] trunk/htmlunit/src

rbri--- via HtmlUnit-develop <[email protected]> Wed, 18 Jul 2018 07:39:46 +0000
Newsgroups gmane.comp.java.htmlunit.devel
Message-ID <[email protected]>
Revision: 15486
          http://sourceforge.net/p/htmlunit/code/15486
Author:   rbri
Date:     2018-07-18 07:39:43 +0000 (Wed, 18 Jul 2018)
Log Message:
-----------
debug at the server

Modified Paths:
--------------
    trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/HttpWebConnection.java
    trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java
    trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/PrimitiveWebServer.java
    trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebClient7Test.java

Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/HttpWebConnection.java
===================================================================
--- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/HttpWebConnection.java	2018-07-18 07:32:41 UTC (rev 15485)
+++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/HttpWebConnection.java	2018-07-18 07:39:43 UTC (rev 15486)
@@ -189,9 +189,7 @@
 
             HttpResponse httpResponse = null;
             try {
-System.out.println("#");
                 httpResponse = builder.build().execute(hostConfiguration, httpMethod, httpContext);
-System.out.println("# done");
             }
             catch (final SSLPeerUnverifiedException s) {
                 // Try to use only SSLv3 instead
@@ -204,7 +202,6 @@
                 }
             }
             catch (final Error e) {
-System.out.println("##" + e);
                 // in case a StackOverflowError occurs while the connection is leased, it won't get released.
                 // Calling code may catch the StackOverflowError, but due to the leak, the httpClient_ may
                 // come out of connections and throw a ConnectionPoolTimeoutException.
@@ -212,10 +209,6 @@
                 httpClientBuilder_.remove(Thread.currentThread());
                 throw e;
             }
-            catch (final Throwable e) {
-System.out.println("###" + e);
-                throw e;
-            }
 
             final DownloadedContent downloadedBody = downloadResponseBody(httpResponse);
             final long endTime = System.currentTimeMillis();
@@ -389,7 +382,6 @@
         httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
         httpContext.removeAttribute(HttpClientContext.CREDS_PROVIDER);
         httpContext.removeAttribute(HttpClientContext.TARGET_AUTH_STATE);
-System.out.println("conn: " + httpMethod.getURI());
         return httpMethod;
     }
 

Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java
===================================================================
--- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java	2018-07-18 07:32:41 UTC (rev 15485)
+++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java	2018-07-18 07:39:43 UTC (rev 15486)
@@ -1344,7 +1344,6 @@
         url = UrlUtils.encodeUrl(url, getBrowserVersion().hasFeature(URL_MINIMAL_QUERY_ENCODING),
                                         webRequest.getCharset());
         webRequest.setUrl(url);
-System.out.println("client: " + url);
 
         if (LOG.isDebugEnabled()) {
             LOG.debug("Load response for " + method + " " + url.toExternalForm());

Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/PrimitiveWebServer.java
===================================================================
--- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/PrimitiveWebServer.java	2018-07-18 07:32:41 UTC (rev 15485)
+++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/PrimitiveWebServer.java	2018-07-18 07:39:43 UTC (rev 15486)
@@ -25,7 +25,6 @@
 import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Locale;
 
 /**
  * A very simple implementation of a Web Server.
@@ -71,9 +70,6 @@
      * @throws IOException if an error occurs
      */
     public void start() throws IOException {
-System.out.println("start ");
-System.out.println(Locale.getDefault());
-System.out.println(System.getProperty("java.version"));
         server_ = new ServerSocket(port_);
         new Thread(new Runnable() {
 
@@ -97,7 +93,6 @@
                                 break;
                             }
                         }
-System.out.println("req: " + requestString);
 
                         final String response;
                         if (requestString.contains("/favicon.ico")) {
@@ -114,7 +109,6 @@
                                     response = otherResponse_;
                                 }
                                 first = false;
-System.out.println("resp: " + response);
                                 out.write(response.getBytes(charset_));
                             }
                         }

Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebClient7Test.java
===================================================================
--- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebClient7Test.java	2018-07-18 07:32:41 UTC (rev 15485)
+++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebClient7Test.java	2018-07-18 07:39:43 UTC (rev 15486)
@@ -51,111 +51,112 @@
         shutDownAll();
     }
 
-//    /**
-//     * Test that the path and query string are encoded to be valid.
-//     * @throws Exception if something goes wrong
-//     */
-//    @Test
-//    @Alerts(DEFAULT = "/test.html?a=b%20c&d=%C3%A9%C3%A8",
-//            IE = "/test.html?a=b%20c&d=\u00E9\u00E8")
-//    @NotYetImplemented(IE)
-//    public void loadPage_EncodeRequest() throws Exception {
-//        // with query string not encoded
-//        testRequestUrlEncoding("test.html?a=b c&d=\u00E9\u00E8");
-//    }
-//
-//    /**
-//     * Test that the path and query string are encoded to be valid.
-//     * @throws Exception if something goes wrong
-//     */
-//    @Test
-//    @Alerts("/test.html?a=b%20c&d=%C3%A9%C3%A8")
-//    public void loadPage_EncodeRequest2() throws Exception {
-//        // with query string already encoded
-//        testRequestUrlEncoding("test.html?a=b%20c&d=%C3%A9%C3%A8");
-//    }
-//
-//    /**
-//     * Test that the path and query string are encoded to be valid.
-//     * @throws Exception if something goes wrong
-//     */
-//    @Test
-//    @Alerts("/test.html?a=b%20c&d=e%20f")
-//    public void loadPage_EncodeRequest3() throws Exception {
-//        // with query string partially encoded
-//        testRequestUrlEncoding("test.html?a=b%20c&d=e f");
-//    }
-//
-//    /**
-//     * Test that the path and query string are encoded to be valid.
-//     * @throws Exception if something goes wrong
-//     */
-//    @Test
-//    @Alerts("/test.html?a=b%20c")
-//    public void loadPage_EncodeRequest4() throws Exception {
-//        // with anchor
-//        testRequestUrlEncoding("test.html?a=b c#myAnchor");
-//    }
-//
-//    /**
-//     * Test that the path and query string are encoded to be valid.
-//     * @throws Exception if something goes wrong
-//     */
-//    @Test
-//    @Alerts("/test.html?a=%26%3D%20%2C%24")
-//    public void loadPage_EncodeRequest5() throws Exception {
-//        // with query string containing encoded "&", "=", "+", ",", and "$"
-//        testRequestUrlEncoding("test.html?a=%26%3D%20%2C%24");
-//    }
-//
-//    /**
-//     * Test that the path and query string are encoded to be valid.
-//     * @throws Exception if something goes wrong
-//     */
-//    @Test
-//    @Alerts("/page%201.html")
-//    public void loadPage_EncodeRequest6() throws Exception {
-//        // with character to encode in path
-//        testRequestUrlEncoding("page 1.html");
-//    }
-//
-//    /**
-//     * Test that the path and query string are encoded to be valid.
-//     * @throws Exception if something goes wrong
-//     */
-//    @Test
-//    @Alerts(DEFAULT = "/test.html?param=%C2%A9%C2%A3",
-//            IE = "/test.html?param=\u00A9\u00A3")
-//    @NotYetImplemented(IE)
-//    public void loadPage_EncodeRequest7() throws Exception {
-//        // unicode
-//        testRequestUrlEncoding("test.html?param=\u00A9\u00A3");
-//    }
-//
-//    private void testRequestUrlEncoding(final String url) throws Exception {
-//        final String html = "<html>"
-//                + "<head><title>foo</title></head>"
-//                + "<body></body></html>";
-//
-//        final String response = "HTTP/1.1 200 OK\r\n"
-//                + "Content-Length: " + html.length() + "\r\n"
-//                + "Content-Type: text/html\r\n"
-//                + "\r\n"
-//                + html;
-//
-//        primitiveWebServer_ = new PrimitiveWebServer(PORT, response);
-//        primitiveWebServer_.start();
-//
-//        final WebDriver driver = getWebDriver();
-//
-//        driver.get(new URL(URL_FIRST, url).toString());
-//        String reqUrl = primitiveWebServer_.getRequests().get(0);
-//        reqUrl = reqUrl.substring(4, reqUrl.indexOf("HTTP/1.1") - 1);
-//
-//        assertEquals(getExpectedAlerts()[0], reqUrl);
-//    }
+    /**
+     * Test that the path and query string are encoded to be valid.
+     * @throws Exception if something goes wrong
+     */
+    @Test
+    @Alerts(DEFAULT = "/test.html?a=b%20c&d=%C3%A9%C3%A8",
+            IE = "/test.html?a=b%20c&d=\u00E9\u00E8")
+    @NotYetImplemented(IE)
+    public void loadPage_EncodeRequest() throws Exception {
+        // with query string not encoded
+        testRequestUrlEncoding("test.html?a=b c&d=\u00E9\u00E8");
+    }
 
     /**
+     * Test that the path and query string are encoded to be valid.
+     * @throws Exception if something goes wrong
+     */
+    @Test
+    @Alerts("/test.html?a=b%20c&d=%C3%A9%C3%A8")
+    public void loadPage_EncodeRequest2() throws Exception {
+        // with query string already encoded
+        testRequestUrlEncoding("test.html?a=b%20c&d=%C3%A9%C3%A8");
+    }
+
+    /**
+     * Test that the path and query string are encoded to be valid.
+     * @throws Exception if something goes wrong
+     */
+    @Test
+    @Alerts("/test.html?a=b%20c&d=e%20f")
+    public void loadPage_EncodeRequest3() throws Exception {
+        // with query string partially encoded
+        testRequestUrlEncoding("test.html?a=b%20c&d=e f");
+    }
+
+    /**
+     * Test that the path and query string are encoded to be valid.
+     * @throws Exception if something goes wrong
+     */
+    @Test
+    @Alerts("/test.html?a=b%20c")
+    public void loadPage_EncodeRequest4() throws Exception {
+        // with anchor
+        testRequestUrlEncoding("test.html?a=b c#myAnchor");
+    }
+
+    /**
+     * Test that the path and query string are encoded to be valid.
+     * @throws Exception if something goes wrong
+     */
+    @Test
+    @Alerts("/test.html?a=%26%3D%20%2C%24")
+    public void loadPage_EncodeRequest5() throws Exception {
+        // with query string containing encoded "&", "=", "+", ",", and "$"
+        testRequestUrlEncoding("test.html?a=%26%3D%20%2C%24");
+    }
+
+    /**
+     * Test that the path and query string are encoded to be valid.
+     * @throws Exception if something goes wrong
+     */
+    @Test
+    @Alerts("/page%201.html")
+    public void loadPage_EncodeRequest6() throws Exception {
+        // with character to encode in path
+        testRequestUrlEncoding("page 1.html");
+    }
+
+    /**
+     * Test that the path and query string are encoded to be valid.
+     * @throws Exception if something goes wrong
+     */
+    @Test
+    @Alerts(DEFAULT = "/test.html?param=%C2%A9%C2%A3",
+            IE = "/test.html?param=\u00A9\u00A3")
+    @NotYetImplemented(IE)
+    public void loadPage_EncodeRequest7() throws Exception {
+        // unicode
+        testRequestUrlEncoding("test.html?param=\u00A9\u00A3");
+    }
+
+    private void testRequestUrlEncoding(final String url) throws Exception {
+        final String html = "<html>"
+                + "<head><title>foo</title></head>"
+                + "<body></body></html>";
+
+        final String response = "HTTP/1.1 200 OK\r\n"
+                + "Content-Length: " + html.length() + "\r\n"
+                + "Content-Type: text/html\r\n"
+                + "Connection: close\r\n"
+                + "\r\n"
+                + html;
+
+        primitiveWebServer_ = new PrimitiveWebServer(PORT, response);
+        primitiveWebServer_.start();
+
+        final WebDriver driver = getWebDriver();
+
+        driver.get(new URL(URL_FIRST, url).toString());
+        String reqUrl = primitiveWebServer_.getRequests().get(0);
+        reqUrl = reqUrl.substring(4, reqUrl.indexOf("HTTP/1.1") - 1);
+
+        assertEquals(getExpectedAlerts()[0], reqUrl);
+    }
+
+    /**
      * @throws Exception if the test fails
      */
     @Test
@@ -263,180 +264,188 @@
         assertEquals(getExpectedAlerts()[0], reqUrl);
     }
 
-//    /**
-//     * @throws Exception if the test fails
-//     */
-//    @Test
-//    @Alerts(DEFAULT = "/test.css?k%C3%B6nig",
-//            IE = "/test.css?k\u00c3\u00b6nig")
-//    @NotYetImplemented(IE)
-//    public void linkUrlEncodingUTF8Header() throws Exception {
-//        final String html = "<html>\n"
-//                + "<head><title>foo</title>\n"
-//                + "  <link rel='stylesheet' type='text/css' href='test.css?k\u00F6nig'>"
-//                + "</head>\n"
-//                + "<body>\n"
-//                + "</body></html>";
-//
-//        final String firstResponse = "HTTP/1.1 200 OK\r\n"
-//                + "Content-Length: " + html.length() + "\r\n"
-//                + "Content-Type: text/html; charset=UTF-8\r\n"
-//                + "\r\n"
-//                + html;
-//
-//        final String css = "p { color: red; }";
-//
-//        final String secondResponse = "HTTP/1.1 200 OK\r\n"
-//                + "Content-Length: " + css.length() + "\r\n"
-//                + "Content-Type: text/css\r\n"
-//                + "\r\n"
-//                + css;
-//
-//        primitiveWebServer_ = new PrimitiveWebServer(PORT, firstResponse, secondResponse);
-//        primitiveWebServer_.setCharset(StandardCharsets.UTF_8);
-//        primitiveWebServer_.start();
-//
-//        final WebDriver driver = getWebDriver();
-//
-//        driver.get(URL_FIRST.toString());
-//
-//        String reqUrl = primitiveWebServer_.getRequests().get(1);
-//        reqUrl = reqUrl.substring(4, reqUrl.indexOf("HTTP/1.1") - 1);
-//
-//        assertEquals(getExpectedAlerts()[0], reqUrl);
-//    }
-//
-//    /**
-//     * @throws Exception if the test fails
-//     */
-//    @Test
-//    @Alerts(DEFAULT = "/test.css?k%C3%B6nig",
-//            IE = "/test.css?k\u00c3\u00b6nig")
-//    @NotYetImplemented(IE)
-//    public void linkUrlEncodingUTF8Meta() throws Exception {
-//        final String html = "<html>\n"
-//                + "<head><title>foo</title>\n"
-//                + "  <meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>\n"
-//                + "  <link rel='stylesheet' type='text/css' href='test.css?k\u00F6nig'>"
-//                + "</head>\n"
-//                + "<body>\n"
-//                + "</body></html>";
-//
-//        final String firstResponse = "HTTP/1.1 200 OK\r\n"
-//                + "Content-Length: " + html.length() + "\r\n"
-//                + "Content-Type: text/html\r\n"
-//                + "\r\n"
-//                + html;
-//
-//        final String css = "p { color: red; }";
-//
-//        final String secondResponse = "HTTP/1.1 200 OK\r\n"
-//                + "Content-Length: " + css.length() + "\r\n"
-//                + "Content-Type: text/css\r\n"
-//                + "\r\n"
-//                + css;
-//
-//        primitiveWebServer_ = new PrimitiveWebServer(PORT, firstResponse, secondResponse);
-//        primitiveWebServer_.setCharset(StandardCharsets.UTF_8);
-//        primitiveWebServer_.start();
-//
-//        final WebDriver driver = getWebDriver();
-//
-//        driver.get(URL_FIRST.toString());
-//
-//        String reqUrl = primitiveWebServer_.getRequests().get(1);
-//        reqUrl = reqUrl.substring(4, reqUrl.indexOf("HTTP/1.1") - 1);
-//
-//        assertEquals(getExpectedAlerts()[0], reqUrl);
-//    }
-//
-//    /**
-//     * @throws Exception if the test fails
-//     */
-//    @Test
-//    @Alerts(DEFAULT = "/test.css?k%F6nig",
-//            IE = "/test.css?k\u00f6nig")
-//    @NotYetImplemented(IE)
-//    public void linkUrlEncodingISO8859_1Header() throws Exception {
-//        final String html = "<html>\n"
-//                + "<head><title>foo</title>\n"
-//                + "  <link rel='stylesheet' type='text/css' href='test.css?k\u00F6nig'>"
-//                + "</head>\n"
-//                + "<body>\n"
-//                + "</body></html>";
-//
-//        final String firstResponse = "HTTP/1.1 200 OK\r\n"
-//                + "Content-Length: " + html.length() + "\r\n"
-//                + "Content-Type: text/html; charset=ISO-8859-1\r\n"
-//                + "\r\n"
-//                + html;
-//
-//        final String css = "p { color: red; }";
-//
-//        final String secondResponse = "HTTP/1.1 200 OK\r\n"
-//                + "Content-Length: " + css.length() + "\r\n"
-//                + "Content-Type: text/css\r\n"
-//                + "\r\n"
-//                + css;
-//
-//        primitiveWebServer_ = new PrimitiveWebServer(PORT, firstResponse, secondResponse);
-//        primitiveWebServer_.setCharset(StandardCharsets.ISO_8859_1);
-//        primitiveWebServer_.start();
-//
-//        final WebDriver driver = getWebDriver();
-//
-//        driver.get(URL_FIRST.toString());
-//
-//        String reqUrl = primitiveWebServer_.getRequests().get(1);
-//        reqUrl = reqUrl.substring(4, reqUrl.indexOf("HTTP/1.1") - 1);
-//
-//        assertEquals(getExpectedAlerts()[0], reqUrl);
-//    }
-//
-//    /**
-//     * @throws Exception if the test fails
-//     */
-//    @Test
-//    @Alerts(DEFAULT = "/test.css?k%F6nig",
-//            IE = "/test.css?k\u00f6nig")
-//    @NotYetImplemented(IE)
-//    public void linkUrlEncodingISO8859_1Meta() throws Exception {
-//        final String html = "<html>\n"
-//                + "<head><title>foo</title>\n"
-//                + "  <meta http-equiv='Content-Type' content='text/html; charset=ISO-8859-1'>\n"
-//                + "  <link rel='stylesheet' type='text/css' href='test.css?k\u00F6nig'>"
-//                + "</head>\n"
-//                + "<body>\n"
-//                + "</body></html>";
-//
-//        final String firstResponse = "HTTP/1.1 200 OK\r\n"
-//                + "Content-Length: " + html.length() + "\r\n"
-//                + "Content-Type: text/html\r\n"
-//                + "\r\n"
-//                + html;
-//
-//        final String css = "p { color: red; }";
-//
-//        final String secondResponse = "HTTP/1.1 200 OK\r\n"
-//                + "Content-Length: " + css.length() + "\r\n"
-//                + "Content-Type: text/css\r\n"
-//                + "\r\n"
-//                + css;
-//
-//        primitiveWebServer_ = new PrimitiveWebServer(PORT, firstResponse, secondResponse);
-//        primitiveWebServer_.setCharset(StandardCharsets.ISO_8859_1);
-//        primitiveWebServer_.start();
-//
-//        final WebDriver driver = getWebDriver();
-//
-//        driver.get(URL_FIRST.toString());
-//
-//        String reqUrl = primitiveWebServer_.getRequests().get(1);
-//        reqUrl = reqUrl.substring(4, reqUrl.indexOf("HTTP/1.1") - 1);
-//
-//        assertEquals(getExpectedAlerts()[0], reqUrl);
-//    }
+    /**
+     * @throws Exception if the test fails
+     */
+    @Test
+    @Alerts(DEFAULT = "/test.css?k%C3%B6nig",
+            IE = "/test.css?k\u00c3\u00b6nig")
+    @NotYetImplemented(IE)
+    public void linkUrlEncodingUTF8Header() throws Exception {
+        final String html = "<html>\n"
+                + "<head><title>foo</title>\n"
+                + "  <link rel='stylesheet' type='text/css' href='test.css?k\u00F6nig'>"
+                + "</head>\n"
+                + "<body>\n"
+                + "</body></html>";
 
+        final String firstResponse = "HTTP/1.1 200 OK\r\n"
+                + "Content-Length: " + html.length() + "\r\n"
+                + "Content-Type: text/html; charset=UTF-8\r\n"
+                + "Connection: close\r\n"
+                + "\r\n"
+                + html;
+
+        final String css = "p { color: red; }";
+
+        final String secondResponse = "HTTP/1.1 200 OK\r\n"
+                + "Content-Length: " + css.length() + "\r\n"
+                + "Content-Type: text/css\r\n"
+                + "Connection: close\r\n"
+                + "\r\n"
+                + css;
+
+        primitiveWebServer_ = new PrimitiveWebServer(PORT, firstResponse, secondResponse);
+        primitiveWebServer_.setCharset(StandardCharsets.UTF_8);
+        primitiveWebServer_.start();
+
+        final WebDriver driver = getWebDriver();
+
+        driver.get(URL_FIRST.toString());
+
+        String reqUrl = primitiveWebServer_.getRequests().get(1);
+        reqUrl = reqUrl.substring(4, reqUrl.indexOf("HTTP/1.1") - 1);
+
+        assertEquals(getExpectedAlerts()[0], reqUrl);
+    }
+
+    /**
+     * @throws Exception if the test fails
+     */
+    @Test
+    @Alerts(DEFAULT = "/test.css?k%C3%B6nig",
+            IE = "/test.css?k\u00c3\u00b6nig")
+    @NotYetImplemented(IE)
+    public void linkUrlEncodingUTF8Meta() throws Exception {
+        final String html = "<html>\n"
+                + "<head><title>foo</title>\n"
+                + "  <meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>\n"
+                + "  <link rel='stylesheet' type='text/css' href='test.css?k\u00F6nig'>"
+                + "</head>\n"
+                + "<body>\n"
+                + "</body></html>";
+
+        final String firstResponse = "HTTP/1.1 200 OK\r\n"
+                + "Content-Length: " + html.length() + "\r\n"
+                + "Content-Type: text/html\r\n"
+                + "Connection: close\r\n"
+                + "\r\n"
+                + html;
+
+        final String css = "p { color: red; }";
+
+        final String secondResponse = "HTTP/1.1 200 OK\r\n"
+                + "Content-Length: " + css.length() + "\r\n"
+                + "Content-Type: text/css\r\n"
+                + "Connection: close\r\n"
+                + "\r\n"
+                + css;
+
+        primitiveWebServer_ = new PrimitiveWebServer(PORT, firstResponse, secondResponse);
+        primitiveWebServer_.setCharset(StandardCharsets.UTF_8);
+        primitiveWebServer_.start();
+
+        final WebDriver driver = getWebDriver();
+
+        driver.get(URL_FIRST.toString());
+
+        String reqUrl = primitiveWebServer_.getRequests().get(1);
+        reqUrl = reqUrl.substring(4, reqUrl.indexOf("HTTP/1.1") - 1);
+
+        assertEquals(getExpectedAlerts()[0], reqUrl);
+    }
+
+    /**
+     * @throws Exception if the test fails
+     */
+    @Test
+    @Alerts(DEFAULT = "/test.css?k%F6nig",
+            IE = "/test.css?k\u00f6nig")
+    @NotYetImplemented(IE)
+    public void linkUrlEncodingISO8859_1Header() throws Exception {
+        final String html = "<html>\n"
+                + "<head><title>foo</title>\n"
+                + "  <link rel='stylesheet' type='text/css' href='test.css?k\u00F6nig'>"
+                + "</head>\n"
+                + "<body>\n"
+                + "</body></html>";
+
+        final String firstResponse = "HTTP/1.1 200 OK\r\n"
+                + "Content-Length: " + html.length() + "\r\n"
+                + "Content-Type: text/html; charset=ISO-8859-1\r\n"
+                + "Connection: close\r\n"
+                + "\r\n"
+                + html;
+
+        final String css = "p { color: red; }";
+
+        final String secondResponse = "HTTP/1.1 200 OK\r\n"
+                + "Content-Length: " + css.length() + "\r\n"
+                + "Content-Type: text/css\r\n"
+                + "Connection: close\r\n"
+                + "\r\n"
+                + css;
+
+        primitiveWebServer_ = new PrimitiveWebServer(PORT, firstResponse, secondResponse);
+        primitiveWebServer_.setCharset(StandardCharsets.ISO_8859_1);
+        primitiveWebServer_.start();
+
+        final WebDriver driver = getWebDriver();
+
+        driver.get(URL_FIRST.toString());
+
+        String reqUrl = primitiveWebServer_.getRequests().get(1);
+        reqUrl = reqUrl.substring(4, reqUrl.indexOf("HTTP/1.1") - 1);
+
+        assertEquals(getExpectedAlerts()[0], reqUrl);
+    }
+
+    /**
+     * @throws Exception if the test fails
+     */
+    @Test
+    @Alerts(DEFAULT = "/test.css?k%F6nig",
+            IE = "/test.css?k\u00f6nig")
+    @NotYetImplemented(IE)
+    public void linkUrlEncodingISO8859_1Meta() throws Exception {
+        final String html = "<html>\n"
+                + "<head><title>foo</title>\n"
+                + "  <meta http-equiv='Content-Type' content='text/html; charset=ISO-8859-1'>\n"
+                + "  <link rel='stylesheet' type='text/css' href='test.css?k\u00F6nig'>"
+                + "</head>\n"
+                + "<body>\n"
+                + "</body></html>";
+
+        final String firstResponse = "HTTP/1.1 200 OK\r\n"
+                + "Content-Length: " + html.length() + "\r\n"
+                + "Content-Type: text/html\r\n"
+                + "Connection: close\r\n"
+                + "\r\n"
+                + html;
+
+        final String css = "p { color: red; }";
+
+        final String secondResponse = "HTTP/1.1 200 OK\r\n"
+                + "Content-Length: " + css.length() + "\r\n"
+                + "Content-Type: text/css\r\n"
+                + "Connection: close\r\n"
+                + "\r\n"
+                + css;
+
+        primitiveWebServer_ = new PrimitiveWebServer(PORT, firstResponse, secondResponse);
+        primitiveWebServer_.setCharset(StandardCharsets.ISO_8859_1);
+        primitiveWebServer_.start();
+
+        final WebDriver driver = getWebDriver();
+
+        driver.get(URL_FIRST.toString());
+
+        String reqUrl = primitiveWebServer_.getRequests().get(1);
+        reqUrl = reqUrl.substring(4, reqUrl.indexOf("HTTP/1.1") - 1);
+
+        assertEquals(getExpectedAlerts()[0], reqUrl);
+    }
+
 //    BaseFrameElement.java (2 matches)
 //    HtmlApplet.java
 //    HtmlArea.java


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot