Changeset 56879 in webkit
- Timestamp:
- Mar 31, 2010 5:13:37 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r56873 r56879 1 2010-03-31 Mark Rowe <mrowe@apple.com> 2 3 Reviewed by Darin Adler. 4 5 <http://webkit.org/b/36878> REGRESSION: Trailing colon on hostnames (with no port specified) causes "Not allowed to use restricted network port" 6 7 Add explicit tests for handling of allowed ports. We currently only test the ports that map to port 80: 0, 80, and "". 8 9 * platform/mac/security/block-test-expected.txt: 10 * security/block-test.html: 11 1 12 2010-03-31 Andrew Scherkus <scherkus@chromium.org> 2 13 -
trunk/LayoutTests/platform/mac/security/block-test-expected.txt
r56492 r56879 136 136 http://255.255.255.255:4294967296/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:4294967296/test.jpg, main document URL block-test.html, http method GET> redirectResponse (null) 137 137 http://255.255.255.255:4294967296/test.jpg - didFailLoadingWithError: <NSError domain WebKitErrorDomain, code 103, failing URL "http://255.255.255.255:4294967296/test.jpg"> 138 http://255.255.255.255:0/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:0/test.jpg, main document URL block-test.html, http method GET> redirectResponse (null) 139 http://255.255.255.255:0/test.jpg - didFailLoadingWithError: <NSError domain NSURLErrorDomain, code -1004, failing URL "http://255.255.255.255:0/test.jpg"> 140 http://255.255.255.255:80/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:80/test.jpg, main document URL block-test.html, http method GET> redirectResponse (null) 141 http://255.255.255.255:80/test.jpg - didFailLoadingWithError: <NSError domain NSURLErrorDomain, code -1004, failing URL "http://255.255.255.255:80/test.jpg"> 142 http://255.255.255.255:/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:/test.jpg, main document URL block-test.html, http method GET> redirectResponse (null) 143 http://255.255.255.255:/test.jpg - didFailLoadingWithError: <NSError domain NSURLErrorDomain, code -1004, failing URL "http://255.255.255.255:/test.jpg"> 138 144 ftp://255.255.255.255/test.jpg - willSendRequest <NSURLRequest URL ftp://255.255.255.255/test.jpg, main document URL block-test.html, http method GET> redirectResponse (null) 139 145 ftp://255.255.255.255/test.jpg - didFailLoadingWithError: <NSError domain NSURLErrorDomain, code -1, failing URL "ftp://255.255.255.255/test.jpg"> -
trunk/LayoutTests/security/block-test.html
r56492 r56879 2 2 <script> 3 3 // Note that port "1" is tested by the initial load. 4 var blockedPorts = new Array(7, 9, 11, 13, 15, 17, 19, 20,4 var blockedPorts = [7, 9, 11, 13, 15, 17, 19, 20, 5 5 21, 22, 23, 25, 37, 42, 43, 53, 77, 79, 87, 95, 101, 102, 6 6 103, 104, 109, 110, 111, 113, 115, 117, 119, 123, 135, 139, … … 10 10 11 11 // Port numbers that we consider to be invalid due to being out of range. 12 Math.pow(2, 16) - 1, Math.pow(2, 16), Math.pow(2, 32) - 1, Math.pow(2, 32) ,12 Math.pow(2, 16) - 1, Math.pow(2, 16), Math.pow(2, 32) - 1, Math.pow(2, 32)]; 13 13 14 // A port number of 0 indicates to nextTest that it should test the FTP exemptions. 15 0); 16 14 var allowedPorts = [0, 80, ""]; 15 17 16 var baseURL = "255.255.255.255"; 18 17 var currentPort = 0; 19 18 20 19 if (window.layoutTestController) { 21 20 layoutTestController.waitUntilDone(); 22 21 layoutTestController.dumpResourceLoadCallbacks(); 23 22 } 24 25 function nextTest() { 26 if (!blockedPorts[currentPort]) { 27 ftpTest(); 23 24 function nextBlockedPortTest() { 25 if (!(currentPort in blockedPorts)) { 26 currentPort = 0; 27 nextAllowedPortTest(); 28 28 return; 29 29 } … … 32 32 testIMG.src = newURL; 33 33 } 34 34 35 function nextAllowedPortTest() { 36 if (!(currentPort in allowedPorts)) { 37 ftpTest(); 38 return; 39 } 40 var newURL = "http://" + baseURL + ":" + allowedPorts[currentPort] + "/test.jpg"; 41 currentPort++; 42 testIMG.setAttribute("onError", "nextAllowedPortTest();"); 43 testIMG.src = newURL; 44 } 45 35 46 function ftpTest() { 36 47 testIMG.setAttribute("onError", "ftp21Test();"); … … 38 49 testIMG.src = newURL; 39 50 } 40 51 41 52 function ftp21Test() { 42 53 testIMG.setAttribute("onError", "ftp22Test();"); … … 44 55 testIMG.src = newURL; 45 56 } 46 57 47 58 function ftp22Test() { 48 59 testIMG.setAttribute("onError", "finishTesting();"); … … 50 61 testIMG.src = newURL; 51 62 } 52 63 53 64 function finishTesting() { 54 65 if (window.layoutTestController) { … … 63 74 nature of this test, the results can only be processed automatically via DumpRenderTree 64 75 </p> 65 <img id="testIMG" src="http://255.255.255.255:1/test.jpg" onError="next Test();"></img>76 <img id="testIMG" src="http://255.255.255.255:1/test.jpg" onError="nextBlockedPortTest();"></img> 66 77 </body> 67 78 </html> -
trunk/WebCore/ChangeLog
r56878 r56879 1 2010-03-31 Mark Rowe <mrowe@apple.com> 2 3 Reviewed by Darin Adler. 4 5 <http://webkit.org/b/36878> REGRESSION: Trailing colon on hostnames (with no port specified) causes "Not allowed to use restricted network port" 6 7 * platform/KURL.cpp: 8 (WebCore::KURL::port): Explicitly handle the case of a colon being present in the URL after the host name but with 9 no port number before the path. This is handled in the same manner as the colon and port being omitted completely. 10 1 11 2010-03-31 Gavin Barraclough <barraclough@apple.com> 2 12 -
trunk/WebCore/platform/KURL.cpp
r56825 r56879 577 577 unsigned short KURL::port() const 578 578 { 579 if (m_hostEnd == m_portEnd) 579 // We return a port of 0 if there is no port specified. This can happen in two situations: 580 // 1) The URL contains no colon after the host name and before the path component of the URL. 581 // 2) The URL contains a colon but there's no port number before the path component of the URL begins. 582 if (m_hostEnd == m_portEnd || m_hostEnd == m_portEnd - 1) 580 583 return 0; 581 584
Note: See TracChangeset
for help on using the changeset viewer.