1
0
mirror of https://github.com/square/okhttp.git synced 2025-11-26 06:43:09 +03:00
Commit Graph

30 Commits

Author SHA1 Message Date
Yuri Schimke
1f93359f15 Run CircleCI with multiple platforms (#4864)
Run in CircleCI.
Also conditionally disables tests that show issues with Conscrypt/OkHttp (client auth etc).
2019-04-03 15:45:05 +01:00
Yuri Schimke
02914fbba1 Kotlin version of logging-interceptor (#4820) 2019-03-30 22:22:28 +00:00
Jesse Wilson
dedc6ecd5b Use more AssertJ features 2019-03-14 17:57:42 -04:00
Benoît Quenaudon
6c4855a7c7 Use AssertJ in tests (#4713) 2019-03-13 21:07:33 -04:00
Jesse Wilson
38eb03457c Don't log duplex request bodies
We may want to support these eventually but for now this is
unhelpful because they won't terminate.
2019-02-26 22:06:31 -05:00
Jesse Wilson
778e0334a4 Use lambdas where appropriate 2019-01-11 22:31:36 -05:00
Jesse Wilson
0dc50f1112 Run IntelliJ inspections on the codebase
Some nullability warnings, some diamond operators, adopting Objects.equals(),
and some dead code elimination.
2019-01-01 12:41:06 -05:00
Amir Livneh
1f7e796e6e Cleanup HttpLoggingInterceptor (#4346)
* Use try-with-resources

* Make bodyHasUnknownEncoding() static

* Fix nits in HttpLoggingInterceptorTest

* Revert "Use try-with-resources"

This reverts commit 57dcd61a9e.
2018-11-14 23:29:45 -05:00
Amir Livneh
ef34a41d09 Add a LoggingEventListener and use it in okcurl (#4353)
* Add LoggingEventListener and use it in okcurl

* Fix tests failing in IP6 environment

* Make less assumptions about test environment

* Disable retry in test to make test sequence more predictable

* Fix javadoc compilation

There seems to be inconsistency between javdoc parsing between 'mvn verify' and Travis CI. Before the change, 'mvn clean verify' passes but Travis CI fails due to missing import of okhttp3.OkHttpClient. Just adding the missing import, causes 'mvn verify' to fail die to unused import. Changing the line wrapping seems to appease 'mvn verify'.

* Address comments

* Remove unused imports
2018-11-13 21:58:22 -05:00
Amir Livneh
d2ddd4ef9d Support header redaction in HttpLoggingInterceptor (#4287)
Add redactHeader() method that allows clients to mark (case insensitive) headers carrying private data that can't be logged.
2018-09-24 19:44:56 +01:00
Jesse Wilson
37887141fe Rename TlsNode to HandshakeCertificates (#4141) 2018-07-12 06:39:20 +01:00
Jesse Wilson
b1bfe7130c New okhttp-tls module 2018-07-09 12:00:28 -04:00
Jesse Wilson
31c511f694 Rename SslClient to TlsNode and make it a public API
https://github.com/square/okhttp/issues/3934
2018-07-08 15:33:16 -04:00
Jake Wharton
36f4fd04f7 Add parse overload which fails on invalid inputs 2018-07-05 23:18:15 -04:00
Jesse Wilson
d0418379a7 Move MockWebServer's internal package to not collide with OkHttp's. (#3837)
Hoping this may prevent problems with the Java Platform Module System.
2018-02-09 06:20:57 +00:00
Matt Sheppard
bb304b9c2c Log gzipped bodies when HttpLoggingInterceptor is used as a NetworkInterceptor (#3792)
* (in-progress) Support gzipped bodies as a networkInterceptor

* Fixed buffer cloning, added test for a still-unsupported encoding (Brotli)

* Avoid try-with-resources and too-long lines to appease build checks

* Fixed method name typo

* Added suggested comma between byte and gzipped-byte count

* Account for added comma in test

* Use buffer.writeAll to ensure all body content is read

* Indentation consistency

* Added test to confirm response body remains valid
2018-01-28 11:33:00 -05:00
Jesse Wilson
207f5579d3 Omit the message from MockWebServer's HTTP/2 :status header (#3556)
This was a bug carried over from SPDY.

Closes: https://github.com/square/okhttp/issues/3484
2017-08-30 18:25:44 -04:00
Jesse Wilson
16f43b6439 Don't log a protocol when it is unknown. (#3558)
Closes: https://github.com/square/okhttp/issues/3395
2017-08-30 14:04:53 -04:00
jwilson
6651a9c15e Change MediaType's failure mode to not crash on charset problems.
As-is it throws unchecked exceptions on unexpected charsets. This is a problem
because it can cause a misbehaving webserver to crash the client.

I don't expect this to break existing clients; returning 'null' has always
been a possibility; it's just returned in more cases.
2017-01-29 13:46:30 -05:00
jwilson
8271dc0fb1 Fix HttpLoggingInterceptor to be cool with newlines.
Unfortunately our plaintext detector treats \r and \n as non-plaintext
characters, and they're completely fine.

Closes: https://github.com/square/okhttp/issues/2579
2016-05-28 10:49:31 -04:00
Andy Dennie
f1dea26fd6 update Logging Interceptor to log connection failures 2016-05-14 13:21:09 -04:00
jwilson
bab8943f2b Promote sent and received timestamps to fields on Response.
I'm currently keeping these as longs. That's easy an unambiguous, but it also
feels rather primitive.

This was more work than I expected, but it doesn't seem particularly risky.
It's also potentially more efficient, since there's fewer places where we're
converting from string to long and vice versa.

Closes: https://github.com/square/okhttp/issues/2035
2016-05-08 15:25:56 -04:00
Alex Wegener
e0c2795bae Log plain text bodies only 2016-03-03 21:55:25 -05:00
Dave Roberge
fc238a225d Handle UnsupportedCharsetException in HttpLoggingInterceptor 2016-01-16 15:32:09 -05:00
gkimbwala
c3f8dcb22e Add Framed protocol to connections 2016-01-15 17:58:03 -08:00
Jake Wharton
8ee07e13d3 Handle unknown content lengths. 2016-01-04 13:10:46 -05:00
jwilson
f2461183e8 Refactor towards an OkHttpClient.Builder.
Still some work to do on method naming, but this was the interesting part.
Also very much need to rename OkUrlFactory in tests to urlFactory, otherwise
the client.client stuff becomes madness.
2016-01-01 10:55:32 -05:00
jwilson
e6dd58a886 Drop the global static shared connection pool.
Instead each new instance of OkHttpClient gets its own connection pool by
default. This makes the OkHttpClient instances a little more heavyweight
(in that two different instances yield two different connection pools, which
means two different cleanup threads) but it also means there's less weird
state sharing between instances.

One drawback of this is that if an application wants to immediately free
resources from an OkHttpClient it must call getConnectionPool().evictAll(),
otherwise the connection pool thread will remain alive for 5 minutes.
2015-12-29 17:49:25 -05:00
jwilson
98ae0fb92c Sort imports and wrap documentation at 100 columns.
This is a mechanical refactoring. The only thing I had trouble with is IntelliJ's
weak support for <ul> tags in Javadoc.
2015-12-23 19:34:28 -05:00
jwilson
c9a89876de Rename com.squareup.okhttp to okhttp3
Maven group changes will come in follow up.
2015-12-16 01:34:59 -05:00