Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to parse JSON since switch to HTTP 1.1 and chunked encoding #55

Closed
phelps opened this issue Jan 21, 2014 · 3 comments
Closed

Unable to parse JSON since switch to HTTP 1.1 and chunked encoding #55

phelps opened this issue Jan 21, 2014 · 3 comments

Comments

@phelps
Copy link

phelps commented Jan 21, 2014

My application broke after merging in recent changes to Phirehose that add HTTP 1.1 support and chunked encoding in favor of delimited:length.

My application is no longer able to parse the JSON for most tweets.

I'm using code borrowed from ghetto-queue-consume.php, and I'm still debugging to get to the bottom of the issue. But the line in question appears to be

while ($rawStatus = fgets($fp, 8192))

I'm logging each $rawStatus. I see that each one is exactly 8192 bytes. (I don't remember this being the case before; I thought the 8192 referred to the maximum number of bytes per chunk.) Obviously this leads to the JSON statuses starting and ending at random places.

I hope with more digging I can clarify this ticket, but my top-level question is: Does ghetto-queue-consume.php (which hasn't been updated in some time) still work with the recent changes to support HTTP 1.1?

@phelps
Copy link
Author

phelps commented Jan 21, 2014

When I log the contents of the stream before doing fgets, I see no line breaks. That would explain why fgets is simply returning 8192-byte chunks. The question is, did some change to Phirehose wind up stripping out line breaks before fgets can do its thing?

@DarrenCook
Copy link
Contributor

See #53 (a fix is mentioned there too).
(If someone can do a pull request, we can add that in.)

@markopavlovic
Copy link
Contributor

I will close this one since the referenced issue has more details and anwsers about it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants