1
0
mirror of https://github.com/square/okhttp.git synced 2025-08-11 22:02:43 +03:00
Commit Graph

15 Commits

Author SHA1 Message Date
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