GithubHelp home page GithubHelp logo

asio-curl's People

Contributors

robertleahy avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

asio-curl's Issues

Crashes

Running the code in the attached file (uploaded as ZIP, because direct cpp is not supported, for whatever reason), which is based mostly on the example from the main project page, with include files and proper termination added, leads to a crash.

System: Ubuntu 20.04 LTS
Boost Version: 1.73.0 (self compiled)
libcurl-gnutls as packaged with Ubuntu 20.04 LTS

The crash happens in the main thread in the call to curl.add(easy), which in turn calls curl_multi_add_handle(), which calls back to asiocurl::io_service::timer(), which calls asiocurl::io_service::do_action(), which calls curl_multi_socket_action(), which calls asiocurl::io_service::socket().

When breaking with GDB into asiocurl::io_service::socket() and analyzing the passed in userp, the good news is, that it seems to point to a valid asiocurl::io_service. The bad news is, that the sockets_ field of that io_service is an empty std::unordered_map . Somehow, curl is calling back asiocurl::io_service::socket(), when the io_service is not even aware of any socket, yet.

No need to say, that the following line of asiocurl::io_service::socket()

auto & ss=self.sockets_.find(socket)->second;

doesn't find anything and thus continues with an invalid pointer, which soon leads to a SEGFAULT.

With all the changes of both boost::asio and libcurl during the last years, I am not going to debug this problem any further.
test.zip

Doesn't work with non-Boost ASIO

Two problems:

  1. Depends on Boost
  2. Depends specifically on Boost.ASIO

It would be nice if this library could be used without having to include all of Boost. Also, it would be nice if it was possible to use the version of ASIO that isn't part of Boost.

Code can't handle large downloads

I understand this code is old and may not be maintained, but I noticed a issue while using it as a example reference.

If you request something that can't fit in a single buffer eg 16KB the code will stall indefinitely.

This is because the code is only calling socket read/write once in response to ::socket calls.
Instead it should enter a async loop calling read/write over and over unless otherwise instructed by another call to ::socket.

In order to fix it I suggest moving the socket read/write logic into another function and calling that function again instead of do_action after a read/write completes.

Since I only used this as a reference I don't have changes for a pull request, sorry.

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.