Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 2.6.0

Request #17507 Multiple "Link" header are stripped
Submitted: 2010-06-21 18:04 UTC
From: till Assigned: avb
Status: Closed Package: HTTP_Request2 (version 0.5.2)
PHP Version: 5.3.2 OS: Ubuntu
Roadmaps: 0.6.0    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 42 - 9 = ?

 
 [2010-06-21 18:04 UTC] till (Till Klampaeckel)
Description: ------------ So, here's my use case: I want to send multiple Link header along with a request. From what I understand through the spec is, that this is possible on Link and Accept headers by combining them, or probably even with: Link: foo Link: bar ... HTTP_Request2::setHeader() fails to honor that. Here's a patch to correct it. Test script: --------------- <?php // here's a test case public function testHttpRequest2Bug() { $req = new HTTP_Request2; $req->setUrl('http://localhost/foo/bar'); $req->setHeader('Link: foo'); $req->setHeader('Link: bar'); $req->setAdapter('mock'); $response = $req->send(); $headers = $req->getHeaders(); $links = $headers['link']; $count = explode(',', $links); $this->assertEquals(count($headers), 2); // Link headers combined + 1 for user-agent $this->assertEquals(count($count), 2); } ?>

Comments

 [2010-06-21 18:08 UTC] till (Till Klampaeckel)
Can't upload the patch, here is a link: http://friendpaste.com/5MaInyX2VA1lAJM88QaCKv
 [2011-02-14 19:39 UTC] avb (Alexey Borzov)
-Status: Open +Status: Closed -Type: Bug +Type: Feature/Change Request -Assigned To: +Assigned To: avb
This bug has been fixed in SVN. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better. There is now a third $replace parameter in setHeader() that controls whether a new value will overwrite an old one or be appended to it.