aboutsummaryrefslogtreecommitdiffstats
path: root/include/network.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2015-03-04 15:14:10 -0800
committerfriendica <info@friendica.com>2015-03-04 15:17:39 -0800
commit410f3335a9e97276b3262196f50798ff56624af5 (patch)
treeb05da3ce18181e5dd981da001e0ca490e5b68d55 /include/network.php
parent24304c53eb594c6cce908e7cbacff5f259445a06 (diff)
downloadvolse-hubzilla-410f3335a9e97276b3262196f50798ff56624af5.tar.gz
volse-hubzilla-410f3335a9e97276b3262196f50798ff56624af5.tar.bz2
volse-hubzilla-410f3335a9e97276b3262196f50798ff56624af5.zip
parse_url: if url returns an image/audio/video file instead of a webpage, return the bbcode for the appropriate content type. This results in two web fetches of the url in question, but the first one is just a HEAD. This way we won't try and download and parse an entire video. TODO: img's are checked to see if they should be zid-ified, but audio/video currently are not.
Diffstat (limited to 'include/network.php')
-rw-r--r--include/network.php7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/network.php b/include/network.php
index db32396e4..5912ad79d 100644
--- a/include/network.php
+++ b/include/network.php
@@ -19,6 +19,7 @@ function get_capath() {
* 'timeout' => int seconds, default system config value or 60 seconds
* 'http_auth' => username:password
* 'novalidate' => do not validate SSL certs, default is to validate using our CA list
+ * 'nobody' => only return the header
*
* @returns array
* 'return_code' => HTTP return code or 0 if timeout or failure
@@ -51,6 +52,9 @@ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = array()) {
if(x($opts,'headers'))
@curl_setopt($ch, CURLOPT_HTTPHEADER, $opts['headers']);
+ if(x($opts,'nobody'))
+ @curl_setopt($ch, CURLOPT_NOBODY, $opts['nobody']);
+
if(x($opts,'timeout') && intval($opts['timeout'])) {
@curl_setopt($ch, CURLOPT_TIMEOUT, $opts['timeout']);
}
@@ -182,6 +186,9 @@ function z_post_url($url,$params, $redirects = 0, $opts = array()) {
if(x($opts,'headers'))
@curl_setopt($ch, CURLOPT_HTTPHEADER, $opts['headers']);
+ if(x($opts,'nobody'))
+ @curl_setopt($ch, CURLOPT_NOBODY, $opts['nobody']);
+
if(x($opts,'timeout') && intval($opts['timeout'])) {
@curl_setopt($ch, CURLOPT_TIMEOUT, $opts['timeout']);
}