Git Product home page Git Product logo

sync_http.dart's Introduction

Dart CI pub package package publisher

A Dart HTTP client implemented using RawSynchronousSockets to allow for synchronous HTTP requests.

Using this package

Note: this package is only intended for very specialized use cases. For general HTTP usage, please see instead package:http.

This library should probably only be used to connect to HTTP servers that are hosted on 'localhost'. The operations in this library will block the calling thread to wait for a response from the HTTP server. The thread can process no other events while waiting for the server to respond. As such, this synchronous HTTP client library is not suitable for applications that require high performance. Instead, such applications should use libraries built on asynchronous I/O, including dart:io and package:http, for the best performance.

sync_http.dart's People

Contributors

athomas avatar bkonyi avatar dependabot[bot] avatar devoncarew avatar franklinyow avatar jingbian avatar keertip avatar kevmoo avatar michalt avatar natebosch avatar trk54ylmz avatar zichangg avatar

Stargazers

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

Watchers

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

sync_http.dart's Issues

Truncated body in get request

When performing a get request:
SyncHttpClientRequest getRequest = SyncHttpClient.getUrl(uri);
getRequest.headers.add('cookie', _cookie);
SyncHttpClientResponse getResponse = getRequest.close();

The contents of the returned body gets truncated to around 700 characters.

After checking that the actual amount of returned characters is correct, I modified the socket.readSync(1024); sentence to increase the number of bytes being read.... witch sorted out the problem.

I can provide more details on request.

_nativeGetRemotePeer() throws or returns an exception whenever remoteAddress Socket's property getter is called!

Dart SDK Version (dart --version): Dart SDK version: 2.16.1 (stable) (Tue Feb 8 12:02:33 2022 +0100) on "linux_x64"
Operating System: Linux UBUNTU.

_nativeGetRemotePeer() throws exception whenever remoteAddress Socket's property getter is called!

This _nativeGetRemotePeer() function appears to be a C native function called by Dart code.

This function is called or referenced in sync_socket_patch.dart file that lives in /home/$USER/snap/flutter/common/flutter/bin/cache/dart-sdk/lib/_internal/vm/bin/sync_socket_patch.dart.

Here is the error I get whenever remoteAddress property gets called:

<type 'OSError' is not a subtype of type 'List<dynamic>' of 'function result'
#0      _NativeSynchronousSocket._nativeGetRemotePeer (dart:io-patch/sync_socket_patch.dart)
#1      _NativeSynchronousSocket.remoteAddress (dart:io-patch/sync_socket_patch.dart:136:18)
#2      _RawSynchronousSocket.remoteAddress (dart:io-patch/sync_socket_patch.dart:28:48)
#3      _RawSynchronousSocket.Eval ()
#4      _RawSynchronousSocket.Eval ()
#5      new SyncHttpClientResponse.processLine (package:sync_http/src/sync_http.dart:403:9)
#6      _LineDecoder._process (package:sync_http/src/line_decoder.dart:45:16)
#7      _LineDecoder.close (package:sync_http/src/line_decoder.dart:49:19)
#8      new SyncHttpClientResponse (package:sync_http/src/sync_http.dart:422:21)
#9      SyncHttpClientRequest.close (package:sync_http/src/sync_http.dart:104:12)
#10     main (package:sync_http/main.dart:41:26)
#11     _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:295:32)
#12     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)>

The socket is connected and there is a remote address value when this call occurs .. the values of isClosed & isClosedRead & isClosedWrite properties of the _socket object as instance of _NativeSynchronousSocket are both equal to false.

Would you kindly advise?

Dart 2 runtime failure in package

When running package webdriver tests, see the following error

type 'List<dynamic>' is not a subtype of type 'List<String>' of 'value' where...
type 'List<dynamic>' is not a subtype of type 'List<String>' of 'value' where
  List is from dart:core
  List is from dart:core
  String is from dart:core
dart:collection                                                                                         __InternalLinkedHashMap&_HashVMBase&MapMixin&_LinkedHashMapMixin.[]=
/sync_http/lib/src/sync_http.dart 155:19               _SyncHttpClientRequestHeaders.add
package:webdriver/src/sync/command_processor.dart 79:21                                                 SyncHttpCommandProcessor._setUpRequest

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.