Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkgs/ok_http: DevTools Networking Support. #1242

Merged
merged 6 commits into from
Jun 24, 2024

Conversation

Anikate-De
Copy link
Contributor

Items in this PR:

  • Add profiling enabled/disabled test groups
  • Create Kotlin callback RedirectReceivedCallback to allow Dart code to operate on redirect responses (crucial for HTTP Profiling)
  • Create client_profile_test.dart (re-used from cronet_http)
  • Added necessary implementation in ok_http_client to support DevTools
  • Updated CHANGELOG.md

  • I’ve reviewed the contributor guide and applied the relevant portions to this PR.
Contribution guidelines:

Note that many Dart repos have a weekly cadence for reviewing PRs - please allow for some latency before initial review feedback.

* Allows Dart code to operate upon the intermediate redirect responses.
*/
interface RedirectReceivedCallback {
fun onRedirectReceived(response: Response, location: String)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a follow-up PR, would it make sense to migrate the redirect logic to Dart? Actually, would it make sense to make interceptors available in Dart?

Taking a step back, maybe you'd want to expose OkHttpClient or a wrapper around that to Dart?

With that users can control caching, connection pools, DNS, etc.

I'm not sure what the best way to do that is though.

Copy link
Contributor Author

@Anikate-De Anikate-De Jun 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

About migrating the redirection logic to Dart, there are issues with threading while implementing Interceptor.
Hossein and I have been trying to work our way around this issue, but so far, RedirectInterceptor stands out as an example.


About exposing configurations to users, I had planned to provide high-level functions (and constructor parameters) within OkHttpClient allowing users to tweak the client according to their requirements.

For example, if a user wants to alter the timeout for a request, they can either pass the timeout duration in the constructor or in the function:

class OkHttpClient extends BaseClient {
  late bindings.OkHttpClient _client;
  OkHttpClient([Duration? timeoutDuration]) {
    // creates a client based on the timeout and assigns it to _client
  }
  void setTimeout(Duration timeoutDuration) {
    // uses a new builder from `_client` and edits its timeout
  }

But yes, a wrapper sounds good! We can use the architecture that CronetEngine has.

@brianquinlan brianquinlan merged commit b7ec613 into dart-lang:master Jun 24, 2024
29 checks passed
copybara-service bot pushed a commit to dart-lang/sdk that referenced this pull request Jun 27, 2024
… source_span, stream_channel, term_glyph, tools, vector_math, watcher, webdev, yaml_edit

Revisions updated by `dart tools/rev_sdk_deps.dart`.

dartdoc (https://github.com/dart-lang/dartdoc/compare/88df88c..7e5da60):
  7e5da609  2024-06-26  Sam Rawlins  Simplify some end2end tests into smaller tests (dart-lang/dartdoc#3795)
  36f1fc74  2024-06-26  Sam Rawlins  Store comment reference data on ModelNode (dart-lang/dartdoc#3797)
  7ed6ef80  2024-06-24  Sam Rawlins  Hide constructors that cannot be called or referenced by user code (dart-lang/dartdoc#3796)

ecosystem (https://github.com/dart-lang/ecosystem/compare/31148cd..54ca01a):
  54ca01a  2024-06-25  Devon Carew  improvements for transferred issues (dart-lang/ecosystem#274)

html (https://github.com/dart-lang/html/compare/3bc803d..f6c2c71):
  f6c2c71  2024-06-24  Kevin Moore  update lints (dart-archive/html#249)

http (https://github.com/dart-lang/http/compare/4d8e7ef..bf96551):
  bf96551  2024-06-26  Nate Bosch  Call out more limitations of runWithClient (dart-lang/http#1248)
  eb189e1  2024-06-26  Brian Quinlan  [cupertino_http] Fix a bug where content-length was not set for multipart messages (dart-lang/http#1247)
  0bbd166  2024-06-25  Hossein Yousefi  [cronet_http] Upgrade jni and jnigen to 0.9.3 (dart-lang/http#1246)
  dce17c6  2024-06-24  Kevin Moore  misc: add missing packages to root readme (dart-lang/http#1245)
  0b40397  2024-06-24  Kevin Moore  update lints (dart-lang/http#1244)
  2971f32  2024-06-24  Kevin Moore  Update lints (dart-lang/http#1243)
  497bc15  2024-06-24  Parker Lougheed  Update various flutter.dev and dart.dev links (dart-lang/http#1238)
  5f6fcae  2024-06-24  Parker Lougheed  Fix some minor spelling and grammar mistakes (dart-lang/http#1239)
  b7ec613  2024-06-24  Anikate De  pkgs/ok_http: DevTools Networking Support. (dart-lang/http#1242)

json_rpc_2 (https://github.com/dart-lang/json_rpc_2/compare/5b1cbd6..616937f):
  616937f  2024-06-26  Kevin Moore  Update lints, test JS & Wasm (dart-archive/json_rpc_2#116)

mime (https://github.com/dart-lang/mime/compare/4ca2f5e..fd7010b):
  fd7010b  2024-06-24  Kevin Moore  bump lints (dart-archive/mime#127)
  99e9855  2024-06-24  Jonas Finnemann Jensen  Add `topics` to `pubspec.yaml` (dart-archive/mime#121)

mockito (https://github.com/dart-lang/mockito/compare/2302814..9deddcf):
  9deddcf  2024-06-25  Sam Rawlins  Fix lint in examples.
  e99ba54  2024-06-24  Sam Rawlins  Properly generate code for parameter default value Strings.

source_span (https://github.com/dart-lang/source_span/compare/59a3903..89520f3):
  89520f3  2024-06-24  Kevin Moore  bump lints (dart-lang/source_span#114)

stream_channel (https://github.com/dart-lang/stream_channel/compare/b41ff7a..dc620d2):
  dc620d2  2024-06-24  Kevin Moore  bump lints (dart-lang/stream_channel#108)

term_glyph (https://github.com/dart-lang/term_glyph/compare/c86e817..6c2a977):
  6c2a977  2024-06-24  Kevin Moore  bump lints (dart-lang/term_glyph#54)

tools (https://github.com/dart-lang/tools/compare/e660a68..4c60686):
  4c60686  2024-06-24  Christopher Fujino  delete old log file if it exceeds kMaxLogFileSize of 25MiB (dart-lang/tools#277)
  7a231e5  2024-06-24  Parker Lougheed  [unified_analytics] Add lints to consistently use final (dart-lang/tools#278)

vector_math (https://github.com/google/vector_math.dart/compare/e7b11a2..a4304d1):
  a4304d1  2024-06-24  Kevin Moore  Update and fix lints, require Dart 3.1 (google/vector_math.dart#328)
  253f69b  2024-06-24  Kevin Moore  blast_repo fixes (google/vector_math.dart#327)

watcher (https://github.com/dart-lang/watcher/compare/c00fc2a..f312f1f):
  f312f1f  2024-06-24  Kevin Moore  update lints (dart-lang/watcher#169)

webdev (https://github.com/dart-lang/webdev/compare/c566112..75417c0):
  75417c09  2024-06-26  Ben Konyi  Remove remaining MV2 logic (dart-lang/webdev#2453)

yaml_edit (https://github.com/dart-lang/yaml_edit/compare/08a146e..ad3292c):
  ad3292c  2024-06-27  Kavisi  Fix line folding (dart-lang/yaml_edit#87)

Change-Id: Ie2f914dcf97e10cc5a8501c926ddd7e254a0d151
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/373443
Auto-Submit: Devon Carew <devoncarew@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants