1
0
mirror of https://github.com/square/okhttp.git synced 2026-01-12 10:23:16 +03:00
Commit Graph

6122 Commits

Author SHA1 Message Date
Jesse Wilson
ef72228d27 Prepare for release 5.3.1. parent-5.3.1 2025-11-16 07:49:24 -06:00
Jesse Wilson
674716746b Update com.squareup.okio to v3.16.3 (#9197)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-11-16 07:47:31 -06:00
Jesse Wilson
0960b47ec2 Prepare for release 5.3.0. parent-5.3.0 2025-10-30 17:39:59 -04:00
Tobias Gesellchen
bfb24eb90b Support Request Bodies on HTTP1.1 Connection Upgrades (#9159)
* Read RequestBody before Connection Upgrade

* Be more strict on event lifecycle for upgrades (#9170)

Co-authored-by: Jesse Wilson <jwilson@squareup.com>

---------

Co-authored-by: Jesse Wilson <jesse@swank.ca>
Co-authored-by: Jesse Wilson <jwilson@squareup.com>
2025-10-30 14:46:58 +01:00
renovate[bot]
cf4a864395 Update Gradle to v9.2.0 (#9171)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-29 21:56:29 -04:00
renovate[bot]
4e7dbec1ea Update dependency com.puppycrawl.tools:checkstyle to v12.1.1 (#9169)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-26 11:00:10 -04:00
Jesse Wilson
0470853d72 Add tags to calls, including computable tags (#9168)
Originally I was planning on implementing tags on
Request only, but that design broke as soon as any
interceptor used Request.newBuilder() to create a
copy of the Request - the instance that received the
tags might not be the instance that needed them.

Instead I'm introducing this behavior on the Call
object, which behaves less like a value. I expect
that users' expected lifetimes of tags will work
naturally this way.

It is an API hazard that we have tags on both
Requests and Calls. Perhaps if given the opportunity
to do it over, I'd omit support for tags on Requests.

Co-authored-by: Jesse Wilson <jwilson@squareup.com>
2025-10-26 10:54:46 -04:00
Yuri Schimke
2b70b39827 Catch UnsatisfiedLinkError in AndroidLog (#9137)
* Catch UnsatisfiedLinkError in AndroidLog

Happens with Paparazzi. see https://github.com/square/okhttp/issues/9125

* Change Error catch to UnsatisfiedLinkError
2025-10-25 12:16:17 +01:00
renovate[bot]
35735556f4 Update dependency com.github.jnr:jnr-unixsocket to v0.38.24 (#9166)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-24 19:43:08 -04:00
renovate[bot]
af8cf3024a Update actions/upload-artifact action to v5 (#9167)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-24 19:36:41 -04:00
Jesse Wilson
478e99cf50 Build an computeIfAbsent() mechanism for tags (#9165)
The Tags type is still immutable, but an AtomicReference<Tag>
is mutable.
2025-10-24 07:37:46 -04:00
Jesse Wilson
d393c86817 Use Tags in okhttp3.Request (#9164) 2025-10-24 07:36:14 -04:00
Jesse Wilson
ca9f73e7b6 New datastructure to hold Tags (#9163)
* New datastructure to hold Tags

We have been using MutableMap and Map. These have worked
fine.

But we'd like to soon support mutating tags on an existing
Request object, which I'd like to do without a ton of
collections or concurrency overhead. Instead we can do some
lock-free stuff, which needs a simple data structure as a
starting point.

* Fill in some type parameters
2025-10-23 15:50:01 -04:00
renovate[bot]
fc41262525 Update kotlin monorepo to v2.2.21 (#9161)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-23 07:36:22 -04:00
renovate[bot]
31777fe35b Update dependency org.graalvm.nativeimage:svm to v25.0.1 (#9158)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-22 22:21:51 -04:00
renovate[bot]
5feb53f874 Update dependency com.google.devtools.ksp:symbol-processing-gradle-plugin to v2.3.0 (#9160)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-22 16:23:51 -04:00
renovate[bot]
b52c1c9e2e Update dependency com.puppycrawl.tools:checkstyle to v12.1.0 (#9157)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-19 13:58:28 -04:00
renovate[bot]
935c146b09 Update dependency org.graalvm.buildtools.native:org.graalvm.buildtools.native.gradle.plugin to v0.11.2 (#9153)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-16 14:55:10 +01:00
renovate[bot]
ed7fcd86bb Update com.squareup.okio to v3.16.2 (#9149)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-14 14:53:00 -04:00
renovate[bot]
5d2fd3145f Update dependency com.puppycrawl.tools:checkstyle to v12.0.1 (#9147)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-11 18:14:27 -04:00
renovate[bot]
3cc91af61e Update de.mannodermaus.junit5 to v1.9.0 (#9145)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-11 16:47:00 +01:00
renovate[bot]
bc81a338b2 Update dependency de.mannodermaus.gradle.plugins:android-junit5 to v1.14.0.0 (#9146)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-11 16:46:41 +01:00
Yuri Schimke
fdbbdbdb50 Resolve local.properties in a VS Code safe way (#9144) 2025-10-11 10:17:37 +01:00
Martin Bonnin
a480881021 Bump Gradle to 9.1.0 (#9114) 2025-10-11 10:02:42 +01:00
Yuri Schimke
43f54705ec Change allowedVersions for junit5 to '<5.14.0' 2025-10-11 09:35:05 +01:00
Yuri Schimke
0c133b9c97 revert some Renovate config (#9141)
* revert some Renovate config

* Fix formatting in renovate.json

* Update allowedVersions for junit5 to <=5.14.0
2025-10-11 09:03:14 +01:00
Yuri Schimke
b0186243f9 Update junit configuration in renovate.json (#9138)
* Update junit configuration in renovate.json

avoid major updates

* Add monorepo and recommended groups to Renovate config

* Remove groupName from junit-framework configuration

Removed groupName for junit-framework monorepo.

* Update Renovate config by removing ignored dependencies

Removed ignored dependencies from Renovate configuration.

* Update Renovate configuration to use junit5
2025-10-11 08:27:29 +01:00
Yuri Schimke
690d1df929 Make tests fail on UnsupportedOperationException (#9135)
* Make tests fail on UnsupportedOperationException

Will fail without the okio fix.

```
09:14:49.703  E  FATAL EXCEPTION: MockWebServer TaskRunner (Ask Gemini)
                 Process: okhttp.android.test.test, PID: 10087
                 java.lang.UnsupportedOperationException
                 	at javax.net.ssl.SSLSocket.shutdownOutput(SSLSocket.java:851)
                 	at okio.internal.DefaultSocket$SocketSink.close(DefaultSocket.kt:95)
                 	at okio.ForwardingSink.close(ForwardingSink.kt:37)
                 	at mockwebserver3.internal.MockWebServerSocket$sink$1.close(MockWebServerSocket.kt:69)
                 	at okio.RealBufferedSink.close(RealBufferedSink.kt:287)
                 	at okhttp3.internal.http2.Http2Writer.close(Http2Writer.kt:331)
                 	at okhttp3.internal.http2.Http2Connection.close$okhttp(Http2Connection.kt:474)
                 	at okhttp3.internal.http2.Http2Connection$ReaderRunnable.invoke(Http2Connection.kt:638)
                 	at okhttp3.internal.http2.Http2Connection$ReaderRunnable.invoke(Http2Connection.kt:619)
                 	at okhttp3.internal.concurrent.TaskQueue$execute$1.runOnce(TaskQueue.kt:112)
                 	at okhttp3.internal.concurrent.TaskRunner$runnable$1.run(TaskRunner.kt:81)
                 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
                 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
                 	at java.lang.Thread.run(Thread.java:818)
```

* cleanup
2025-10-10 11:26:44 +01:00
Yuri Schimke
d5b3f2c762 Fix SSL Handshake issue affecting MockWebserver on Android 24 (#9129)
* Fix SSL Handshake issue affecting MockWebserver on Android 24

Only called in MWS, but fails on API 24 when called. Adds a single Junit 4 test to run on Android 21-24.

Add a test since Junit 5 wasn't running on older devices.

* fix version number

* reformat

* reformat
2025-10-10 06:19:46 +01:00
Jesse Wilson
29bd9cda98 Fix Okio 3.16.1 link 2025-10-09 19:53:28 -04:00
renovate[bot]
2bc1d55ee6 Update com.squareup.okio to v3.16.1 (#9133)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-09 19:25:26 -04:00
Jesse Wilson
dad534a815 Put 5.2.1 in the changelog 2025-10-09 19:13:15 -04:00
Yuri Schimke
2f3491c0fb Run android tests on API 23 (#9128) 2025-10-09 22:15:26 +01:00
renovate[bot]
ce6c0a03b1 Update dependency com.puppycrawl.tools:checkstyle to v12 (#9127)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-09 16:00:44 -04:00
renovate[bot]
c04ea389ba Update dependency com.squareup.zstd:zstd-kmp-okio to v0.4.0 (#9096)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-09 07:52:46 -04:00
renovate[bot]
6f1a51666e Update dependency org.codehaus.mojo:animal-sniffer-annotations to v1.26 (#9124)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-09 00:46:04 -04:00
Jesse Wilson
0030b10a0b Flatten ConnectionUser (#9122)
There's only one implementation in use, and so I'm
inlining it to call through what it ultimately does.

My motivation is to avoid retaining a reference to an
EventListener anywhere, because that value is going
from immutable to mutable.

Co-authored-by: Jesse Wilson <jwilson@squareup.com>
2025-10-07 23:50:05 -04:00
renovate[bot]
3787f44778 Update dependency com.google.devtools.ksp:symbol-processing-gradle-plugin to v2.2.20-2.0.4 (#9121)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-10-07 18:22:46 -04:00
Jesse Wilson
b82f7abf0a Tear down AddressPolicy (#9120)
It's currently unused.

I'd like to bring this feature back soon, but using
regular Calls to make it happen rather than having
Connections created without a Call object. That should
avoid some special cases.

Co-authored-by: Jesse Wilson <jwilson@squareup.com>
2025-10-07 17:55:03 -04:00
Jesse Wilson
651d5669dc New function, EventListener.plus() (#9119)
Use this to support multiple EventListeners in the same
call.

Co-authored-by: Jesse Wilson <jwilson@squareup.com>
2025-10-07 17:03:04 -04:00
Jesse Wilson
81cfb68ac0 Fewer strings in EventListener asserts (#9118)
Co-authored-by: Jesse Wilson <jwilson@squareup.com>
2025-10-07 14:15:56 -04:00
Jesse Wilson
8eca8a834b Prepare next development version. 2025-10-07 11:47:40 -04:00
Jesse Wilson
2a95ed0873 Prepare for release 5.2.0. parent-5.2.0 2025-10-07 11:47:25 -04:00
Jesse Wilson
acfae325f0 Revert "Add minimal HttpLoggingInterceptor support for streaming request and responses. (#8993)" (#9115)
This reverts commit c998c2c57b.

Co-authored-by: Jesse Wilson <jwilson@squareup.com>
2025-10-07 11:15:46 -04:00
Jesse Wilson
d82e8750c4 Put Brotli and Gzip in top-level files (#9116)
This doesn't have any impact on compatibility.

Co-authored-by: Jesse Wilson <jwilson@squareup.com>
2025-10-07 11:15:28 -04:00
Tobias Gesellchen
d4a5be134e Fix RequestBody events on upgraded connections (#8970)
* Add SocketSink{Start,End} events

* Add SocketSource{Start,End} events

* Emit SocketSink/Source events

* Ensure same connection

* Chore

* Chore

* There and back again

* Update okhttp/src/commonJvmAndroid/kotlin/okhttp3/internal/connection/Exchange.kt

* Update okhttp/src/commonJvmAndroid/kotlin/okhttp3/internal/connection/Exchange.kt

---------

Co-authored-by: Jesse Wilson <jesse@swank.ca>
2025-10-07 10:17:39 -04:00
Martin Bonnin
112a19d5e4 Add RequestBody.sha256() (#9109)
* Add RequestBody.sha256()

* * SHA256 -> SHA-256
* Return ByteString, not String

* simplify test

* Move extension function to a regular class method

* Add @Throws(IOException::class)
2025-10-07 10:16:29 -04:00
Jesse Wilson
d41a755c7e Start publishing dispatcher queue events (#9111)
* Start publishing dispatcher queue events

* Update okhttp/src/commonJvmAndroid/kotlin/okhttp3/Dispatcher.kt

---------

Co-authored-by: Jesse Wilson <jwilson@squareup.com>
2025-10-07 10:16:22 -04:00
Jesse Wilson
c06ff312b2 Get Content-Type from the request body (#9113)
Co-authored-by: Jesse Wilson <jwilson@squareup.com>
2025-10-06 19:46:55 -04:00
Jesse Wilson
fdac86bb90 Make Request.toCurl work more like Chrome's 'copy as cURL' (#9112)
* Make Request.toCurl work more like Chrome's 'copy as cURL'

Changes:
 - single quotes
 - URL first
 - omit the default method

Also change binary detection to use isProbablyUtf8
instead, which is promoted to the main okhttp module.

Also replace the BinaryMode enum with a boolean to
optionally not include the body.

* More aggressive character escaping

---------

Co-authored-by: Jesse Wilson <jwilson@squareup.com>
2025-10-06 18:47:06 -04:00