Computer Webmaster Gaming Console Graphics Forum

Welcome to the Computer Webmaster Gaming Console Graphics Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

MK PitStop Main Earn $25 Earn Money Posting Extras Members Blogs Image Hosting User Pages
Go Back   Computer Webmaster Gaming Console Graphics Forum > Webmaster Forum > Website Coding > Pear
Register FAQ/Rules Become A V.I.P. Member Search Today's Posts Mark Forums Read

Pear Pear programming, this is a very complex subject as with using pear with php can be a difficult task for some, so lets talk pear.

Google
Closed Thread
 
LinkBack Thread Tools Display Modes
Old 05-20-2007, 7:42 PM   #1
Alexey Borzov
 
Alexey Borzov's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default cvs: pear /HTTP_Request Request.php

avb Fri May 18 18:27:32 2007 UTC

Modified files:
/pear/HTTP_Request Request.php
Log:
Fixed bug #10605 (wrong Content-Length if using mbstring.func_overload)
Use mbstring functions where applicable in case of mbstring.func_overload, this allows using gzip


http://cvs.php.net/viewvc.cgi/pear/H...&diff_format=u
Index: pear/HTTP_Request/Request.php
diff -u pear/HTTP_Request/Request.php:1.53 pear/HTTP_Request/Request.php:1.54
--- pear/HTTP_Request/Request.php:1.53 Fri May 18 10:28:06 2007
+++ pear/HTTP_Request/Request.php Fri May 18 18:27:32 2007
@@ -40,7 +40,7 @@
* @author Alexey Borzov <avb@php.net>
* @copyright 2002-2007 Richard Heyes
* @license http://opensource.org/licenses/bsd-license.php New BSD License
- * @version CVS: $Id: Request.php,v 1.53 2007/05/18 10:28:06 avb Exp $
+ * @version CVS: $Id: Request.php,v 1.54 2007/05/18 18:27:32 avb Exp $
* @link http://pear.php.net/package/HTTP_Request/
*/

@@ -76,6 +76,18 @@
define('HTTP_REQUEST_HTTP_VER_1_1', '1.1', true);
/**#@-*/

+if (extension_loaded('mbstring') && (2 & ini_get('mbstring.func_overload'))) {
+ /**
+ * Whether string functions are overloaded by their mbstring equivalents
+ */
+ define('HTTP_REQUEST_MBSTRING', true);
+} else {
+ /**
+ * @ignore
+ */
+ define('HTTP_REQUEST_MBSTRING', false);
+}
+
/**
* Class for performing HTTP requests
*
@@ -317,10 +329,7 @@
}

// Use gzip encoding if possible
- // Avoid gzip encoding if using multibyte functions (see #1781)
- if (HTTP_REQUEST_HTTP_VER_1_1 == $this->_http && extension_loaded('zlib') &&
- 0 == (2 & ini_get('mbstring.func_overload'))) {
-
+ if (HTTP_REQUEST_HTTP_VER_1_1 == $this->_http && extension_loaded('zlib')) {
$this->addHeader('Accept-Encoding', 'gzip');
}
}
@@ -942,13 +951,17 @@
}
$postdata .= '--' . $boundary . "--\r\n";
}
- $request .= 'Content-Length: ' . strlen($postdata) . "\r\n\r\n";
+ $request .= 'Content-Length: ' .
+ (HTTP_REQUEST_MBSTRING? mb_strlen($postdata, 'iso-8859-1'): strlen($postdata)) .
+ "\r\n\r\n";
$request .= $postdata;

// Explicitly set request body
} elseif (!empty($this->_body)) {

- $request .= 'Content-Length: ' . strlen($this->_body) . "\r\n\r\n";
+ $request .= 'Content-Length: ' .
+ (HTTP_REQUEST_MBSTRING? mb_strlen($this->_body, 'iso-8859-1'): strlen($this->_body)) .
+ "\r\n\r\n";
$request .= $this->_body;
}

@@ -1185,7 +1198,7 @@
$data = $this->_sock->read(4096);
} else {
$data = $this->_sock->read(min(4096, $this->_toRead));
- $this->_toRead -= strlen($data);
+ $this->_toRead -= HTTP_REQUEST_MBSTRING? mb_strlen($data, 'iso-8859-1'): strlen($data);
}
if ('' == $data) {
break;
@@ -1317,7 +1330,7 @@
}
}
$data = $this->_sock->read($this->_chunkLength);
- $this->_chunkLength -= strlen($data);
+ $this->_chunkLength -= HTTP_REQUEST_MBSTRING? mb_strlen($data, 'iso-8859-1'): strlen($data);
if (0 == $this->_chunkLength) {
$this->_sock->readLine(); // Trailing CRLF
}
@@ -1354,6 +1367,10 @@
*/
function _decodeGzip($data)
{
+ if (HTTP_REQUEST_MBSTRING) {
+ $oldEncoding = mb_internal_encoding();
+ mb_internal_encoding('iso-8859-1');
+ }
$length = strlen($data);
// If it doesn't look like gzip-encoded data, don't bother
if (18 > $length || strcmp(substr($data, 0, 2), "\x1f\x8b")) {
@@ -1429,6 +1446,9 @@
} elseif ((0xffffffff & $dataCrc) != (0xffffffff & crc32($unpacked))) {
return PEAR::raiseError('_decodeGzip(): data CRC check failed');
}
+ if (HTTP_REQUEST_MBSTRING) {
+ mb_internal_encoding($oldEncoding);
+ }
return $unpacked;
}
} // End class HTTP_Response
 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Featured Websites
Free Space
Free Space
Free Space Free Space
Closed Thread
Tags: , , ,




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
cvs: pear /HTTP_Request Request.php Alexey Borzov Pear 0 05-20-2007 7:42 PM
cvs: pear /HTTP_Request/Request Listener.php /HTTP_Request/docs download-progress.php example.php Alexey Borzov Pear 0 05-20-2007 7:42 PM
cvs: pear-core / package-PEAR.xml package2.xml /PEAR Installer.php /PEAR/PackageFile v1.php /PEAR/PackageFile/v2 Validator.php Greg Beaver Pear 0 05-20-2007 7:42 PM
[PEAR-ACCOUNT-REQUEST] Your bug tracker account request johannes graën Pear 0 05-20-2007 7:41 PM
[ANNOUNCEMENT] HTTP_Request-1.4.1 (stable) Released. PEAR Announce Pear 0 05-20-2007 6:34 PM


Featured Websites




All times are GMT +1. The time now is 8:07 PM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.0.0
Cheap Computers
MK PitStop Copyright 2005 - 2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98