attempting to work with braindead lighttpd gnusocial servers
This commit is contained in:
		| @@ -185,8 +185,10 @@ function z_post_url($url,$params, $redirects = 0, $opts = array()) { | |||||||
| 	if($ciphers) | 	if($ciphers) | ||||||
| 		@curl_setopt($ch, CURLOPT_SSL_CIPHER_LIST, $ciphers); | 		@curl_setopt($ch, CURLOPT_SSL_CIPHER_LIST, $ciphers); | ||||||
|  |  | ||||||
| 	if(x($opts,'headers')) | 	if(x($opts,'headers')) { | ||||||
| 		@curl_setopt($ch, CURLOPT_HTTPHEADER, $opts['headers']); | 		@curl_setopt($ch, CURLOPT_HTTPHEADER, $opts['headers']); | ||||||
|  | logger('headers: ' . print_r($opts['headers'],true) . 'redir: ' . $redirects); | ||||||
|  | 	} | ||||||
|   |   | ||||||
| 	if(x($opts,'nobody')) | 	if(x($opts,'nobody')) | ||||||
| 		@curl_setopt($ch, CURLOPT_NOBODY, $opts['nobody']); | 		@curl_setopt($ch, CURLOPT_NOBODY, $opts['nobody']); | ||||||
| @@ -236,6 +238,21 @@ function z_post_url($url,$params, $redirects = 0, $opts = array()) { | |||||||
| 		$base = substr($base,strlen($chunk)); | 		$base = substr($base,strlen($chunk)); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | 	// would somebody take lighttpd and just shoot it? | ||||||
|  |  | ||||||
|  | 	if($http_code == 417) { | ||||||
|  | 		curl_close($ch); | ||||||
|  | 		if($opts) { | ||||||
|  | 			if($opts['headers']) | ||||||
|  | 				$opts['headers'][] = 'Expect:'; | ||||||
|  | 			else | ||||||
|  | 				$opts['headers'] = array('Expect:'); | ||||||
|  | 		} | ||||||
|  | 		else | ||||||
|  | 			$opts = array('headers' => array('Expect:')); | ||||||
|  | 		return z_post_url($url,$params,++$redirects,$opts); | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	if($http_code == 301 || $http_code == 302 || $http_code == 303 || $http_code == 307 || $http_code == 308) { | 	if($http_code == 301 || $http_code == 302 || $http_code == 303 || $http_code == 307 || $http_code == 308) { | ||||||
| 		$matches = array(); | 		$matches = array(); | ||||||
| 		preg_match('/(Location:|URI:)(.*?)\n/', $header, $matches); | 		preg_match('/(Location:|URI:)(.*?)\n/', $header, $matches); | ||||||
| @@ -1105,6 +1122,7 @@ function discover_by_webbie($webbie) { | |||||||
| 				} | 				} | ||||||
| 				if($link['rel'] == 'salmon') { | 				if($link['rel'] == 'salmon') { | ||||||
| 					$has_salmon = true; | 					$has_salmon = true; | ||||||
|  | 					$salmon = $link['href']; | ||||||
| 				} | 				} | ||||||
| 				if($link['rel'] == 'http://schemas.google.com/g/2010#updates-from') { | 				if($link['rel'] == 'http://schemas.google.com/g/2010#updates-from') { | ||||||
| 					$atom_feed = $link['href']; | 					$atom_feed = $link['href']; | ||||||
|   | |||||||
| @@ -1 +1 @@ | |||||||
| 2016-03-20.1341H | 2016-03-21.1342H | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user