Giter Site home page Giter Site logo

Comments (14)

edgurgel avatar edgurgel commented on May 3, 2024

Thanks for reporting, @jordan0day. I will take a look later today and give you some feedback.

I suspect it's an issue on hackney, but I can't confirm without writing some tests on hackney.

from httpoison.

edgurgel avatar edgurgel commented on May 3, 2024

Just released 0.6.0 version that requires hackney ~> 1.0 and it will (from today) get a version higher than 1.0.6 which fixed this behaviour. Thanks to @lexmag for fixing this on hackney.

I tested on my machine. If you find the same behaviour after using hackney 1.0.6 please reopen the issue.

from httpoison.

lexmag avatar lexmag commented on May 3, 2024

@edgurgel my pleasure to help.

from httpoison.

jordan0day avatar jordan0day commented on May 3, 2024

🏆 Thanks @edgurgel and @lexmag!

from httpoison.

DavsX avatar DavsX commented on May 3, 2024

Using HTTPoison 0.7.0 and hackney 1.1.0 I don't get AsyncEnd message ever. The server does not send Content-length header and the only way to detect the end of a download is that at the end I got an AsyncChunk with an empty string. Is it intended?

from httpoison.

edgurgel avatar edgurgel commented on May 3, 2024

It's not intended. I will reopen the issue and investigate. Thanks for reporting.

from httpoison.

DavsX avatar DavsX commented on May 3, 2024

The problematic link is the ElixirSips XML feed (elixirsips.com). I'm afraid you have to be subscribed to access that link (required basic_auth), so I cannot provide it for you.

from httpoison.

jordan0day avatar jordan0day commented on May 3, 2024

I have an ElixirSips subscription, and can replicate DavsX issue -- seeing the Async response streamed, and when it comes to the end, you get a final AsyncChunk with an empty string, and no AsyncEnd message sent.

Here's the AsyncStatus, AsyncHeaders messages:

%HTTPoison.AsyncStatus{code: 200, id: #Reference<0.0.0.2394>}
%HTTPoison.AsyncHeaders{headers: [{"Date", "Mon, 20 Jul 2015 16:25:45 GMT"}, {"Server", "Apache"}, {"Set-Cookie", "symfony=[...snip...] path=/; HttpOnly"}, {"Expires", "Thu, 19 Nov 1981 08:52:00 GMT"}, {"Cache-Control", "no-store, no-cache, must-revalidate, post-check=0, pre-check=0"}, {"Pragma", "no-cache"}, {"Vary", "Accept-Encoding,User-Agent"}, {"P3P", "CP=\"NOI CURa OUR NOR UNI\""}, {"Connection", "close"}, {"Content-Type", "application/rss+xml; charset=UTF-8"}], id: #Reference<0.0.0.2394>}

So it appears to be the same issue, only worse, because this server isn't even setting a content-length or transfer-encoding header on a 200 OK response.

from httpoison.

DavsX avatar DavsX commented on May 3, 2024

@jordan0day thank for the infinitely better-than-mine bug description :)

from httpoison.

edgurgel avatar edgurgel commented on May 3, 2024

Thanks! This is enough to reproduce the error. 👍

from httpoison.

edgurgel avatar edgurgel commented on May 3, 2024

Good news. This was fixed with hackney 1.2.0. A simple mix deps.update hackney should do the job. I will set hackney to "~> 1.2" so nobody will have these problems.

Using hackney 1.2.0:

Running the 1 line "server"

{ echo -ne "HTTP/1.0 200 OK\r\n\r\n"; echo "BODY"; } | nc -l localhost 8080
iex(3)> HTTPoison.get!("http://localhost:8080", [], [stream_to: self])
%HTTPoison.AsyncResponse{id: #Reference<0.0.4.251>}
iex(4)> flush
%HTTPoison.AsyncStatus{code: 200, id: #Reference<0.0.4.251>}
%HTTPoison.AsyncHeaders{headers: [], id: #Reference<0.0.4.251>}
%HTTPoison.AsyncChunk{chunk: "BODY\n", id: #Reference<0.0.4.251>}
%HTTPoison.AsyncChunk{chunk: "", id: #Reference<0.0.4.251>}
%HTTPoison.AsyncEnd{id: #Reference<0.0.4.251>}
:ok

from httpoison.

DavsX avatar DavsX commented on May 3, 2024

Good to hear! I'll try it myself, when I'll have the time.

from httpoison.

DavsX avatar DavsX commented on May 3, 2024

I confirm, that it is working :ok

from httpoison.

edgurgel avatar edgurgel commented on May 3, 2024

Awesome! Thanks! 👍

from httpoison.

Related Issues (20)

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.