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

4673 Commits

Author SHA1 Message Date
Jesse Wilson
fc6c29c4f9 Prepare for release 4.8.1. parent-4.8.1 2020-08-06 10:01:19 -04:00
Jesse Wilson
506e8405a2 Implement DER constraints on date formats (#6213)
The time zone must be 'Z', and cannot be an offset like '+0000'. That
is allowed by ASN.1 but not by DER.

Closes: https://github.com/square/okhttp/issues/6210
2020-08-06 09:31:43 -04:00
Jesse Wilson
a70e992c3f Prepare for release 4.8.0. parent-4.8.0 2020-07-11 14:01:06 -04:00
Jesse Wilson
cf367d9339 Add defensive checks for malformed ASN.1 DER (#6180)
If the date is before 1950-01-01, use a four-digit year

If the self-delimiting object identifer exceeds the enclosing object's
size, fail.

If a nested object exceeds its enclosing object's size, fail.
2020-07-11 10:38:11 -04:00
Jesse Wilson
0e0f3a2d8d Push OkHttp 3.14.x into the sea. It is no longer supported. (#6179)
OkHttp 4.x is our only branch receiving security fixes, bug fixes, and
new features.

OkHttp 3.12.x gets security fixes only.
2020-07-11 11:04:10 +01:00
Maciej Górski
7c9cfd6b28 Fix typo (#6178) 2020-07-10 08:48:21 -04:00
Jesse Wilson
4bfa33e09a Upgrade to Okio 2.7.0 (#6175) 2020-07-09 08:42:39 +01:00
Jesse Wilson
c4cbb57a46 Don't crash on unknown GeneralName types. (#6170)
We don't have API support for all of them, but we shouldn't crash when an
unsupported name is encountered.

Also encode attributes using UTF-8, not PrintableString. Both are permitted,
but UTF-8 supports more data.
2020-07-06 09:38:00 +01:00
Jesse Wilson
19e9a8ffd3 Drop support for indefinite length in DER (#6166)
This is a feature of ASN.1 that DER doesn't use, and in fact it forbids.
2020-07-05 08:12:29 +01:00
cketti
c04b57edac Add limits to what length values DerReader supports (#6164)
* Add limits to what length values DerReader supports

With this change DerReader doesn't support reading values with a length
greater than Long.MAX_VALUE. That shouldn't be a problem in practice.

* Make DerReader check length is encoded in shortest form possible

* Spotless and IntelliJ disagree on import order

Co-authored-by: Jesse Wilson <jesse@swank.ca>
2020-07-03 08:47:25 -04:00
Jesse Wilson
353a52b970 Improve code style for the new DER package (#6157)
Improve docs, fix some names, fix some internal APIs.
2020-06-30 06:14:49 +01:00
Jesse Wilson
45df82e15b Honor RFC 5280 when choosing a time format (#6154)
We switch to 4-digit years at the last possible moment.
2020-06-29 10:11:13 -04:00
Jesse Wilson
ca803de0d2 Stop using Bouncycastle to do PKCS8 to PKCS1 (#6153)
PKCS8 is a PrivateKeyInfo
PKCS1 is the private key field of a PKCS8

We need to do a simple unboxing to go from one to the other.
2020-06-28 14:38:22 -04:00
Jesse Wilson
8e78ed04ae Use OkHttp's certificate creation code (#6152)
We don't implement the full feature set that Bouncycastle has, but
we also don't need it.

In follow up changes I intend to remove the Bouncycastle dependency
for everything but some test cases.
2020-06-28 11:47:56 -04:00
Jesse Wilson
c3d453c1b9 Fix bugs so we can roundtrip certificates (#6151)
This gets us to the point where the byte-for-byte encoding is equiavalent
to what bouncycastle was producing.

This shook out some bugs:
 - We weren't boxing the version
 - We weren't clearing the constructed bit on boxed extensions
 - We weren't encoding null when we needed to be
2020-06-28 08:02:31 +01:00
Jesse Wilson
6e212cd7f5 Move tag management in DerAdapters (#6148)
Previously the caller was responsible for decoding the tag on the
adapter it called. This was easy for basic tags, but proved problematic
for tags like CHOICE and ANY and typehint-dependent tags, because the
caller didn't have enough information.

This moves the tag reading and writing into the DerAdapter itself. If
it encounters a tag it can't understand, it assumes it's own value has
been skipped and returns a default.

This turns out to be a bit easier to reason about, and hopefully will
make it easier to implement AlgorithmIdentifier.parameters, which has
values that are optional or not depending on what the type hint is.
2020-06-27 14:50:52 -04:00
Jesse Wilson
e90b33d686 Document common security issues on older Android devices (#6150)
This is ychimke's update, just moved to another file and copy-edited to cover
both Android and JVM handshakes.
2020-06-27 14:12:50 -04:00
Jesse Wilson
70f12ff56f Limited support for decoding extensions (#6145) 2020-06-25 18:51:26 -04:00
Jesse Wilson
e736f927f8 DER encoder (#6139)
I haven't yet implemented certificate encoding
2020-06-25 07:17:29 -04:00
PY
936a3cd77b Update FileOperator.kt (#6141)
Update FileOperator.read doc typo
2020-06-22 13:48:28 -04:00
Jesse Wilson
653a446092 Early implementation of an ASN.1 DER decoder (#6135)
* Early implementation of an ASN.1 DER decoder

My goal is to finish the implementation to support an ASN.1 DER encoder
and then to change okhttp-tls to no longer depend on BouncyCastle.

* Update okhttp-tls/src/main/kotlin/okhttp3/tls/internal/der/DerReader.kt

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

Co-authored-by: Benoît Quenaudon <bquenaudon@squareup.com>
2020-06-20 20:33:59 -04:00
Yuri Schimke
93b5a1af75 Fix openjsse CI (#6127)
Revert to docket image with Java 8 available.
2020-06-17 08:25:56 +01:00
Yuri Schimke
c7bd25ff21 Yubikey sample (#6120) 2020-06-10 22:03:20 -04:00
Jesse Wilson
a06606eb32 Merge branch 'jwilson.0610.defer_conscrypt'
* jwilson.0610.defer_conscrypt:
  Another layer of indirection to defer Conscrypt init (#6066)
2020-06-10 22:02:48 -04:00
Yuri Schimke
d8f02f4efe Another layer of indirection to defer Conscrypt init (#6066) 2020-06-10 22:01:51 -04:00
Yuri Schimke
dad673f7bc Test client auth failure events (#6117) 2020-06-10 21:58:31 -04:00
Yuri Schimke
665b6a7f41 Dependency upgrades (#6114) 2020-06-10 21:58:14 -04:00
Yuri Schimke
3a5f3620d8 Allow for domain name trailing dot in PublicSuffixDatabase (#6111) 2020-06-10 21:58:07 -04:00
Jesse Wilson
b086b8d183 Merge pull request #6104 from yschimke/avoid_bouncy_cancels
Avoid BouncyCastle failures
2020-06-01 22:23:05 -04:00
Yuri Schimke
e5c8461dbf Clarify Interceptor timeout docs (#6102) 2020-06-01 07:56:32 +01:00
Yuri Schimke
cfbca0e311 Simplify running the wireshark demo (#6101)
* Simplify running the wireshark demo

* Better filtering

* Cleanup

* Comments
2020-05-31 15:38:02 -04:00
Yuri Schimke
041562ba28 Avoid BouncyCastle failures 2020-05-31 17:09:44 +01:00
Jesse Wilson
930a8aeee2 Add limited locking around the end of the call (#6095)
This is mostly necessary because we have a possibility of duplex
calls.
2020-05-29 08:27:58 +01:00
Yuri Schimke
72227dfb7a Wireshark Testing sample (#6060) 2020-05-29 08:16:56 +01:00
Yuri Schimke
488de3f6d1 Fix for conscrypt error parsing certificates (#6098)
Fails with a runtime exception on bad input.
2020-05-29 08:01:30 +01:00
Yuri Schimke
dd4cb0298a Simplify Android debug logging docs (#6097) 2020-05-29 07:57:58 +01:00
Yuri Schimke
631991d655 Fix null package name in AndroidLog after proguard (#6094) 2020-05-28 06:52:59 +01:00
Jesse Wilson
816d9b5de1 Merge pull request #6093 from square/jwilson.0526.tighten_release
Tidy up the code that does connection releasing in RealCall
2020-05-27 07:20:54 -04:00
Jesse Wilson
1f2be97499 Tidy up the code that does connection releasing in RealCall
Recent refactorings have made it clear that there's three things
we need to be done before we can release the connection:
 - the request body
 - the response body
 - the series of exchanges

This changes the code to invert these booleans. In a follow-up I'd
like to add some defensive code around duplex calls where the request
and response body could race when they close.
2020-05-26 22:50:42 -04:00
Jesse Wilson
fdb167732f Merge pull request #6089 from square/jwilson.0523.concurrency_benchmarks
Use finer-grained locks in the connection pool
2020-05-25 21:01:05 -04:00
Yuri Schimke
274eeae1a6 Make unexpected frame message clearer (#6090)
Logs the failing frame during HTTP/2 setup and provides a clearer exception message.
2020-05-25 14:26:51 +01:00
Yuri Schimke
fac562b356 Handle tests that try to log via MockWebServer (#6072)
* Handle tests that try to log via MockWebServer

* Comments
2020-05-25 09:23:49 -04:00
Jesse Wilson
bafad8c998 Use finer-grained locks in the connection pool
Previously we were locking the RealConnectionPool for all
connection-related state, including cancelation.

This changes the locks to be per-Connection, leaning heavily
on thread-confined fields in RealCall, Exchange, and
ExchangeFinder.
2020-05-24 23:20:40 -04:00
Nguyễn Triết Khang
cfdeb570c2 Fix BrotliInterceptor failing to handle No content response (#6075)
* Brotli: add test case skip uncompress "No content" response

* BrotliInterceptor: skip uncompress if response has empty body
2020-05-20 21:55:31 -04:00
Jesse Wilson
56d2f4ab9d Prepare next development version. 2020-05-20 09:06:54 -04:00
Jesse Wilson
4c595553fb Prepare for release 4.7.2. parent-4.7.2 2020-05-20 09:06:47 -04:00
Jesse Wilson
b733d293cd Merge pull request #6073 from yschimke/android_init_ordering
Fix Android Platform init
2020-05-20 08:35:43 -04:00
Yuri Schimke
1d183cb001 Fix Android init ordering 2020-05-20 07:24:34 +01:00
Jesse Wilson
9c173d2ad3 Merge pull request #6071 from yschimke/android_tests_safe_on_23
Make the Android tests pass on <= 23
2020-05-19 19:19:02 -04:00
Yuri Schimke
d1490698a3 Make the Android tests pass on <= 23 2020-05-19 18:41:09 +01:00