shuber / curl

A basic CURL wrapper for PHP
MIT License
462 stars 179 forks source link

Remove all headers from response when multiple headers are received #6

Open hugochinchilla opened 12 years ago

hugochinchilla commented 12 years ago

When a request is completed following a redirect, the curl response contains the headers from the first and the second requests. In this case not all the headers are removed, only the last one is stripped from the response, resulting in a body containing the other headers.

HTTP/1.1 302 Found
Location: http://www.google.es/
Cache-Control: private
Content-Type: text/html; charset=UTF-8
Date: Tue, 20 Dec 2011 10:54:50 GMT
Server: gws
Content-Length: 218
X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN

HTTP/1.1 200 OK
Date: Tue, 20 Dec 2011 10:54:50 GMT
Expires: -1
Cache-Control: private, max-age=0
Content-Type: text/html; charset=ISO-8859-1
Server: gws
X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN
Transfer-Encoding: chunked
nickl- commented 12 years ago

merged at nickl-/curl@8dec78dc34c68ecc3db88b7762fbf147b7c313cc