Comments (10)
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.
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.
@bjeanes I merged #28. HEAD should at least give you different behavior now, although it's still not correct.
from http.
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.
Yep, #28 is not a fix :(
from http.
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.
@schmurfy this should also be obsoleted by #39
from http.
so chunked response should work ? I will have a look again at my code tomorrow it may be on my side then.
from http.
Yes, and you can stream the chunks using HTTP::ResponseBody#readpartial
from http.
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)
- Requests to an IPv6 address result in: HTTP::ConnectionError (failed to connect: getaddrinfo: Name or service not known) HOT 13
- Incorrect method documentation? HOT 2
- feature request: happy eyeballs
- Can we update to llhttp-ffi 0.5.0 HOT 2
- access ssl certificate details? HOT 4
- Issues running it on Mac Intel (12.6) HOT 3
- SSLERROR occurred when running http method in the executable file: certificate verify failed. HOT 1
- 403 and 404 responses for valid URLs HOT 7
- raise error when invalid hash is passed to timeout HOT 1
- Are you open to include rspec_matchers? HOT 18
- File descriptor / socket leak when timeout occurs during initialization
- How to query the remote server address? HOT 1
- Make HTTP::Feature work like rack middleware HOT 10
- Remove auth header after following a redirect to a different origin
- Support HTTP headers streaming HOT 2
- Timeout redesign for 6.x HOT 4
- Fix Base64 dependency warning HOT 4
- Version 5.x bump? HOT 3
- project level timeout HOT 2
- `HTTP::Response::Body#each` and `BUFFER_SIZE`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from http.