summaryrefslogtreecommitdiffstats
path: root/support/src/test/java/tests/http
Commit message (Collapse)AuthorAgeFilesLines
* If libcore wants ASCII casing, it needs to ask for it like everyone else.Elliott Hughes2013-08-021-1/+2
| | | | | | | http://elliotth.blogspot.com/2012/01/beware-convenience-methods.html Bug: https://code.google.com/p/android/issues/detail?id=58359 Change-Id: I597b2ac940f17b5b2bc176e390dc4b63fe0a4e72
* Fix @deprecated javadoc orthography.Elliott Hughes2013-06-061-1/+1
| | | | Change-Id: I6db6d91e21b8e1aca5b5338534196fd5bdef8a06
* Use external/mockwebserver in libcoreJesse Wilson2011-06-071-0/+3
| | | | Change-Id: I4dac34f88b23484643bce31e5f25ac6eb1fea426
* Don't lose the import for InetAddress.Jesse Wilson2011-05-051-0/+1
| | | | Change-Id: I90fcf6c284f4a3bbe36ef0ed44f85ddf5a424ffb
* Fix proxy+HTTPS to handle authentication requests from the proxy.Jesse Wilson2011-05-052-4/+23
| | | | | | | | Previously I'd introduced a bug by assuming that CONNECT responses would always be successful. Change-Id: Iaf0caf67f52154f6951a20284c75db0090843b99 http://b/4188137
* Honor max-age and min-fresh request headers.Jesse Wilson2011-04-291-1/+1
| | | | | | | | We now honor headers from both the server's response (which we have cached) and the client's request. Change-Id: Ib46e4fc0c5dd5b3e74cff8f45eea2dda51d20b94 http://b/3180373
* Support conditional gets in HttpURLConnection.Jesse Wilson2011-04-293-242/+41
| | | | | | | | This is the first step towards adding an HTTP response cache. There's still much to do; details are listed on the bug. Change-Id: Ie693fe424d1d90e90576fc959595e4d96a31f767 http://b/3180373
* am 866b399e: am 9d28a32d: am bc4c79c6: Don\'t read from the delegate stream ↵Jesse Wilson2011-03-311-2/+3
|\ | | | | | | | | | | | | after we close it. * commit '866b399e1d5cab4cc8d196f8008ba8ad8376765d': Don't read from the delegate stream after we close it.
| * Don't read from the delegate stream after we close it.Jesse Wilson2011-03-311-2/+3
| | | | | | | | | | Change-Id: Ib724b170f7ec10ea0025c0e2e7978119fd070eb6 http://b/4188137
* | Fix MockWebServer to use the same hostname as TestKeyStore.Jesse Wilson2011-03-291-4/+7
|/ | | | Change-Id: I31c9f6e9add87a17737eac4f09949540e5da8cb5
* Fix HTTP cookie to do case mapping with Locale.US.Jesse Wilson2011-01-131-2/+2
| | | | | | | | | While I'm here fix a MockWebServer bug I recently introduced that broke cookie tests that needed to know port numbers before responses were enqueued. Change-Id: Idb2389ac5ed66656248c10aeb68209641acc0a68 http://b/3325637
* Move tests from android.core.URLTest to URLConnectionTest.Jesse Wilson2011-01-131-43/+51
| | | | | | | | This includes some changes to MockWebServer to make it stop accepting connections as soon as its response queue is empty. Change-Id: I5a6bcdf1c03d0c36b11552ae086d0dece0440f64 http://b/1158780
* Test that HttpURLConnection responds gracefully when the server closes a socket.Jesse Wilson2010-12-163-35/+74
| | | | | Change-Id: I5110d58d91e7c6f8f7553ad400f0bd841bcf07b6 http://b/2612240
* Fix broken interactions between HTTP response caches and redirects.Jesse Wilson2010-10-271-2/+4
| | | | | | | | | | | | | | | This fixes several specific problems: - HTTP header map didn't contain the status line (under the null key) - response code, message and version weren't set by caches - caches didn't work with redirects This change also makes some significant cleanup to the Headers class. We might be able to simplify this further by dropping the map, should that prove efficient enough. Change-Id: Ib79ec17bef5978b3234f68102114eee7d4b7cda2 http://b/3139211 http://b/3139211
* Fix ResponseCache to support caching of HTTPS responses.Jesse Wilson2010-10-261-6/+76
| | | | | | | | | | Previously it would fail with an internal error because of inconsistencies because HttpURLConnectionImpl claimed to be 'connected' when it had a cache hit, and HttpsURLConnection acted upon this by talking to its sockets. Change-Id: I51f4215ceb9c5fd851223a501488306fa6d382b1 http://b/3043966
* Strip usage of the term 'localhost' from URLConnectionTest.Jesse Wilson2010-09-231-3/+6
| | | | | Change-Id: I8ea7923c3ea72728c7df64c13bdd6f94b91be121 http://b/3032912
* Support for TLS Extensions enabled SSLSockets with fallback to vanila SSLBrian Carlstrom2010-08-022-1/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | See also b/1569612 Summary: - OpenSSlSocket support for SNI, session tickets, compression - URLConnection mimics Chrome behavior of trying connection with these enabled, falling back to SSL w/o encryption on failure Details: libcore URLConnection https retry Change HttpConnection.getSecureSocket to enable non-standard features on first connection attempt. On second attempt, we back off to SSLv3 from TLSv1, mimicking Chrome's behavior. luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/HttpConnection.java Change HttpsEngine.connect to implement SSL reconnect luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/https/HttpsURLConnectionImpl.java OpenSSL SSLSocket implementation OpenSSLSocketImpl and OpenSSLServerSocketImpl now have an array of enabled compression methods interface and implementation to parallel that of procotols and ciphersuites. luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLSocketImpl.java luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLServerSocketImpl.java OpenSSLSessionImpl now has a cache of the native compressionMethod. Also replaced "gives" javadoc working with "returns". luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLSessionImpl.java OpenSSLSocketImpl session caching now needs to skip cached sessions with mismatched compression requirements. luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLSocketImpl.java OpenSSLSocketImpl.startHandshake now uses NativeCrypto to support our non-standard extensions. luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLSocketImpl.java NativeCrypto changes - Added declaration of SSL options for tickets and compression. - Added general "compression methods" interface paralleling "cipher suites" and "protocols" interfaces. - Added SSL_set_tlsext_host_name to set SNI (Server Name Indication) value - Added SSL_get_servername to read SNI (Server Name Indication) value - Added SSL_SESSION_compress_meth read negotiated compression method - SSL_new makes sure to default compression to off for compatibility luni/src/main/java/org/apache/harmony/xnet/provider/jsse/NativeCrypto.java luni/src/main/native/NativeCrypto.cpp Testing Added URLConnectionTest.testConnectViaHttpsWithSSLFallback to make sure we properly retry an https connection if the server terminates unexpectedly. Fixed up URLConnectionTest.testHttpsWithCustomTrustManager with new expected certificate chain. Fixed a few mistaken TestSSLContext.serverContext uses to clientContext luni/src/test/java/java/net/URLConnectionTest.java Added test_SSL_set_tlsext_host_name, test_SSL_get_servername, test_SSL_SESSION_compress_meth. Added a number of missing fail() calls in expected exception cases which caught one test with mistaken expectations. Removed some unnecessary scopes. Fixed some badly scoped catch blocks. luni/src/test/java/org/apache/harmony/xnet/provider/jsse/NativeCryptoTest.java Changed MockWebServer to support a new MockResponse propery of disconnectAtStart, which immediately terminates the connection support/src/test/java/tests/http/MockResponse.java support/src/test/java/tests/http/MockWebServer.java external/openssl Restore -ZLIB to OpenSSL build. Note that NativeCrypto.SSL_new disables compression by for default SSLSocket for compatibility. android-config.mk Force clean build with new CFLAGS CleanSpec.mk Change-Id: Iba6268f9096f2be43f0d30de151dd3fd0aea4a81
* Buffering the decoding of chunked encoding and HTTP headers.Jesse Wilson2010-07-011-23/+104
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also cleanup of HttpConfiguration (renamed HttpConnection.Address), including removing some dead code. Also adding performance-run support to MockWebServer to permit benchmarking. I benchmarked different buffer sizes, and a buffer as small as 16 bytes halved the runtime on some HTTP requests. Ultimately I chose a 128 byte buffer, since that's the point of diminishing returns. The following report shows benchmark results for 5 different buffer sizes. Notice how our previous unbuffered behaviour was particularly inefficient. bodySize transferEncoding responseHeaders bufferSize ms logarithmic runtime 0 FIXED_LENGTH MINIMAL 0 5.44 = 0 FIXED_LENGTH MINIMAL 16 5.17 = 0 FIXED_LENGTH MINIMAL 128 5.06 = 0 FIXED_LENGTH MINIMAL 512 5.19 = 0 FIXED_LENGTH MINIMAL 1024 5.27 = 0 FIXED_LENGTH TYPICAL 0 14.61 =========== 0 FIXED_LENGTH TYPICAL 16 7.35 ==== 0 FIXED_LENGTH TYPICAL 128 6.48 === 0 FIXED_LENGTH TYPICAL 512 6.97 ==== 0 FIXED_LENGTH TYPICAL 1024 6.92 ==== 0 CHUNKED MINIMAL 0 5.72 == 0 CHUNKED MINIMAL 16 5.26 = 0 CHUNKED MINIMAL 128 5.27 = 0 CHUNKED MINIMAL 512 5.16 = 0 CHUNKED MINIMAL 1024 5.31 = 0 CHUNKED TYPICAL 0 14.81 =========== 0 CHUNKED TYPICAL 16 7.30 ==== 0 CHUNKED TYPICAL 128 6.62 === 0 CHUNKED TYPICAL 512 6.51 === 0 CHUNKED TYPICAL 1024 6.50 === 1024 FIXED_LENGTH MINIMAL 0 5.47 = 1024 FIXED_LENGTH MINIMAL 16 5.40 = 1024 FIXED_LENGTH MINIMAL 128 5.43 = 1024 FIXED_LENGTH MINIMAL 512 5.40 = 1024 FIXED_LENGTH MINIMAL 1024 5.37 = 1024 FIXED_LENGTH TYPICAL 0 14.83 =========== 1024 FIXED_LENGTH TYPICAL 16 7.42 ==== 1024 FIXED_LENGTH TYPICAL 128 6.50 === 1024 FIXED_LENGTH TYPICAL 512 6.50 === 1024 FIXED_LENGTH TYPICAL 1024 6.51 === 1024 CHUNKED MINIMAL 0 6.12 == 1024 CHUNKED MINIMAL 16 5.51 = 1024 CHUNKED MINIMAL 128 5.55 = 1024 CHUNKED MINIMAL 512 5.60 == 1024 CHUNKED MINIMAL 1024 5.50 = 1024 CHUNKED TYPICAL 0 15.00 =========== 1024 CHUNKED TYPICAL 16 7.56 ===== 1024 CHUNKED TYPICAL 128 6.86 ==== 1024 CHUNKED TYPICAL 512 6.73 === 1024 CHUNKED TYPICAL 1024 6.60 === 1048576 FIXED_LENGTH MINIMAL 0 25.27 ================= 1048576 FIXED_LENGTH MINIMAL 16 25.36 ================= 1048576 FIXED_LENGTH MINIMAL 128 25.86 ================= 1048576 FIXED_LENGTH MINIMAL 512 25.25 ================= 1048576 FIXED_LENGTH MINIMAL 1024 32.51 =================== 1048576 FIXED_LENGTH TYPICAL 0 36.65 ===================== 1048576 FIXED_LENGTH TYPICAL 16 27.43 ================== 1048576 FIXED_LENGTH TYPICAL 128 26.88 ================= 1048576 FIXED_LENGTH TYPICAL 512 26.94 ================= 1048576 FIXED_LENGTH TYPICAL 1024 33.13 ==================== 1048576 CHUNKED MINIMAL 0 77.02 ============================ 1048576 CHUNKED MINIMAL 16 51.32 ======================== 1048576 CHUNKED MINIMAL 128 50.98 ======================== 1048576 CHUNKED MINIMAL 512 51.82 ======================== 1048576 CHUNKED MINIMAL 1024 50.40 ======================== 1048576 CHUNKED TYPICAL 0 88.99 ============================== 1048576 CHUNKED TYPICAL 16 53.94 ======================== 1048576 CHUNKED TYPICAL 128 53.03 ======================== 1048576 CHUNKED TYPICAL 512 52.14 ======================== 1048576 CHUNKED TYPICAL 1024 50.90 ======================== Benchmark source code is here: http://code.google.com/p/dalvik/source/browse/trunk/benchmarks/regression/URLConnectionBenchmark.java Change-Id: Ie3e754ab8497e6200f8b6e7f9c63c40a7d4784e2
* Fixing response cache and connection reuse for HTTP client.Jesse Wilson2010-06-283-14/+215
| | | | | | | | | | | | | | | | | | | | | | The code splits our HTTP input streams into four (!) inner classes. The base class takes care of ensuring split() and single byte reads get cached and call disconnect() as necessary. Our code closes the cache when the stream is exhausted; this is different from the RI which closes it when in.close() is called. When a fixed length input stream of length 0 is received, we cache it immediately. This has behavior consequences for CONNECT, which needs the otherwise-recyclable connection to stick around. This adds explicit shutdown capabilities to MockWebServer. This is necessary now that we don't guarantee all enqueued responses will be requested. We still need test coverage for malformed chunk sizes. Change-Id: Iaf866af4fc1d76faea559df267a4bde6fdfa1d83
* Fixing various problems with HTTPS proxies thru HTTP.Jesse Wilson2010-06-142-2/+6
| | | | | | | | | | | | | | | - reading extra bytes from the server depending on available() - not sending the port with the proxy request - returning a read-til-the-end stream instead of a read-0-bytes-stream on CONNECT requests - fixing MockWebServer to omit the unnecessary \r\n after the response body - tests no longer mask the issue by unambiguously reading characters. Trailing newlines aren't discarded! - New tests when content-length and content disagree. The RI fails the test when the transfer-encoding is not chunked. Change-Id: I888569844d323bc770cd5bb95ac71c740dd5e720
* Adding testcases for HttpsURLConnection and through a proxy.Jesse Wilson2010-06-111-0/+6
| | | | | | One failure is here: http://b/issue?id=2761326 Change-Id: If1918a2e59bd4335e38ce3ec4214dfccd24ee798
* Adding HTTPS and proxy support to our mock webserver.Jesse Wilson2010-06-102-19/+63
| | | | | | | | Also exposing core-tests-support for use by tests in frameworks/base. I'm not particularly happy about this, but it seems to be the best way to share test support code between the two build targets. Change-Id: I5e8dcac90fc5d9be791e46c2606498978212108e
* Testing that URLConnection uses CookieManager for send and receive.Jesse Wilson2010-05-171-9/+4
| | | | | | | | These all fail on Dalvik because we haven't wired these together. On the RI, everything passes except for the two tests that check parsing for multiple cookies in a single HTTP header. Change-Id: Idb10c5b51b7ae5ca400dc564f2926f0d5792093d
* Adding checks to make sure the HTTP method is consistent with its body.Jesse Wilson2010-05-101-1/+16
| | | | | | | From the post-review comments here: https://android-git.corp.google.com/g/51054 Change-Id: I67be25a6648a2df02a888a0ae8559c05614de20c
* New MockWebServer for HTTP testing.Jesse Wilson2010-05-103-0/+476
Unlike the Support_TestWebServer, this server is dumb but scriptable. It's intended to make it easier to test uncommon HTTP behavior, such as an intermediate HTTP proxy. Change-Id: Iac07e0b4788eeaa172d5c55d8ed9e034d98aa8e6