Coder Social home page Coder Social logo

Comments (10)

bjeanes avatar bjeanes commented on June 16, 2024

It's worth noting here that the socket content after the request has been made is:

HTTP/1.1 401 Unauthorized\r\nServer: nginx/1.4.3\r\nDate: Mon, 04 Nov 2013 22:12:01 GMT\r\nContent-Type: application/json; charset=utf-8\r\nTransfer-Encoding: chunked\r\nConnection: keep-alive\r\nStatus: 401 Unauthorized\r\nStrict-Transport-Security: max-age=31536000\r\nX-UA-Compatible: IE=Edge,chrome=1\r\nX-Request-Id: 0404cee81486a95569ab4e55c85daeea\r\nX-Runtime: 0.012569\r\nX-Rack-Cache: miss\r\n\r\n29\r\n{\"error\":\"Invalid authentication token.\"}\r\n0\r\n\r\n

Note the chunked encoding. In chunked encoding, one can't read Content-Length bytes, one has to read each chunk until you reach the empty chunk (length 0).

from http.

tarcieri avatar tarcieri commented on June 16, 2024

You might take a look at some of the existing discussion of this issue on #28 and #39. I don't see a specific ticket for this problem still open for this issue though (besides those tickets, which are vicariously related).

tl;dr: yes, the logic is buggy, it's the result of not enough diligence in merging patches, and at this point I was hoping to address it via a rewrite I haven't had enough time to complete.

That said, an interim fix is probably in order.

from http.

tarcieri avatar tarcieri commented on June 16, 2024

@bjeanes I merged #28. HEAD should at least give you different behavior now, although it's still not correct.

from http.

bjeanes avatar bjeanes commented on June 16, 2024

I'll have to pull it down in test it, but it seems that this will just mean the body will be nil instead of empty string, no? Definitely better than an empty string semantically, but unfortunately doesn't help me here.

I'll have a look at those #39 too to see if there is anything I can do to help.

from http.

tarcieri avatar tarcieri commented on June 16, 2024

Yep, #28 is not a fix :(

from http.

schmurfy avatar schmurfy commented on June 16, 2024

I suppose this also affects chunked encoded response, am I wrong ?
When such response is received the body is blanked which is not that helpful...

from http.

tarcieri avatar tarcieri commented on June 16, 2024

@schmurfy this should also be obsoleted by #39

from http.

schmurfy avatar schmurfy commented on June 16, 2024

so chunked response should work ? I will have a look again at my code tomorrow it may be on my side then.

from http.

tarcieri avatar tarcieri commented on June 16, 2024

Yes, and you can stream the chunks using HTTP::ResponseBody#readpartial

from http.

schmurfy avatar schmurfy commented on June 16, 2024

ok I got it, the latest stable release is so far behind master that ResponseBody does not even exists in it xD
I will try master thanks for helping figure this out xD

from http.

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.