[wp-hackers] WP_HTTP deflating small packets
aditya sharma
sharmaaditya333 at gmail.com
Wed Mar 2 06:27:41 UTC 2011
You should download the Core Control plugin,
http://wordpress.org/extend/plugins/core-control/, and test out the HTTP
transports.
Warm Regards
Aditya Sharma
On Wed, Mar 2, 2011 at 4:32 AM, Dion Hulse (dd32) <wordpress at dd32.id.au>wrote:
> Yes, WordPress is adding request headers to say what it supports, and it
> supports deflating and decompressing the return values.
> Now, the question is why it's not working correctly for you.
>
> The first step is to figure out which HTTP transport is in use, This could
> be cURL (but, hopefully it isn't). Throw some debugging in
> WP_HTTP::request() and get the class_name() of the actual http transport in
> use.
>
> The 2nd step is being able to reproduce it. Every server will return
> content
> in a different way, if you can setup a page on a host somewhere (just a
> static document) which reliably reproduces it, that would be really good.
>
> The 3rd step is working out if the extra headers shouldn't be added for
> that
> transport, or if someone forgot to call the decompression/encoding
> functions
> on that transport correct, or if the server is simply doing something
> strange and not following the spec 100% (Which is very common, most have
> their little issues that clients just work around)
>
> On 2 March 2011 08:00, Tim Nash <tim at newmedias.co.uk> wrote:
>
> > CURL is working fine, and can we skip the suggest to upload phpinfo
> > functions please :) The hint to CURL working fine being strings over 7
> > chars long were coming back fine.
> >
> > The issue is not with CURL (doing a simple curl request also brings
> > the content back even if below 7 characters) the issue is with wp_http
> > object automatically inserting extra parameters in the header,
> > presumably to aid pushing and pulling large amount of content.
> >
> > Cheers
> > Tim
> >
> > On 1 March 2011 19:27, aditya sharma <sharmaaditya333 at gmail.com> wrote:
> > > Can you create a phpinfo page and link that to this post so we can see
> > > what's currently configured? Just create a page called phpinfo.php
> which
> > > contains the following line:
> > >
> > > <?php phpinfo() ?>
> > >
> > > And upload it to your site via FTP. This will tell us a little about
> how
> > > your server is configured and whether or not cURL is enabled.
> > >
> > > Warm Regards
> > > Aditya Sharma
> > >
> > >
> > >
> > >
> > > On Tue, Mar 1, 2011 at 7:45 PM, Tim Nash <tim at newmedias.co.uk> wrote:
> > >
> > >> Hi all,
> > >> We have been having interesting problem with wp_http simple request
> > >> returns either a 1 or an error string.
> > >> Problem is instead of return a 1 it appears to be returning a binary
> > >> string. If we put more then 7 chars on the page then they are returned
> > >> happily.
> > >>
> > >> $request = new WP_Http;
> > >> $result = $request->request($url);
> > >> if (is_wp_error($result)) {
> > >> return FALSE;
> > >> }
> > >> if ($result['response']['code'] == 200) {
> > >> // success
> > >> return $result['body'];
> > >> } else {
> > >> return FALSE;
> > >> }
> > >> What's being returned
> > >> Array ( [method] => GET [timeout] => 5 [redirection] => 5
> > >> [httpversion] => 1.0 [user-agent] => WordPress/3.1;
> > >> http://wordpress_dev [blocking] => 1 [headers] => Array (
> > >> [Accept-Encoding] => deflate;q=1.0, compress;q=0.5 ) [cookies] =>
> > >> Array ( ) [body] => [compress] => [decompress] => 1 [sslverify] => 1
> > >> [ssl] => [local] => )
> > >>
> > >> The weird bit is:
> > >> Array ( [0] => Accept-Encoding: deflate;q=1.0, compress;q=0.5 )
> > >>
> > >> Looking at wp_http this seems to being set and can't be overridden. We
> > >> have got round the problem as we are simply changing the return to
> > >> pass enough data but thats a hack rather then a solution, wondering if
> > >> anyone had come across this problem (that piece of code has been our
> > >> work horse for some time so its only a recent thing) and if anyone has
> > >> a solution.
> > >>
> > >> Cheers
> > >> Tim
> > >>
> > >> --
> > >> Tim Nash
> > >> Technical Director
> > >>
> > >> Coding Futures Ltd
> > >> The Tannery
> > >> 91 Kirkstall Road
> > >> Leeds
> > >> LS3 1HS
> > >>
> > >> Company House Registration Number: 07350515
> > >> Company Registered in England and Wales
> > >>
> > >> Contact Telephone: +44(0)113 2473850
> > >>
> > >> The contents of this email is for the named parties, if you have
> > >> receieved this email in error please accept our apologises. Unless
> > >> separately mentioned the content of the email are considered private
> > with
> > >> content belonging to the authors.
> > >>
> > >> NewMedias is a brand for Coding Futures Ltd
> > >> _______________________________________________
> > >> wp-hackers mailing list
> > >> wp-hackers at lists.automattic.com
> > >> http://lists.automattic.com/mailman/listinfo/wp-hackers
> > >>
> > > _______________________________________________
> > > wp-hackers mailing list
> > > wp-hackers at lists.automattic.com
> > > http://lists.automattic.com/mailman/listinfo/wp-hackers
> > >
> >
> >
> >
> > --
> > Tim Nash
> > Technical Director
> >
> > Coding Futures Ltd
> > The Tannery
> > 91 Kirkstall Road
> > Leeds
> > LS3 1HS
> >
> > Company House Registration Number: 07350515
> > Company Registered in England and Wales
> >
> > Contact Telephone: +44(0)113 2473850
> >
> > The contents of this email is for the named parties, if you have
> > receieved this email in error please accept our apologises. Unless
> > separately mentioned the content of the email are considered private with
> > content belonging to the authors.
> >
> > NewMedias is a brand for Coding Futures Ltd
> > _______________________________________________
> > wp-hackers mailing list
> > wp-hackers at lists.automattic.com
> > http://lists.automattic.com/mailman/listinfo/wp-hackers
> >
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
More information about the wp-hackers
mailing list