[wp-hackers] WP_HTTP deflating small packets
Dion Hulse (dd32)
wordpress at dd32.id.au
Wed Mar 2 12:49:59 UTC 2011
It's possible he's using the cURL library, as it's the 2nd transport in the
preference order (and he's shown it works)
The PHP HTTP Request Extension is the prefered transport (And ironically,
possibly the most untested), If the Curl library works by itself, I
certainly don't want to go on a wild goose chase if the cURL transport works
fine, and he's actually using the PHP Extension!
Ultimately, I'd still like a external page to test against, as I've used the
API with single-digit responses with no problems at all.
On 2 March 2011 20:00, Barry Carlyon <barry at barrycarlyon.co.uk> wrote:
> Quoting Tim Nash:
>
> >>>> 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.
>
> I think its clear he is using the cURL transport.
>
> --------------------------------
>
> Barry Carlyon
> Freelance Web Developer
> Freelance Lighting/AV Engineer
>
> http://barrycarlyon.co.uk
>
> mobile: 07729 048 443
> skype: barrycarlyon
> email: barry at barrycarlyon.co.uk
> msn: barry at barrycarlyon.co.uk
>
> On 2 Mar 2011, at 06:30, Dion Hulse (dd32) wrote:
>
> > Core Control can indeed show you which transport is in use, but the test
> > functions are useless in this context.
> >
> > On 2 March 2011 17:27, aditya sharma <sharmaaditya333 at gmail.com> wrote:
> >
> >> 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
> >>>
> >> _______________________________________________
> >> 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
>
> _______________________________________________
> 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