php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #58442 http_parse_message cuts off more than headers
Submitted: 2008-12-02 23:01 UTC Modified: 2008-12-05 04:12 UTC
From: brian at brianmckenna dot org Assigned: mike (profile)
Status: Closed Package: pecl_http (PECL)
PHP Version: 5.2.5 OS: Windows XP
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: brian at brianmckenna dot org
New email:
PHP Version: OS:

 

 [2008-12-02 23:01 UTC] brian at brianmckenna dot org
Description:
------------
I just found that with the URL "http://news.ycombinator.com/", http_parse_message cuts off more than the headers and removes some of the message's content.

This is because in between the headers and the content there is "\n\r\n" instead of the "\n\n" or "\n\r\n\r" that _http_locate_body expects.

My current work-around is just replacing all occurrences of "\r" with "" after I call http_get then use http_parse_message.

Reproduce code:
---------------
Code to reproduce:
http://pastebin.com/fa52966c

Patch to stop behaviour:
http://pastebin.com/f2999508f

Expected result:
----------------
<html><head><link rel="stylesheet" type="text/css" href="http://ycombinator.com/news.css">
<link rel="shortcut icon" href="http://ycombinator.com/favicon.ico">
<script>
function byId(id) {
  return document.getElementById(id);
}

function vote(node) {
  var v = node.id.split(/_/);   // {'up', '123'}
  var item = v[1]; 

  // adjust score

Actual result:
--------------
function vote(node) {
  var v = node.id.split(/_/);   // {'up', '123'}
  var item = v[1]; 

  // adjust score

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-12-03 03:57 UTC] mike@php.net
I'll need some time to investigate this issue.  There's for sure been a good reason why it currently is like it is.

Thanks a lot for this report.
 [2008-12-05 04:12 UTC] mike@php.net
This bug has been fixed in CVS.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pecl.php.net.

In case this was a pecl.php.net website problem, the change will show
up on the website in short time.
 
Thank you for the report, and for helping us make PECL better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 11:01:30 2024 UTC