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

Request #16146 Custom 'Host' header & get raw body
Submitted: 2009-04-23 19:45 UTC
From: zhangdebo Assigned: avb
Status: Closed Package: HTTP_Request2 (version 0.3.0)
PHP Version: Irrelevant OS: Irrelevant
Roadmaps: 0.4.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 : 32 - 1 = ?

 
 [2009-04-23 19:45 UTC] zhangdebo (Robert Zhang)
Description: ------------ I've been developing a proxy script based on your excellent work and found two features that is very useful for me but i have to hack to implement. 1) Custom 'Host:' header in request. Now when requesting 'http://1.2.3.4/blabla.html', the 'Host:' header sent was Host: 1.2.3.4 Even if I set a Host header by calling setHeader, it doesn't work as expected. I think it'll be very useful for a front end proxy program if a custom 'Host:' header overrides the default one from URL. 2) A function that returns not decoded body I need a getRawBody() function which return body directly instead of getBody() function which decodes body. This is really useful if HTTP_Request2 is used as a proxy instead of a pure client. Many thanks, Robert

Comments

 [2009-04-24 01:41 UTC] avb (Alexey Borzov)
-Status: Open +Status: Analyzed
Inability to set a custom Host header is an oversight, will fix that. If you need to access an encoded body then you can use Observers, parts of the (still encoded) body will be provided with 'receivedEncodedBodyPart' events.
 [2009-04-24 18:03 UTC] zhangdebo (Robert Zhang)
1) Great. 2) I still think it's more straightforward to add a $raw parameter to getBody(). The 'receivedEncodedBodyPart' event seems to be triggered only in Socket Adapter. Cheers, Robert
 [2009-05-03 03:22 UTC] avb (Alexey Borzov)
I don't think PHP's cURL extension allows to disable builtin decoding so Curl adapter can only provide already decoded body.
 [2009-05-03 17:17 UTC] avb (Alexey Borzov)
-Status: Analyzed +Status: Closed -Assigned To: +Assigned To: avb
Fixed in release 0.4.0