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

Issues with http2_adapter in dio causing HTTP/1.1 requests to fail and incorrect traffic type displayed in Flutter DevTools #2341

Open
TheWalkingDead1024 opened this issue Dec 10, 2024 · 1 comment
Labels
h: need more info Further information is requested h: need triage This issue needs to be categorized s: bug Something isn't working

Comments

@TheWalkingDead1024
Copy link

TheWalkingDead1024 commented Dec 10, 2024

Package

dio

Version

5.7.0

Operating-System

Android

Adapter

Http2Adapter

Output of flutter doctor -v

[✓] Flutter (Channel stable, 3.19.0, on macOS 14.5 23F79 darwin-arm64, locale zh-Hans-CN)
    • Flutter version 3.19.0 on channel stable at /Users/luhaobo/fvm/versions/3.19.0
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision bae5e49bc2 (10 months ago), 2024-02-13 17:46:18 -0800
    • Engine revision 04817c99c9
    • Dart version 3.3.0
    • DevTools version 2.31.1
    • Pub download mirror https://pub.flutter-io.cn
    • Flutter download mirror https://storage.flutter-io.cn

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/luhaobo/Library/Android/sdk/
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = /Users/luhaobo/Library/Android/sdk/
    • Java binary at: /Users/luhaobo/Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
    • Xcode at /Applications/Xcode 15.4.app/Contents/Developer
    • Build 15F31d
    • CocoaPods version 1.16.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2024.1)
    • Android Studio at /Users/luhaobo/Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)

[✓] VS Code (version 1.95.3)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.102.0

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-arm64   • macOS 14.5 23F79 darwin-arm64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 131.0.6778.109
    ! Error: Browsing on the local area network for iPhone. Ensure the device is unlocked and attached with a cable or associated with the same local area
      network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)
    ! Error: Browsing on the local area network for iPhone. Ensure the device is unlocked and attached with a cable or associated with the same local area
      network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)
    ! Error: Browsing on the local area network for 鲁好波 iPhone 13 Pro (2700). Ensure the device is unlocked and attached with a cable or associated with
      the same local area network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)
    ! Error: Browsing on the local area network for 鸣人的iPhone. Ensure the device is unlocked and attached with a cable or associated with the same local
      area network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)

[✓] Network resources
    • All expected network resources are available.

• No issues found!

Dart Version

3.3.0

Steps to Reproduce

  1. Set up dio with http2_adapter as follows:
   final dio = Dio();
   dio.httpClientAdapter = Http2Adapter(
     ConnectionManager(
       idleTimeout: 10000,
     ),
   );
  1. Perform a HTTP/1.1 request using dio.
  2. Perform a HTTP/2 request using dio.
  3. Observe the traffic type in Flutter DevTools.

Expected Result

HTTP/1.1 requests should be handled correctly without failing, and the network traffic should be appropriately categorized and displayed in Flutter DevTools.

Actual Result

HTTP/1.1 requests fail when using http2_adapter, and the network traffic is incorrectly displayed as WebSocket traffic in Flutter DevTools.
a0ed2302-0158-4692-bd16-30b1d2402aac

@TheWalkingDead1024 TheWalkingDead1024 added h: need triage This issue needs to be categorized s: bug Something isn't working labels Dec 10, 2024
@AlexV525
Copy link
Member

Please provide a minimal reproducible example. We have a test to make sure that the adapter works with non-TLS requests and HTTP/1.x responses.

@AlexV525 AlexV525 added the h: need more info Further information is requested label Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
h: need more info Further information is requested h: need triage This issue needs to be categorized s: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants