1
0
mirror of https://github.com/square/okhttp.git synced 2025-11-23 06:42:24 +03:00
Commit Graph

513 Commits

Author SHA1 Message Date
Yuri Schimke
95cb15ab4d Disable javadoc (#8025) 2023-09-16 10:38:35 +01:00
Yuri Schimke
248b0e6318 Update Release version (#7792) 2023-05-01 11:27:57 +01:00
Yuri Schimke
f408411ff9 Avoid exposing internal methods (#7734) 2023-04-23 08:05:59 +01:00
Jesse Wilson
4d1f8add89 Confirm we send SNI server names on the JDK9 Platform (#7597)
This introduces a new API in MockWebServer's RecordedRequest to
capture the inbound server names.

Co-authored-by: Yuri Schimke <yuri@schimke.ee>
2023-01-04 07:59:45 +10:00
Jesse Wilson
ebb6e92d93 Use classes where appropriate in SocketPolicy (#7622)
* Use classes where appropriate in SocketPolicy

* Track API changes
2023-01-03 11:37:42 -05:00
Jesse Wilson
3ea6b81e5c Make SocketPolicy a sealed interface (#7610)
* Make SocketPolicy a sealed interface

* Dump APIs
2023-01-02 15:13:13 -05:00
Jesse Wilson
847b5af240 Avoid InetAddress.getCanonicalHostName(). (#7607)
Just hard-coding 'localhost' is simpler and avoids problems where
the host machine's IP address has additional DNS registrations.

Closes: https://github.com/square/okhttp/issues/7603
2023-01-02 09:04:37 -05:00
Jesse Wilson
a55e0090c9 Get rid of MwsDuplexAccess (#7608)
Its unnecessary now that we have a public API type for streams
2023-01-02 13:17:16 +10:00
Jesse Wilson
fe6db78647 Get more TLS stuff passing on BouncyCastle (#7602)
There's something up with ECDSA on BouncyCastle, and rather
than figuring it out I've just switched to RSA signatures
with that provider.
2022-12-31 20:39:55 -05:00
Jesse Wilson
34bb12533b Public API for duplex streams in MockWebServer (#7595)
* Public API for duplex streams in MockWebServer

I'm not 100% on the name 'Stream' for the source+sink pair. It's
tempting to use 'Socket', though I think that's an implementation name
and this is an abstraction that uses a different implementation.

I've chosen Stream specifically 'cause it's the word used in the
HTTP/2 spec. My biggest gripe with it is that it's bidirectional
in the HTTP/2 spec, but Java InputStream and OutputStream are not
bidirectional.

* Dump APIs for streams

* Don't include a Content-Length header for chunked bodies

* Convert MockWebServerTest to Kotlin (#7596)

* Rename .java to .kt

* Convert Java to Kotlin

* Null isn't special for last-write wins

* Attempt to make NonCompletingRequestBody less flaky
2022-12-31 13:24:52 -05:00
Jesse Wilson
c30d3ce7b7 Create MockResponseBody (#7593)
* Create MockResponseBody

We'd previously only ever used Buffer to model the type
of the MockResponse body. This has proven inadequate, particularly
for features like duplex responses.

Most of the complexity in this PR is changing how throttling
and disconnect-during-body work when we don't necessarily have
a Buffer for the response body.

This is a first step, more capability to follow.

* Update API

* We flush fewer times now

* Attempt to make a test less flaky

* Try harder to make the test less flaky
2022-12-31 14:47:55 +10:00
Jesse Wilson
d8159d499b Run all the tests in CI (#7592)
When we split jvmTest and jsTest, we lost the tests of JVM-only
modules.
2022-12-30 19:09:50 -05:00
Jesse Wilson
3ca2e64744 Clean up some Mockwebserver3 internals (#7582) 2022-12-29 06:27:59 +10:00
Jesse Wilson
fe15ccda5b Switch to a Builder for mockwebserver3.MockResponse (#7578)
* Switch to a Builder for mockwebserver3.MockResponse

* Migrate lots of tests to MockResponse.Builder

* Improve some code style

* Follow naming conventions in MockResponse.Builder

* Apply side-effects for inTunnel=true

* Update the API
2022-12-28 10:13:49 -05:00
Yuri Schimke
f27a291975 Add tests for multiple routes (#7563) 2022-12-24 10:26:45 +10:00
Yuri Schimke
58ee1ce170 Revert downgrade to 1.4 for gradle reasons (#7391)
* Revert "Downgrade to kotlin apiVersion 1.4 (#7267)"
* Revert "Improve runtime compatibility with kotlin 1.5.31 (#7343)"
* Revert "Remove usage of toDuration() (#7329)"
2022-07-25 17:57:09 +01:00
Jesse Wilson
e9a3ad3d94 4.10.0 is out 2022-06-12 10:09:53 -04:00
Jesse Wilson
afc7fa3700 Delete the unused tunnelProxy argument (#7317)
* Delete the unused tunnelProxy argument

* Update API spec
2022-06-09 13:14:05 -04:00
Jesse Wilson
fd6452596c Implement CONNECT tunnels for HTTP/2 prior knowledge (#7314)
* Implement CONNECT tunnels for HTTP/2 prior knowledge

Closes: https://github.com/square/okhttp/issues/7289

* Update the API spec for MockWebServer

* It is okay for HTTP/2 prior knowledge to send data early

Tests were failing due to an overly-pessimistic 'too much buffering'
exception. I moved the detector to where it's actually needed.
2022-06-08 13:55:16 -04:00
Yuri Schimke
6ad9fb12b6 Downgrade to kotlin apiVersion 1.4 (#7267)
* Test against kotlin 1.4

* Compile down to Kotlin 1.4

* Fix to use the invariant locale for lowercase

* Fix to use the invariant locale for lowercase
2022-06-08 10:44:30 -04:00
Jesse Wilson
0218c50da5 Change how tunnels are configured with MockWebServer (#7313)
This is the MockWebServer side of changing how HTTP/2 prior knowledge
works with proxies.

https://github.com/square/okhttp/issues/7289
2022-06-08 09:51:55 -04:00
Jesse Wilson
513a5435c0 Change how HTTP 1xx responses work in MockWebServer (#7169)
* Change how HTTP 1xx responses work in MockWebServer

Previously this was a SocketPolicy. With this change each
response may carry 0 or more informational responses which
are transmitted before the ultimate response.

* Add a test for multiple 1xx responses

* Update API
2022-03-19 20:17:50 -07:00
Jesse Wilson
9e039e9412 Don't interpret headers as trailers after a 100 response (#7168)
This only occurs when the response body is empty.

Closes: https://github.com/square/okhttp/issues/7167
2022-03-19 06:52:45 -07:00
Jesse Wilson
3e16ec28fe Adopt Kotlin's binary compatibility validator (#7112) 2022-02-26 14:17:33 -05:00
Yuri Schimke
362f53546d Adopt Version Catalog and Updates plugin (#7075) 2022-02-15 23:38:32 +00:00
Goooler
f5758b7f26 Enable Gradle's type-safe project accessors (#7069) 2022-02-08 20:01:28 +00:00
Yuri Schimke
bb8ecb9595 Test to verify half close behaviour (#7058) 2022-02-08 08:04:42 +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
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
Yuri Schimke
54d22eb7b4 Confirm proxied request url is correct. (#6932) 2021-12-01 07:21:50 -05:00
Goooler
8debc78b00 Simplify gradle kts (#6931) 2021-11-27 12:31:27 +00:00
Jesse Wilson
d9a65a85c5 Switch to Vanniktech for Maven publishing (#6929)
* Switch to Vanniktech for Maven publishing

Steal configuration from Okio, which already works nicely.

* Update mockwebserver-junit5/build.gradle.kts

Co-authored-by: Benoît Quenaudon <bquenaudon@squareup.com>

Co-authored-by: Benoît Quenaudon <bquenaudon@squareup.com>
2021-11-26 06:58:00 -05:00
Goooler
3417fd0e78 Update README files to 4.9.3 (#6927) 2021-11-24 09:34:33 -05:00
Jesse Wilson
35bb1740a4 Convert the main build.gradle file to KTS (#6925)
I attempted to do a literal translation as much as possible.
Subprojects now need plugins to be configured directly so they
can use the appropriate syntax.
2021-11-24 07:19:39 +00:00
Jesse Wilson
fc14f6fd2a Change how we get a hostname for RecordedRequest.requestUrl (#6919)
Previously we did a reverse DNS lookup. But the correct strategy
is to look at the inbound ':authority' (HTTP/2) or 'Host' (HTTP/1)
header.

See: https://github.com/square/okhttp/pull/6774
2021-11-21 09:30:22 -05:00
Jesse Wilson
a87f4b4585 Changelog for OkHttp 4.9.2 2021-09-30 21:13:35 -04:00
Goooler
e1af67f082 Declare types & Cleanup (#6842)
* Declare types

* Code cleanup

* Declare types
2021-08-30 23:32:43 -04:00
Goooler
f54b300ece Convert SAM (#6828) 2021-08-28 13:38:04 +01:00
Goooler
8e8c2a6037 Code cleanup (#6831) 2021-08-12 08:26:27 +01:00
Goooler
cc3ce11fc4 Code cleanup and imports (#6822) 2021-08-03 14:52:10 +03:00
Yuri Schimke
07b53d7498 Avoid variable timing of DNS causing flaky tests (#6774) 2021-07-30 09:29:54 +03:00
Goooler
b668b75f11 Replace deprecated methods (#6776) 2021-07-29 10:08:34 +03:00
Christian Brunotte
13604c9799 Added QueueDispatcher.clear() (#6736)
Co-authored-by: Christian Brunotte <christian.brunotte@obi.de>
2021-07-28 10:39:00 +03:00
Goooler
ef5d0c83f7 Update README files to 4.9.1 (#6617) 2021-04-10 07:42:40 +01:00
Yuri Schimke
b607bb0aa8 Partial move to gradle kotlin (#6532) 2021-02-06 14:57:47 +00:00
Yuri Schimke
083315a473 Launcher for quick tests (#6437) 2020-11-21 13:28:45 +00:00
Yuri Schimke
d1cf4944f2 Junit import fail (#6429)
* Missed some imports

* Missed some imports

* Missed some imports
2020-11-19 21:23:18 -05:00
Artem Gavrilov
dabbd56572 Update README.md (#6389) 2020-11-03 16:56:25 -05:00
Jesse Wilson
59ae0c138d Convert more tests to JUnit 5 (#6366) 2020-11-01 05:46:35 +00:00