1
0
mirror of https://github.com/square/okhttp.git synced 2026-01-14 07:22:20 +03:00
Commit Graph

5007 Commits

Author SHA1 Message Date
Jesse Wilson
35e4d40e1c Update FastFallbackExchangeFinder for split RealConnection 2022-02-08 23:01:10 -05:00
Jesse Wilson
639868a20d Move startHttp2() back to RealConnection 2022-02-08 20:54:26 -05:00
Jesse Wilson
034a16ac72 Move code from RealConnection to RealConnectPlan
Also promote RealConnectPlan to a top-level type, ConnectPlan.

Each RealConnection is now created only once its ready to be used
to carry exchanges. We do the actual connect work in ConnectPlan.
2022-02-07 23:34:32 -05:00
Jesse Wilson
f934da0e82 EquipPlan, a class to describe what happens between TLS and HTTP (#7055)
* EquipPlan, a class to describe what happens between TLS and HTTP

After a successful TCP socket is acquired we may need a CONNECT tunnel
and/or TLS handshake. I'm using the word 'equip' to mean 'equipping a TCP
socket with state to carry HTTP' though I'm not attached to this name.

This is a step towards splitting the TCP and equip phases so that happy
eyeballs can do TCP in parallel but equipping in serial order.

* Added tests for TLS fallback
2022-02-06 15:16:51 -05:00
Jesse Wilson
4b52e7a131 More docsite changes, split the 4.x changelog 2022-02-06 12:23:37 -05:00
Jesse Wilson
a8e0f46488 More deploy_website fixes 2022-02-06 11:58:16 -05:00
Jesse Wilson
ef034224af Fixup mkdocs build 2022-02-06 11:42:49 -05:00
Jesse Wilson
805470e1e6 Fixup some things with the updated website 2022-02-06 11:35:36 -05:00
Goooler
a15cad8560 Migrate cashapp.github.io (#7059) 2022-02-06 14:55:54 +00:00
Jesse Wilson
dc09abfc0b Revert hpack-test-case to the previous submodule version (#7056) 2022-02-06 06:30:02 +00:00
Andre_601
106c8d2d5c Improve OkHttp Docs (#6566)
* Improve OkHttp documentation

* Remove placeholder files

* remove site folder

* Create upgrading_to_okhttp_4.md

* Add redirects and fix paths

* add missing tls page to redirects

* Use custom SVG icons

* Update deploy_website.sh

* Push new changes.
2022-02-05 21:19:09 -05:00
Jesse Wilson
434b39db33 Prepare next development version. 2022-02-01 20:22:32 -05:00
Jesse Wilson
77a1460e73 Prepare for release 5.0.0-alpha.4. parent-5.0.0-alpha.4 2022-02-01 20:12:30 -05:00
Jesse Wilson
8f9222cd69 Tests for FastFallbackExchangeFinder (#7047)
* Tests for FastFallbackExchangeFinder

This needed more test facets in TaskFaker.

I'm pretty happy with how the tests read.

* More tests for FastFallbackExchangeFinder.
2022-02-01 16:14:44 -05:00
Jesse Wilson
19939f6707 Reorder IP addresses for Fast Fallback (#7048)
* Reorder IP addresses for Fast Fallback

* Shut down TaskFaker after each test

It now owns an ExecutorService that should be shut down.
2022-02-01 11:51:33 -05:00
Jesse Wilson
1a2245a1a6 Rewrite TaskFaker to permit mutiple stalled tasks (#7046)
In order to deterministically test FastFallbackExchangeFinder I need
a test facet that supports several test coordinating:
 - the call thread is waiting for either a connection to connect
   or for the next-connection timeout (250 ms) to elapse
 - the in-flight connection needs to connect

TaskFaker wasn't up to the task for this because it assumed at most
two threads, the test thread and the task thread.

With this change TaskFaker can coordinate multiple task threads
that each run sequentially, as directed by a test thread.
2022-01-31 15:46:51 -05:00
Yuri Schimke
8e87691210 First basic version of InetAddress ordering (#7040)
Avoid all complexities and interleaves, preferring IPv6.
2022-01-31 19:51:17 +00:00
Jesse Wilson
f15c81b4e9 HappyEyeballs (#7035)
This doesn't yet introduce any mechanism to enable or disable
happy eyeballs.

It also doesn't sort IP addresses to alternate IPv6, IPv4
for best success.

It also doesn't limit how many connections are attempted
simultaneously.

It also lacks an appropriate number of tests.
2022-01-28 11:11:05 -05:00
Jesse Wilson
d4b5c9eac8 Create TestValueFactory to reduce test case boilerplate (#7038)
This is bad because it moves test logic out of tests. But it's also
good because it lowers the cost of writing unit tests with common
types like RealConnection and Route.
2022-01-28 07:35:27 -05:00
Jesse Wilson
a193f304a6 Create a nice toString() for Route (#7037)
I'm going to use this to name threads when connecting via
Happy Eyeballs.
2022-01-27 08:02:32 -05:00
Jesse Wilson
500ba31ada Rename ExchangeFinder to RealRoutePlanner (#7033)
This introduces a new RoutePlanner interface that I'm intending
to use to make it possible to unit test all the interesting races
in happy eyeballs.

ExchangeFinder is the current sequential algorithm, and I think
I just need to create a new thing, HappyEyeballsExchangeFinder,
that implements a parallel search.

This commit is intended as a pure refactor with no behavior
changes.
2022-01-25 13:36:22 -05:00
Jesse Wilson
6d040e06c1 Move the connect failure recovery loop (#7031)
Previously we did all IOException recovery in RetryAndFollowUpInterceptor.
With this PR we move recovering from connect failures into ExchangeFinder.
This allows us to delete the RouteException class as it's no longer
necessary.

The user-visible consequence of this change is we now segregate
suppressed exceptions into TCP layer and HTTP layer.

This also introduces a new Plan sealed class to represent the
two different ways a connection is found: reuse and connect.
2022-01-23 10:25:53 -05:00
Yuri Schimke
e1d5d5f520 Cache control KMM completeness (#7027) 2022-01-23 13:38:45 +00:00
Jesse Wilson
9d464c3252 Move Connection.isHealthy() checks to where reuse happens (#7030)
One behavior change here is we won't fire connectionAcquired()
followed by connectionReleased() if we take an connection from the
pool only to immediately find it's unhealthy.

I'm working towards moving the loop over connect attempts and
fails from RetryAndFollowUpInterceptor and into ExchangeFinder.
(We'll still need some recovery in RetryAndFollowUpInterceptor,
but not connection recovery.)
2022-01-22 17:22:55 -05:00
Jesse Wilson
59b1dc7e7f Tidy up ExchangeFinder to split pooling and reuse logic (#7029)
Each exchange has 3 places for a connection
 - the connection on the call (from a previous redirect, auth challenge, etc.)
 - a connection from the pool
 - a fresh connection

We query the pool after each blocking step to give ourselves the maximum
chance or connection reuse.

This changes code structure without changing behavior.
2022-01-22 12:38:46 -05:00
Yuri Schimke
91f45ce409 Fix android test (#7018) 2022-01-22 12:05:32 +00:00
Yuri Schimke
b97eeacaa3 Log gzip request body size (#7013) 2022-01-17 08:15:43 +00:00
Jesse Wilson
14218871df Change OkHttpClient.routeDatabase to be internal (#7017)
This is the only behavior change in the PR. The rest is converting
a test from Java to Kotlin (so it can see this internal member) and
getting a TaskRunner instance into the ExchangeFinder, hopefully
useful for implementing Happy Eyeballs.

Also fix up some formatting problems.
2022-01-16 13:05:24 -05:00
Yuri Schimke
545ee480cb CacheControl time unit (#7002)
* Attempt at CacheControl time unit

* Review comments

* Review comments
2022-01-16 10:18:02 -05:00
Megatron King
9f488d0574 Support HTTP3 draft as h3-29 as an ALPN token (#7010)
* Support HTTP3 draft as h3-29 as an ALPN token

* Add the HTTP_3 protocol test case
2022-01-12 23:10:43 -05:00
Jesse Wilson
b9c2002ff6 Add an initial test for Happy Eyeballs (#7009)
https://github.com/square/okhttp/issues/506
2022-01-12 12:04:32 -05:00
Jesse Wilson
29f10378af Stringprep and Punycode (#7001) 2022-01-11 20:48:56 -05:00
Yuri Schimke
b8ebe99bb4 Fix indexing (#7003)
* Fix indexing

* Fix tests

* Fix tests
2022-01-09 16:17:22 -05:00
Yuri Schimke
aca02bf13c Headers multiplatform (#6996) 2022-01-09 19:08:18 +00:00
Yuri Schimke
43bc338e8b ResponseBody multiplatform (#6998) 2022-01-09 19:05:41 +00:00
Yuri Schimke
82725063c8 CacheControl MultiPlatform (#6999) 2022-01-09 17:30:39 +00:00
Yuri Schimke
2c654721c7 ResponseBodyTest moved to kotlin (#6997) 2022-01-09 15:12:23 +00:00
Megatron King
095567de96 Define protocol http3 for the third-part support (#7000) 2022-01-09 09:25:29 -05:00
Goooler
34d5cba5a8 Remove redundant UTF_8 params (#6994)
* Remove redundant UTF_8 params

* Simplify ByteArray to String

* Add MediaType?.charset
2022-01-09 00:25:31 -05:00
Goooler
ce289f54cb Reuse getCharsetAndFinalType as MediaType.chooseCharset (#6987) 2022-01-08 16:19:10 +00:00
Goooler
5cfc040daf Replace StandardCharsets with Charsets in Kotlin (#6986) 2022-01-08 16:17:43 +00:00
Yuri Schimke
3854af9174 Media Type Multiplatform. (#6985) 2022-01-08 15:55:16 +00:00
Jesse Wilson
c30d9ad14b Convert more tests to Kotlin (#6980) 2022-01-05 00:20:25 -05:00
Jesse Wilson
ab055862a4 Promote some util functions to commonMain (#6979)
Also migrate some tests that use these Util functions from Java to Kotlin.
If we're going to make OkHttp multiplatform, our tests need to be Kotlin
so we can run them on all supported platforms.
2022-01-03 16:41:53 -05:00
南宫雪珊
9b4b06f6cd Allow obfuscate PublicSuffixDatabase (#6974) 2022-01-03 18:06:08 +02:00
Yuri Schimke
c48f63b56e Move basic enum types to common and use expect/actual for IOException (#6966)
* Move basic enum types to common and use expect/actual for IOException

* Move basic enum types to common and use expect/actual for IOException

* Move basic enum types to common and use expect/actual for IOException

* Cleanup gradle
2022-01-03 10:24:58 -05:00
Jesse Wilson
b23158bb6b Use Kotlin's regex API in MediaType (#6962)
Preparing to promote this class to commonMain
2021-12-29 17:21:35 -05:00
Egor Andreevich
20d2fa4ffa Update docs to reference S01 Sonatype host (#6971) 2021-12-23 10:56:33 -05:00
Goooler
7aa4a061a6 Publish to S01 (#6970) 2021-12-22 16:23:49 -05:00
Tony Robalik
66a076a1db Use Gradle 7.3.2. Log4shell CI mitigation. (#6964)
Gradle 7.3.2 adds dependency constraints to the _build_ classpath to reject known-bad versions of log4j.
There is no log4j dependency in OkHttp for clients, but it's possible that some build plugins use log4j which could affect CI.

See also https://blog.gradle.org/log4j-vulnerability.
2021-12-17 18:42:17 +00:00