1
0
mirror of https://github.com/square/okhttp.git synced 2026-01-17 08:42:25 +03:00
Commit Graph

25 Commits

Author SHA1 Message Date
Jake Wharton
ee83d8d26a Merge pull request #2185 from square/jwilson_0101_api_ergonomics
Detect API use errors earlier.
2016-01-02 02:13:16 -05:00
jwilson
7826bcb2fb Fix some get prefixes on Cache and ConnectionPool. 2016-01-02 02:07:30 -05:00
jwilson
d3675a5e0f Detect API use errors earlier.
Previously we would accept invalid input, but crash when that invalid input
was used.
2016-01-02 01:51:07 -05:00
jwilson
21d6303418 Restore no-args constructor for OkHttpClient.
This is a popular API and keeping it working is handy.
2016-01-01 15:22:14 -05:00
jwilson
38d570a6b2 Drop get and set prefixes in OkHttpClient, OkHttpClient.Builder 2016-01-01 12:12:35 -05:00
jwilson
f2461183e8 Refactor towards an OkHttpClient.Builder.
Still some work to do on method naming, but this was the interesting part.
Also very much need to rename OkUrlFactory in tests to urlFactory, otherwise
the client.client stuff becomes madness.
2016-01-01 10:55:32 -05:00
jwilson
32fb79996c Change CookieJar to deal with Cookies, not Headers.
There's a big consequence to this for compatible with RFC 2965 Cookies. In particular,
this drops our ability to support 'Set-Cookie2' headers, and some features used there
including quoted attributes like 'Max-Age="25"'. This is the right move for interop with
browsers, and likely to make things better for application developers, but some
people who strictly followed the RFC 2965 spec will be broken. (That spec was never
seriously adopted anywhere, which is the entire motivation of RFC 6265.)

The upside is the CookieJar interface is now much more straightforward. This is
particularly good going forward, and for clients who don't have to worry about the
strangeness of things like $Version=1 in the RFC 2965 spec.
2015-12-30 19:28:13 -05:00
jwilson
c9334bd90f New CookieJar interface.
No good first-party implementation yet.

There is an implementation in okhttp-urlconnection that delegates to the java.net
CookieHandler. That should be good enough for AOSP.
2015-12-24 14:19:37 -05:00
jwilson
98ae0fb92c Sort imports and wrap documentation at 100 columns.
This is a mechanical refactoring. The only thing I had trouble with is IntelliJ's
weak support for <ul> tags in Javadoc.
2015-12-23 19:34:28 -05:00
jwilson
9061a10ec5 Add TlsVersion to the Handshake.
This is awkward because it adds another field to the cache. I've
decided to try to keep old values in the cache working. We will
probably do a change that'll disrupt the cache later, but that
is invasive and we don't need that yet.
2015-12-21 23:02:31 -05:00
jwilson
c9a89876de Rename com.squareup.okhttp to okhttp3
Maven group changes will come in follow up.
2015-12-16 01:34:59 -05:00
jwilson
f9776c4adf Drop Request.uri(). Just use Request.url().uri().
There's a mostly-academic corner case on URLs like http://host/%xx that
have a malformed escape sequence. This changes the exceptions on those
URLs from checked to unchecked.

I think we may want a separate change to HttpUrl to fix those URLs to
be encoded as http://host/%25xx which avoids the problem altogether.

Closes: https://github.com/square/okhttp/issues/2106
2015-12-15 21:31:02 -05:00
Jake Wharton
dcb3c14435 Remove IOException from source() and streams. 2015-12-15 00:05:34 -05:00
jwilson
8e4394c022 Use the cipher suite enum rather than the string. 2015-12-14 19:24:00 -05:00
Jake Wharton
93d547dcda Make HttpUrl the blessed URL method of Request. 2015-12-14 15:11:48 -05:00
jwilson
68e3fbb0a3 Fix some breaks calling obsolete APIs. 2015-12-13 22:39:30 -05:00
jwilson
4c90a2e04a Use HttpUrl internally. 2015-08-02 21:01:26 -04:00
jwilson
a560f72193 Expose internal APIs for pluggable file systems.
We aren't yet ready to make FileSystem a public type, but I don't mind
making it _almost_ available via an internal API for those brave enough
to try that.

Also migrate all of our tests to use the in memory file system. It's simpler.

https://github.com/square/okhttp/issues/1459
2015-08-01 11:56:40 -07:00
Jake Wharton
8f5e344aba Fold MockWebServerRule into MockWebServer.
This avoid needing to duplicate the methods on the rule which historically was a subset of everything.

JUnit is now a required dependency.
2015-07-24 14:05:59 -04:00
Neil Fuller
b7baf23d86 Fix for issue #1589: Vary caching on Android
Keep the embedded OkHttp on Android working with Vary headers:

Vary headers were broken with android.net.http.HttpResponseCache:
the OkHttp caching requires a networkResponse to check the vary
headers and it was not being provided, leading to a
NullPointerException. Further changes were needed to actually
retain the request headers needed for the vary check itself.

Support for other stacks using the RequestCache has been
dropped for requests that include Vary headers.

To avoid regressions the existing ResponseCacheTest has been
changed to use the real cache. Previously, the use of
InMemoryResponseCache was hiding the Vary problem.

The ResponseCacheTest is now run with an AndroidShimResponseCache
to prove the tests work with real cases. The case without the shim
is covered with the CacheTest. ResponseCacheTest has been updated
to include many tests from CacheTest that were missing.

Switching the test to a real cache revealed a problem in the
JavaApiConverter and bad headers, which has been fixed by
making Headers.Builder.addLenient(String, String) accessible.
2015-04-30 16:00:28 +01:00
jwilson
1abba290f5 Never convert null into an empty request body.
This is a behavior change.
2015-04-16 19:53:13 -04:00
Neil Fuller
bb47389d85 Make badly-behaving caches cause a checked exception, not NPE
Android bug: https://code.google.com/p/android/issues/detail?id=160522
2015-03-23 15:25:21 +00:00
jwilson
4db679b39e Send at most one condition.
Related to https://github.com/square/okhttp/issues/831
Closes: https://github.com/square/okhttp/issues/1354
2015-01-30 17:29:57 -05:00
Neil Fuller
3a65dcd37b Fix ResponseCache handling for Android usecases
Including the code in
okhttp-android-support/src/test/java/com/squareup/okhttp/android
provides easy verification of API or behavior changes that might
affect Android.

There are some small JavaApiConverter improvements.
2015-01-14 13:43:46 +00:00
Neil Fuller
c9b0262c40 Create a new maven artifact to hold things needed for Android embedding
okhttp-android-support contains classes needed for Android embedding and
not for normal OkHttp development. The classes here can be excluded from
okhttp-urlconnection, shrinking that artifact. More classes will be
added to this component to make Android maintenance easier.
2015-01-12 10:55:17 +00:00