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

456 Commits

Author SHA1 Message Date
Jesse Wilson
4c595553fb Prepare for release 4.7.2. 2020-05-20 09:06:47 -04:00
Jesse Wilson
186ec88aff Prepare for release 4.7.1. 2020-05-18 17:46:48 -04:00
Jesse Wilson
ef7c5f358e Prepare for release 4.7.0. 2020-05-17 13:52:53 -04:00
Jesse Wilson
0deadd5611 Prepare for release 4.6.0. 2020-04-29 00:52:51 -04:00
Yuri Schimke
d9c8fbf3b2 Confirm MockWebServer shutdown is idempotent (#5946) 2020-04-13 06:49:58 +01:00
Yuri Schimke
86b7ba5f2a Enable BouncyCastle on Android and add some testing (#5936) 2020-04-11 17:35:27 +01:00
Yuri Schimke
19771365f2 Rename to src/main/kotlin (#5938)
Follows the default path logic for kotlin classes.
2020-04-11 17:15:25 +01:00
Jesse Wilson
ca0c8d6a1a Prepare for release 4.5.0. 2020-04-06 10:54:10 -04:00
Jesse Wilson
10d5e69cd1 Get compression working in RealWebSocketTest
The only thing left is to negotiate extensions, including failing the
call if the server returns unexpected extensions.
2020-03-15 10:16:44 -04:00
Yuri Schimke
21029f48ce Switch Http2Connection to daemon for clients (#5834)
Allow for container usage where libraries/plugins may use OkHttp internally and it's not clear who cleans up.  This brings HTTP/2 inline with the daemon only behaviour of HTTP/1.1.
2020-03-02 19:35:05 +00:00
Jesse Wilson
44124ba2a3 Prepare for release 4.4.0. 2020-02-17 17:51:22 -05:00
Liam Newman
78016071b3 Add a windows executor to the build (#5769)
* Add a windows executor to the build

* Disable failing tests on windows

* Workaround find limitations
2020-02-05 21:09:37 -05:00
Jesse Wilson
e6cefb7a4d Switch to Gradle's Maven Publishing Plugin
This removes a bunch of low-value stuff from the pom.xml files:

 - name
 - description
 - licence distribution ('repo')
 - developers clause
 - test dependencies

I don't think any of this will be missed, and it shrinks the pom.xml
file to the minimal set of useful stuff.

This also causes us to publish a gradle .module file. This is the
motivation for this change. It'll allow us to ship a Gradle platform,
which is a more capable than a Maven BOM.
2020-01-19 21:44:55 -05:00
Jesse Wilson
c1d50e371f Upgrade Okio and some build dependencies
The new ktlint sorts imports which makes this diff large.

The new japicmp ignores 'final' modifier changes in final classes.

We adopt the Google style for checkstyle.xml.

Okio readByteString() now uses segments more aggressively, so we
need to mitigate that to avoid tracking those segments in a test.
2020-01-11 22:24:12 -05:00
Jesse Wilson
fd0919cfa4 OkHttp 4.3.1 is released 2020-01-07 13:44:16 -05:00
Yuri Schimke
15339353c1 Set hostname on Android 5.0 (#5702)
* Set hostname on Android 5.0

Android 5.0 requires explicit call to set the hostname.

* Fix test

* Fix
2020-01-06 21:54:52 -05:00
Yuri Schimke
328be6e739 Reduce logging in MockWebServer (#5696) 2020-01-05 07:51:05 +00:00
Jesse Wilson
b63debd827 Prepare for release 4.3.0. 2019-12-31 16:39:08 -05:00
Jesse Wilson
a2c06073b1 Un-deprecate some setters for chaining from Java
Closes: https://github.com/square/okhttp/issues/5199
2019-12-31 15:23:14 -05:00
Jesse Wilson
edb5865b4c Fix crash on repeated MockWebServer shutdown
The problem was the awaitIdle() call was scheduling executor jobs after
the ExecutorService had been shut down. This fixes that and defends
against other races.
2019-12-30 23:34:42 -05:00
Jesse Wilson
53d2d794b9 Defer EventListener events until bytes are returned
This changes the timing of responseHeaderStart and responseBodyStart events to
fire when bytes are received from the server. This is a non-trivial behavior
change and should be documented as such in the release notes. In particular,
the responseFailed event may be fired without a preceding responseHeadersStart
event.

To test this I've added a timestamp to our CallEvent test facet.

Closes: https://github.com/square/okhttp/issues/5578
2019-12-30 13:11:17 -05:00
Jesse Wilson
045062492b Failing test for NO_ERROR stream reset
It turns out it'll be a bit difficult to fix this because we don't
currently support reading the response stream after an error.

https://github.com/square/okhttp/issues/4964
2019-12-24 09:02:19 -08:00
Yuri Schimke
0b6c0d25d0 ErrorProne cleanup of two modules (#5640)
* Fix

* Fix 2
2019-12-08 19:49:27 -05:00
Jesse Wilson
b5efb41a63 Degrade connections after a timeout
This is based roughly on the 'Degraded Connections' proposal here
https://github.com/square/okhttp/issues/3146#issuecomment-471196032

I'm using 1000 ms instead of 500 ms. That's about the cost of a (slow)
TLS handshake, which is what callers would need to do if we degrade
unnecessarily.
2019-12-08 15:55:28 -05:00
Jesse Wilson
d26bfcaacd Don't use daemon threads in MockWebServer
This was a regression introduced with the TaskRunner changes.
I couldn't find other places where daemon threads were likely
to cause potential problems.

https://github.com/square/okhttp/issues/5512
2019-12-07 13:26:22 -05:00
Jesse Wilson
0a691dcadb Make all TaskRunner tasks cancelable
This probably should have been the case all along. Unfortunately,
ExecutorService Runnables are not cancelable by default, and that's
where we started.

After implementing all of TaskRunner it looks like where we're
cancelable and where we aren't is totally arbitrary. Making everything
cancelable simplifies the implementation and model.

The last remaining non-cancelable tasks:
 * awaitIdle() which we use in our tests only.
 * MockWebServer, where canceling would leak sockets
2019-10-06 20:12:25 -04:00
Jesse Wilson
620be4c97b Use TaskRunner in MockWebServer
The utility here is negligible. We're sharing threads between HTTP,
HTTP/2 and web sockets now.
2019-10-06 16:08:34 -04:00
Jesse Wilson
4ec26dcfab Be more consistent with task names
Examples:
  - OkHttp TaskRunner
  - MockWebServer TaskRunner
  - OkHttp ConnectionPool
  - MockWebServer localhost applyAndAckSettings
  - OkHttp android.com applyAndAckSettings
  - OkHttp android.com onSettings
  - OkHttp awaitIdle
  - OkHttp localhost

I'm trying to use type names where appropriate, or method names otherwise.
Names include hostname and stream name if the task is working on behalf
of a specific stream or connection.
2019-10-06 10:16:03 -04:00
Jesse Wilson
ef4b5ec348 Change TaskRunner to limit context switches.
Now we don't have to alternate between the coordinator thread and the task
thread between task runs if the task returns 0. Instead the task thread can
stay resident.

This implementation works by having task runnables that can switch from
the coordinator role (sleeping until the next task starts) and the executor
role.

https://github.com/square/okhttp/issues/5512
2019-10-05 23:14:30 -04:00
Jesse Wilson
5917d7a083 Add a way for MockWebServer to track truncated requests
It now tracks inbound requests that fail with an IOException.

Also add a fix for the bug where we'd send 'END OF STREAM' on a stream
that we'd previously canceled, which raced with the 'RST STREAM' and led
to flakiness.

Before we ship the new API in RecordedRequest we should go over the
other cases where inbound HTTP requests fail and make sure they
get reported through this channel.

Closes: https://github.com/square/okhttp/issues/5388
2019-10-05 21:50:00 -04:00
Jesse Wilson
aad8a1420d Name tasks only in TaskRunner (#5526)
* Name tasks only in TaskRunner

Naming queues seemed good initially, but the names are mostly
mutually-redundant with task names.

This PR reduces debug information when a queue is still busy
when the test completes. I have a fix for that in a follow-up
change.

* Update okhttp/src/main/java/okhttp3/internal/ws/RealWebSocket.kt

Co-Authored-By: Yuri Schimke <yuri@schimke.ee>
2019-10-02 22:38:24 -04:00
Jesse Wilson
20fcc7d330 Update changelog for 4.2.1. 2019-10-02 08:26:28 -04:00
Jesse Wilson
699db0522e Merge pull request #5510 from square/jwilson.0928.task_runner_websockets
Use TaskRunner in web sockets.
2019-09-29 10:37:47 -04:00
Jesse Wilson
ceb5ae4913 Use TaskRunner in web sockets.
The most consequential change here is that the background thread is
now a daemon thread. A program consisting of exactly one web socket
will exit when the reader reads an inbound close message. Previously
such a program would continue running until the writer acknowledged
this close.
2019-09-29 10:10:44 -04:00
Yuri Schimke
16173e2af9 Make Platform.log exception parameter optional (#5482)
Make Platform.log exception parameters optional, and reorders to allow level defaulting to INFO.
2019-09-29 16:59:58 +10:00
Jesse Wilson
fe40324a4b TaskRunner support for shutting down queues
Shutting down queues makes it easier to implement HTTP/2
shutdown because we can enqueue everywhere and centralize
the logic that decides whether we're shutdown or not.

Use this new functionality to implement HTTP/2 on task queues.
It's mostly a drop-in replacement, though opting-into cancel
looks like a mistake when it's what we do most of the time.

When testing this the OkHttpClientTestRule was failing because
tasks were incomplete. I was puzzled by this until I realized
that the OkHttpClientTestRule performs that validation before
we stop the MockWebServer. I changed MockWebServer to have its
own TaskRunner and that made the problem go away.
2019-09-26 21:12:40 -04:00
Yuri Schimke
a41361efcb Compile against JDK11 API, run tests down to JDK8 (#5429)
Avoids most reflection usage on Jdk9+ and Android Q+.  Builds against JDK11, but tests down to Jdk8.
2019-09-21 21:42:40 +01:00
Yuri Schimke
f33b15e43d Kotlin toInt usage 2019-09-19 08:10:13 +01:00
Jesse Wilson
582f8ef2f7 Prepare for release 4.2.0. 2019-09-10 13:04:12 -04:00
Jesse Wilson
1b97ce67e9 Update the changelog for 4.1.1. 2019-09-05 00:30:48 -04:00
Jesse Wilson
4739b27806 Prepare for release 4.1.0. 2019-08-12 13:00:00 -04:00
Yuri Schimke
24c7d54ecb Handle localhost as ipv6 without bracket quoting (#5297)
* Handle ipv6 hostnames without bracket quoting

* simplify

* Add ipv4 localhost test

* Update RecordedRequest.kt
2019-07-23 23:15:53 -04:00
Yuri Schimke
6903b89e0b Cleanup of error prone and warnings (#5268)
* Comment some warnings

* Wrap

* Disable warnings
2019-07-15 21:11:35 -04:00
Jesse Wilson
7292e54a63 Update the changelog for OkHttp 4.0.1 2019-07-10 11:40:44 -04:00
Jesse Wilson
911c5bf5b2 Prepare for release 4.0.0. 2019-06-26 19:30:33 -07:00
Yuri Schimke
321791908a Allow nullable on Util.close (#5224)
Enforce null check in java with any mutable nullable closable
2019-06-25 07:24:40 +01:00
Jesse Wilson
50e4c422d2 Move the API docs from /okhttp/api to /okhttp/4.x 2019-06-21 23:23:46 -04:00
Masaru Nomura
966dd3e3bb Change return type of MockWebServer#takeRequest(...) to nullable to maintain backward compatibility in OkHttp4.0
Previously in OkHttp3, takeRequest(...) returns RecordedRequest?.
ref. [takeRequest(timeout: Long, unit: TimeUnit) in 3.14.2](https://github.com/square/okhttp/blob/parent-3.14.2/mockwebserver/src/main/java/okhttp3/mockwebserver/MockWebServer.java#L308)
2019-06-21 01:16:02 -04:00
Jesse Wilson
70cd67c75d Tweak the MkDocs build
Retain the 3.x docs by doing a dirty MkDocs build
Build more Dokka projects
2019-06-20 00:01:47 -04:00
Jesse Wilson
20cd3a0893 Increase severity of bridge methods to ERROR. (#5160)
Delete the KotlinSourceCompatibilityTest. It has served its purpose.
2019-06-03 06:38:19 +01:00