
Property changes on: wp-includes
___________________________________________________________________
Added: svn:ignore
   + .19922.patch.swp


Index: wp-includes/class-http.php
===================================================================
--- wp-includes/class-http.php	(revision 19910)
+++ wp-includes/class-http.php	(working copy)
@@ -419,6 +419,7 @@
 				$cookies_header .= $cookie->getHeaderValue() . '; ';
 			}
 			$cookies_header = substr( $cookies_header, 0, -2 );
+			$cookies_header = apply_filters( 'http_headers_cookie', $cookies_header );
 			$r['headers']['cookie'] = $cookies_header;
 		}
 	}
@@ -1540,9 +1541,33 @@
 		if ( empty( $this->name ) || empty( $this->value ) )
 			return '';
 
-		return $this->name . '=' . urlencode( $this->value );
+		return $this->name . '=' . $this->encodeString( $this->value );
 	}
+        
+        /**
+         * URL encode non-printable characters only
+         * 
+         * @link http://stackoverflow.com/a/1969339
+         * 
+         * @param string $str
+         * @return string
+         */
+        public function encodeString( $str ) {
+            $chars = preg_split( '//', $str, -1, PREG_SPLIT_NO_EMPTY );
+            return implode( '', array_map( array( $this, 'encodeChar' ), $chars ) );
+        }
 
+        /**
+         * Encode only non-printable chars
+         * @param string $char
+         * @return string
+         */
+        public function encodeChar( $char ) {
+            if ( ctype_print( $char ) && !in_array( $char, array( ';', ' ', '%', '+' ) ) )
+                return $char;
+            return rawurlencode( $char );
+        }
+
 	/**
 	 * Retrieve cookie header for usage in the rest of the WordPress HTTP API.
 	 *
