summaryrefslogtreecommitdiff
path: root/inc/HTTPClient.php
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2006-04-29 17:58:05 +0200
committerAndreas Gohr <andi@splitbrain.org>2006-04-29 17:58:05 +0200
commitec79c838639b74f23c8d836368b08642ea8b4940 (patch)
treee3a1a53be4fca5cc9ff31f2e9310684d3c5290e5 /inc/HTTPClient.php
parentd88b5f049b763613b6c2953b8f21105639a53afc (diff)
downloadrpg-ec79c838639b74f23c8d836368b08642ea8b4940.tar.gz
rpg-ec79c838639b74f23c8d836368b08642ea8b4940.tar.bz2
Feedfetcher/HTTPClient fix
This fixes a typo which made the new Feedparser not use our own HTTPClient. It also enhances the get() method of HTTPClient to optionally cope better with bad HTTP responses: Some servers return a body with a "304 Not Modified" status which violates RFC 2616 but is usually accepted by common browsers. Setting the $sloppy304 parameter will return the response body. This fixes problems with feeds from feedblendr.com darcs-hash:20060429155805-7ad00-33a1c3142f241bf7747e8f679237cb6e8f1564ef.gz
Diffstat (limited to 'inc/HTTPClient.php')
-rw-r--r--inc/HTTPClient.php5
1 files changed, 4 insertions, 1 deletions
diff --git a/inc/HTTPClient.php b/inc/HTTPClient.php
index 18f4435bc..69a384487 100644
--- a/inc/HTTPClient.php
+++ b/inc/HTTPClient.php
@@ -111,10 +111,13 @@ class HTTPClient {
*
* Returns the wanted page or false on an error;
*
+ * @param string $url The URL to fetch
+ * @param bool $sloppy304 Return body on 304 not modified
* @author Andreas Gohr <andi@splitbrain.org>
*/
- function get($url){
+ function get($url,$sloppy304=false){
if(!$this->sendRequest($url)) return false;
+ if($this->status == 304 && $sloppy304) return $this->resp_body;
if($this->status != 200) return false;
return $this->resp_body;
}