Giter VIP home page Giter VIP logo

http2_client's People

Contributors

thosakwe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

http2_client's Issues

The http/2 connection is no longer active and can therefore not be used to make new streams

If a client is re-used this error eventually occurs:

Bad state: The http/2 connection is no longer active and can therefore not be used to make new streams.
#0      ClientConnection.makeRequest (package:http2/src/connection.dart:465:7)
#1      Http2Client._send.<anonymous closure> (package:http2_client/http2_client.dart:126:32)
<asynchronous suspension>
...

Presumably the server eventually closed the keep-alive connection and this wasn't handled gracefully.

Query parameters cannot be carried

my code:

var response = await client.get('https://example.com/articles?abc=123&def=456');

http2_client.dart,Lines 117

The result printed by parameter "path" is wrong

It does not carry query parameters
`
print(':path:${request.url.path}');// output: /articles

    var headers = [
      Header.ascii(':authority', request.url.authority),
      Header.ascii(':method', request.method),
      Header.ascii(':path', request.url.path),
      Header.ascii(':scheme', request.url.scheme),
    ];

`

The correct result should be /articles?abc=123&def=456

Connection error: Connection is being forcefully terminated. (errorCode: 10)

When doing Get requests is get this error:
Connection error: Connection is being forcefully terminated. (errorCode: 10)

Which occurs in http2_client.dart here:
http2Crash

My client looks like this:

  final String _authString;

  AuthClient(
    username,
    password, {
    BaseClient http1Client,
    bool autoUncompress = true,
    bool maintainOpenConnections = true,
    int maxOpenConnections = -1,
    Function onBadCertificate,
    SecurityContext context,
    Duration timeout,
  })  : _authString = _getAuthString(username, password),
        super(
          http1Client: http1Client,
          autoUncompress: autoUncompress,
          maintainOpenConnections: maintainOpenConnections,
          maxOpenConnections: maxOpenConnections,
          onBadCertificate: onBadCertificate,
          context: context,
          timeout: const Duration(seconds: 60),
        );

  static String _getAuthString(username, password) {
    final token = base64Encode(utf8.encode('$username:$password'));

    return "Basic ${token.trim()}";
  }

  BaseRequest _setHeaders(BaseRequest request) => request
    ..headers[HttpHeaders.authorizationHeader] = _authString
    ..headers[HttpHeaders.contentLengthHeader] =
        request.contentLength.toString();

  @override
  Future<StreamedResponse> send(BaseRequest request) {
    return super.send(_setHeaders(request));
  }
}

My request looks like this:

AuthClient c = AuthClient("username", "password",
    maxOpenConnections: Platform.numberOfProcessors);
Response response = await c.get(url);
c.close();

This is just one request.
It also happens when I do multiple:

c = AuthClient("username", "password");
return Future.wait([
    c.get(url1),
    c.get(url2),
    c.get(url3),
]);

I'm not sure why this is happening.
I really hope you can help me, or point me in the right direction.

I'm using http2_client: ^1.0.0
It happens on Android emulator api28 and api29. And on an Android tablet api23.
I haven't tested it on iOS.

Thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.