summaryrefslogtreecommitdiffstats
path: root/luni/src/test/java/libcore/net
Commit message (Collapse)AuthorAgeFilesLines
* Test NetworkSecurityPolicy effect on HTTP connections.Alex Klyubin2015-03-251-0/+54
| | | | | | | | | This adds CTS tests that assert that platform-provided URLConnection instances that use cleartext HTTP honor the cleartext traffic policy from NetworkSecurityPolicy. Bug: 19215516 Change-Id: I79f5fce5e00434e96f4325c1aae65a573f10dcdd
* Add libcore.net.NetworkSecurityPolicy.Alex Klyubin2015-03-241-0/+261
| | | | | | | | | | | | | | | | | | | | | This hidden libcore API is to be used by bundled network stacks to determine whether cleartext network traffic is permitted. These stacks cannot directly use the public Android framework API android.security.NetworkSecurityPolicy because the framework package typically compile-time depends on the packages offering these bundled network stacks. As an example, this CL makes java.util.logging.SocketHandler and platform-provided URLConnection instances for the FTP protocol honor this new flag. To avoid duplication, the intention is that framework's android.security.NetworkSecurityPolicy implementaion will switch to this new libcore API to store/retrive the state of framework's NetworkSecurityPolicy class. Bug: 19215516 Change-Id: I78e348458975d69c52918582a43db25df87e2a15
* Add a hidden API for detecting response charsets.Narayan Kamath2014-12-161-0/+52
| | | | | | | | | | | | | | This is meant to be a partial replacement for apache's EntityUtils.toString for internal callers. Providing a stand in replacement seems like a bad idea because that API tries to coerce all responses into strings, even those that are binary. I'm torn about EntityUtils. It was a useful "utility" in some cases, but dangerous in others. bug: 18027885 Change-Id: Ia02ffe86b5ef5caecbe86069967a549ff09335e5
* Prefer "jpg" over "jpeg" as the extension for "image/jpeg".Elliott Hughes2014-11-141-0/+4
| | | | | Bug: 18390752 Change-Id: Iaffa75629a7b618dd8809416934733e7314bf820
* Regression test for video/x-matroska.Elliott Hughes2014-11-101-0/+6
| | | | | Bug: https://code.google.com/p/android/issues/detail?id=78909 Change-Id: I47ac0141275bba0cce3f5d34229235b60eb19d30
* libcore changes to support ConnectionPool cache flushingNeil Fuller2014-09-091-0/+78
| | | | | | | | | | | | | | | | | | | A set of observer / listener components for network events. Party A, e.g. the Android ConnectivityManager, can make changes to network configuration that impacts the java network objects (e.g. connection pools, caches, etc.). Party B, e.g. Android libcore network components are interested in network configuration changes. The NetworkEventDispatcher enables Party A to communicate with Party B without hardcoding their details. Additional parties like B can be added. Bug: 17314604 Change-Id: I175bdf28662bafcf0c91acb51a3da5cbc2b69086
* Rearrange a few of our MIME type registrations.Elliott Hughes2014-08-221-1/+7
| | | | | | | Based on looking at IANA and wikipedia. Bug: 16978217 Change-Id: I0d28c6d53ec26c7d5501f722b66dd50595e2a6b4
* Fix MimeUtils to treat ".flac" as "audio/flac".Elliott Hughes2014-08-041-0/+39
| | | | | Bug: 15715370 Change-Id: I2d99f070c3debea01621a172d8189951a56736b5
* Switch to OkHttp as URL's preferred HTTP implementation.jwilson2013-04-033-2184/+0
| | | | Change-Id: Id724b75dd78b68ed00f5db4989c4070896996ec0
* HttpResponseCache should return 504, not 502.Elliott Hughes2012-07-301-5/+5
| | | | | | | The RFC seems pretty clear on this issue. Bug: http://code.google.com/p/android/issues/detail?id=28294 Change-Id: Ia9a979e1fbbd8b38b1607059c042e0fc9ca44270
* Update the response cache on a conditional cache hitJesse Wilson2011-12-221-11/+60
| | | | | Bug: http://b/4460598 Change-Id: I5f274b2109861b9d2ed59eda8b3e5b4e89fd27b3
* Support multiple challenges for HTTP authentication.Jesse Wilson2011-12-161-0/+57
| | | | | | | | | | This fixes the problem reported in the bug, but we still need to give attention to the digest scheme. Currently we can't do Basic auth if the HTTP response contains both a Digest challenge and a Basic challenge! Bug: http://code.google.com/p/android/issues/detail?id=19081 Change-Id: Ifffb307678c2afa0db1d50c1ef5fc49ec7769306
* Don't expect caching of partial (HTTP 206) responses.Jesse Wilson2011-08-191-1/+1
| | | | | | | | | | It's a lot of work to cache partial responses properly. We've punted on this for the built-in HttpResponseCache. This test passed once, but only because we were using a stub response cache that didn't interpret 206s properly. Change-Id: I2ee5ae2d5dc9a9d52d499411b281d647e658f21d
* Make HTTP implementation details public for CTS tests.Jesse Wilson2011-08-151-35/+35
| | | | | | | | Our testing tools cannot normally test package-private APIs because the tests are loaded in a different class loader than the production classes. This is an unfortunate workaround. Change-Id: Ic8d9d3088887bccceaf166959468cd52bfef9aae
* Use external/mockwebserver in libcoreJesse Wilson2011-06-071-4/+4
| | | | Change-Id: I4dac34f88b23484643bce31e5f25ac6eb1fea426
* Use canonicalizePath in URI.Jesse Wilson2011-05-251-31/+31
| | | | | | | | This needs to add another mode to canonicalizePath to not discard ".." prefixes from relative paths. Change-Id: I9e0b86bd1e7ab8e5e71c46f1efcf4aeb218e66b2 http://b/2753295
* Rewrite parsing for java.net.URL.Jesse Wilson2011-05-251-0/+89
| | | | | | | | | | | | This fixes many broken cases on handling relative URLs. We normalize all URLs by default. This will result in more URL equality than before. Previously the URLs http://android.com/a/../ and http://android.com/ were not equal; now they are equal. Change-Id: I8cf7be2e42eeb1386520be2698d8f14e0a55decb http://b/4361656
* Merge "Support HTTP cookies and header combining." into dalvik-devJesse Wilson2011-05-191-5/+119
|\
| * Support HTTP cookies and header combining.Jesse Wilson2011-05-191-5/+119
| | | | | | | | | | Change-Id: Ifdf15dc2f551e58bdd6a1aae847f7dec254ac7e8 http://b/3180373
* | Address FindBugs warnings in libcore.net.httpJesse Wilson2011-05-191-9/+2
|/ | | | Change-Id: Ia0c4f95e62825a4ed4debac2578d353491a7ff2c
* Make the HttpResponseCache robust to file I/O errors.Jesse Wilson2011-05-181-0/+59
| | | | | | | | | | | | If the filesystem fails, cache performance degrades. Ongoing writes should not see any filesystem errors: don't punish the writer who isn't benefitting from the cache. Ongoing reads may see IOExceptions while streaming files. In practice this will only happen if the directory disappears during use, as is the case when a removable partition is removed. Change-Id: Ibf4d51998d9beaba9f8c86c449fd5c97ca869cee http://b/3180373
* Cache HTTP responses with a Vary header.Jesse Wilson2011-05-171-18/+210
| | | | | | | | | This requires a backdoor for the cache to read the request headers at put time. This is implemented by getting the HttpEngine, which will allow us to eventually share the response header parsing. Change-Id: I177467244e5af0a3dda07883cd58d641bf75362f http://b/3180373
* Move APIs from internal HttpResponseCache to external one.Jesse Wilson2011-05-141-2/+5
| | | | | Change-Id: Ia6c88f292088bfd3ed546c067376fcb36b435b48 http://b/3180373
* Add the application version to the DiskLruCache journal.Jesse Wilson2011-05-121-3/+3
| | | | | | | | This makes it easy for us to change how we store HTTP cache data without fear of compatibility problems. Change-Id: I26cd6645d26f359ab76e2f87b6ab73bbf24ab715 http://b/3180373
* Provide more user-friendly HTTP cache stats.Jesse Wilson2011-05-121-41/+43
| | | | | | | | | | | | | | | Rather than strictly trackign what's convenient for implementation, we now provide stats based on what we anticipate the user will want to know: - how many requests were made? - how many requests required network use? - how many requests were served by the cache? This doesn't provide individual stats on how many conditional gets were made, but those can be computed. Change-Id: Ieeebaf8b98664e78f828971052404dd7da28ad78 http://b/3180373
* Provide hit and miss stats on the HTTP response cache.Jesse Wilson2011-05-121-0/+1467
| | | | | | | | | | | | Also capture FDs rather than InputStreams when a cache entry is read. This permits the cache to return as many streams as the caller requires. Also fix bugs where we weren't properly releasing the input streams from the responses. Change-Id: I04807eab648864229f1e8734ad1fbb6a2d6bb51d http://b/3180373
* Refactor HttpURLConnection implementation.Jesse Wilson2011-05-042-22/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | Break HttpURLConnectionImpl into two parts: the part that implements the Java API (that follows redirects etc.) and the part that speaks HTTP. The HTTP part is called HttpEngine, and it can only be used for a single HTTP request. This makes it easier to set request properties that only apply to a single socket request. Tests for 'Vary', 'Content-Location' and warnings. For simplicity of implementation I've chosen not to support 'Vary' at this time. The 'Content-Location' header doesn't require any work from the cache. Warnings are ugly but allow the caller to identify when the cache results may be problematic. Also breaking HttpResponseCache's dependency on HttpURLConnectionImpl so it can be tested on the RI. Change-Id: Idbabb51251f479c2cdea4e0fceb029bfd07182be http://b/3180373
* Split CacheHeader into RequestHeader and ResponseHeader.Jesse Wilson2011-05-023-194/+196
| | | | | | | | Fix suspicious use of the word 'header' in the HttpURLConnectionImpl. Use 'header field' and 'headers' as necessary. Change-Id: I502808005a727772091e5770a517d3170e102549 http://b/3180373
* Fix CacheHeaderTest to use the new constructor.Jesse Wilson2011-05-021-17/+25
| | | | | Change-Id: I7ecfa49078d131ff90031fd44698290f8b170cd7 http://b/3180373
* Cache authorization headers and default expiration date.Jesse Wilson2011-05-021-1/+1
| | | | | | | | | | | Neither of these are particularly pretty. Authorization is a silly special case in the spec that makes caching opt-in rather than opt-out. Default expiration dates are reasonable but require a hack to not cache get queries like http://foo.com/?q=bar. http://b/3180373 Change-Id: Ica76ccfde30fe1e7a0d64895ef5370b43bd980ec
* Improve parsing of HTTP caching headers.Jesse Wilson2011-04-292-0/+238
Change-Id: Ie2b4c76ac97cc7a4783bd6a695cfb28f7ea2296f http://b/3180373