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

Bug #17653 HTTP_OAuth_Consumer_Request converts + to %20
Submitted: 2010-08-03 23:37 UTC
From: evert Assigned: shupp
Status: Closed Package: HTTP_OAuth (version 0.1.18)
PHP Version: 5.3.2 OS: Any
Roadmaps: (Not assigned)    
Subscription  


 [2010-08-03 23:37 UTC] evert (Evert Pot)
Description: ------------ Hi guys, I'm using the PEAR package to make OAuth signed request to Dropbox. In my case I need to do multipart requests. As you might know, any non-"application/x-www-form-urlencoded" requests are supported in OAuth by means of ignoring the body altogether. So I fully generate the body myself and call getBody(), however, in line 217 of HTTP_OAuth_Consumer_Request any + gets converted to %20. This should ideally only happen if the body was generated using ->setParameters, not if a custom body was supplied through ->setBody().

Comments

 [2010-08-03 23:37 UTC] evert (Evert Pot)
I said ->getBody(), but meant to say ->setBody(). srry
 [2010-12-17 05:02 UTC] steffentchr (Steffen Tiedemann Christensen)
Hi guys, Evert did a 'Me too' on a bug report of mine a few months back -- and I'll return the favour. Indeed, non-"application/x-www-form-urlencoded" requests shouldn't have its content converted. So in OAuth/Consumer/Request.php, a better approach would be: $request_headers = $this->getHTTPRequest2()->getHeaders(); if ($this->getMethod() == 'POST' && $request_headers['content-type']=='application/x-www-form-urlencoded') { $body = $this->getHTTPRequest2()->getBody(); $body = str_replace('+', '%20', $body); $this->getHTTPRequest2()->setBody($body); } Thanks, Steffen
 [2010-12-29 11:38 UTC] shupp (Bill Shupp)
-Status: Open +Status: Closed -Assigned To: +Assigned To: shupp
Thank you for your bug report. This issue has been fixed in the latest released version of the package, which you can download at http://pear.php.net/get/