From 0e809b930173e284bf4abaa958616b4d3aa9ed07 Mon Sep 17 00:00:00 2001 From: Friendika Date: Thu, 23 Jun 2011 14:11:23 -0700 Subject: bug #94 mis-spell Czech --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index c5751da37..0192f3c0f 100644 --- a/boot.php +++ b/boot.php @@ -4,7 +4,7 @@ set_time_limit(0); ini_set('pcre.backtrack_limit', 250000); -define ( 'FRIENDIKA_VERSION', '2.2.1019' ); +define ( 'FRIENDIKA_VERSION', '2.2.1020' ); define ( 'DFRN_PROTOCOL_VERSION', '2.21' ); define ( 'DB_UPDATE_VERSION', 1066 ); -- cgit v1.2.3 From 38cf37d3c3a4bc9873aa12eed5167b356282385f Mon Sep 17 00:00:00 2001 From: Friendika Date: Thu, 23 Jun 2011 17:56:59 -0700 Subject: new item view, sort by received date - not posted date. --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 0192f3c0f..d042ffdca 100644 --- a/boot.php +++ b/boot.php @@ -6,7 +6,7 @@ ini_set('pcre.backtrack_limit', 250000); define ( 'FRIENDIKA_VERSION', '2.2.1020' ); define ( 'DFRN_PROTOCOL_VERSION', '2.21' ); -define ( 'DB_UPDATE_VERSION', 1066 ); +define ( 'DB_UPDATE_VERSION', 1067 ); define ( 'EOL', "
\r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); -- cgit v1.2.3 From 59d9070d13949d596d24524acaef9d35e8feba8c Mon Sep 17 00:00:00 2001 From: Friendika Date: Sat, 25 Jun 2011 19:10:38 -0700 Subject: suggestion template --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index d042ffdca..9321b43c0 100644 --- a/boot.php +++ b/boot.php @@ -4,7 +4,7 @@ set_time_limit(0); ini_set('pcre.backtrack_limit', 250000); -define ( 'FRIENDIKA_VERSION', '2.2.1020' ); +define ( 'FRIENDIKA_VERSION', '2.2.1022' ); define ( 'DFRN_PROTOCOL_VERSION', '2.21' ); define ( 'DB_UPDATE_VERSION', 1067 ); -- cgit v1.2.3 From 22e89220889759256b48323ee1a66257e2121ef7 Mon Sep 17 00:00:00 2001 From: Friendika Date: Sun, 26 Jun 2011 05:42:32 -0700 Subject: friend suggest structures, cont. --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 9321b43c0..5a7af9725 100644 --- a/boot.php +++ b/boot.php @@ -6,7 +6,7 @@ ini_set('pcre.backtrack_limit', 250000); define ( 'FRIENDIKA_VERSION', '2.2.1022' ); define ( 'DFRN_PROTOCOL_VERSION', '2.21' ); -define ( 'DB_UPDATE_VERSION', 1067 ); +define ( 'DB_UPDATE_VERSION', 1068 ); define ( 'EOL', "
\r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); -- cgit v1.2.3 From f7964efa52f7efa8159403568a59e320209cbffa Mon Sep 17 00:00:00 2001 From: Friendika Date: Sun, 26 Jun 2011 17:57:23 -0700 Subject: revisit friend suggestion structures --- boot.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 5a7af9725..f2c947401 100644 --- a/boot.php +++ b/boot.php @@ -4,9 +4,9 @@ set_time_limit(0); ini_set('pcre.backtrack_limit', 250000); -define ( 'FRIENDIKA_VERSION', '2.2.1022' ); +define ( 'FRIENDIKA_VERSION', '2.2.1023' ); define ( 'DFRN_PROTOCOL_VERSION', '2.21' ); -define ( 'DB_UPDATE_VERSION', 1068 ); +define ( 'DB_UPDATE_VERSION', 1069 ); define ( 'EOL', "
\r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); -- cgit v1.2.3 From 3fe1e197254f62e5377c28a24e4d5a75014e931b Mon Sep 17 00:00:00 2001 From: Friendika Date: Sun, 26 Jun 2011 19:30:57 -0700 Subject: pass notify endpoint with friend suggestions --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index f2c947401..0bab002ed 100644 --- a/boot.php +++ b/boot.php @@ -6,7 +6,7 @@ ini_set('pcre.backtrack_limit', 250000); define ( 'FRIENDIKA_VERSION', '2.2.1023' ); define ( 'DFRN_PROTOCOL_VERSION', '2.21' ); -define ( 'DB_UPDATE_VERSION', 1069 ); +define ( 'DB_UPDATE_VERSION', 1070 ); define ( 'EOL', "
\r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); -- cgit v1.2.3 From 1947b74e5bd92f11a3e8af2223826e649233a883 Mon Sep 17 00:00:00 2001 From: Friendika Date: Mon, 27 Jun 2011 16:18:06 -0700 Subject: some basic margins for friend suggestion screen --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 0bab002ed..7419ddff9 100644 --- a/boot.php +++ b/boot.php @@ -4,7 +4,7 @@ set_time_limit(0); ini_set('pcre.backtrack_limit', 250000); -define ( 'FRIENDIKA_VERSION', '2.2.1023' ); +define ( 'FRIENDIKA_VERSION', '2.2.1024' ); define ( 'DFRN_PROTOCOL_VERSION', '2.21' ); define ( 'DB_UPDATE_VERSION', 1070 ); -- cgit v1.2.3 From 932397b47be25b042907ab888e3abcb51cbb84b2 Mon Sep 17 00:00:00 2001 From: Friendika Date: Mon, 27 Jun 2011 19:47:55 -0700 Subject: trim webfinger request --- boot.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 7419ddff9..5f4820b4f 100644 --- a/boot.php +++ b/boot.php @@ -1685,8 +1685,10 @@ function fetch_lrdd_template($host) { $url1 = 'https://' . $host . '/.well-known/host-meta' ; $url2 = 'http://' . $host . '/.well-known/host-meta' ; $links = fetch_xrd_links($url1); + logger('fetch_lrdd_template from: ' . $url1); logger('template (https): ' . print_r($links,true)); if(! count($links)) { + logger('fetch_lrdd_template from: ' . $url2); $links = fetch_xrd_links($url2); logger('template (http): ' . print_r($links,true)); } -- cgit v1.2.3 From 4ca6a9a38257a8f8c82842ce734ae946b90ebb4c Mon Sep 17 00:00:00 2001 From: Friendika Date: Tue, 28 Jun 2011 18:59:41 -0700 Subject: dbg info for photo uploads --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 5f4820b4f..54206d7fe 100644 --- a/boot.php +++ b/boot.php @@ -4,7 +4,7 @@ set_time_limit(0); ini_set('pcre.backtrack_limit', 250000); -define ( 'FRIENDIKA_VERSION', '2.2.1024' ); +define ( 'FRIENDIKA_VERSION', '2.2.1025' ); define ( 'DFRN_PROTOCOL_VERSION', '2.21' ); define ( 'DB_UPDATE_VERSION', 1070 ); -- cgit v1.2.3 From ad5b976978011e2bf16fea5537af5b211e8e65eb Mon Sep 17 00:00:00 2001 From: Friendika Date: Wed, 29 Jun 2011 18:59:05 -0700 Subject: allow spaces in @ tags --- boot.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 54206d7fe..f66cf4bc0 100644 --- a/boot.php +++ b/boot.php @@ -4,7 +4,7 @@ set_time_limit(0); ini_set('pcre.backtrack_limit', 250000); -define ( 'FRIENDIKA_VERSION', '2.2.1025' ); +define ( 'FRIENDIKA_VERSION', '2.2.1026' ); define ( 'DFRN_PROTOCOL_VERSION', '2.21' ); define ( 'DB_UPDATE_VERSION', 1070 ); @@ -2017,7 +2017,7 @@ function get_tags($s) { $s = preg_replace('/\[code\](.*?)\[\/code\]/sm','',$s); - if(preg_match_all('/([@#][^ \x0D\x0A,:?]+)([ \x0D\x0A,:?]|$)/',$s,$match)) { + if(preg_match_all('/([@#][^ \x0D\x0A,:?]+ [^ \x0D\x0A,:?]+)([ \x0D\x0A,:?]|$)/',$s,$match)) { foreach($match[1] as $mtch) { if(strstr($mtch,"]")) { // we might be inside a bbcode color tag - leave it alone @@ -2030,6 +2030,18 @@ function get_tags($s) { } } + if(preg_match_all('/([@#][^ \x0D\x0A,:?]+)([ \x0D\x0A,:?]|$)/',$s,$match)) { + foreach($match[1] as $mtch) { + if(strstr($mtch,"]")) { + // we might be inside a bbcode color tag - leave it alone + continue; + } + if(substr($mtch,-1,1) === '.') + $ret[] = substr($mtch,0,-1); + else + $ret[] = $mtch; + } + } return $ret; }} -- cgit v1.2.3 From 994011ddb6cc1097214537160a10bf710aedc553 Mon Sep 17 00:00:00 2001 From: Friendika Date: Thu, 30 Jun 2011 01:15:18 -0700 Subject: load db configs (config,system) for all "executables" --- boot.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index f66cf4bc0..ff036c3df 100644 --- a/boot.php +++ b/boot.php @@ -498,9 +498,6 @@ function install_plugin($plugin){ if(! function_exists('check_config')) { function check_config(&$a) { - - load_config('system'); - $build = get_config('system','build'); if(! x($build)) $build = set_config('system','build',DB_UPDATE_VERSION); @@ -1218,7 +1215,11 @@ function load_config($family) { if(count($r)) { foreach($r as $rr) { $k = $rr['k']; - $a->config[$family][$k] = $rr['v']; + if ($rr['cat'] === 'config') { + $a->config[$k] = $rr['v']; + } else { + $a->config[$family][$k] = $rr['v']; + } } } }} -- cgit v1.2.3 From c5cddc742810c03ab86f6e99b0c4d52071c4b523 Mon Sep 17 00:00:00 2001 From: Fabio Comuni Date: Thu, 30 Jun 2011 16:44:54 +0200 Subject: profile_sidebar hook use byref values in second argument array --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index ff036c3df..768493e44 100644 --- a/boot.php +++ b/boot.php @@ -2430,7 +2430,7 @@ function profile_sidebar($profile) { )); - $arr = array('profile' => $profile, 'entry' => $o); + $arr = array('profile' => &$profile, 'entry' => &$o); call_hooks('profile_sidebar', $arr); -- cgit v1.2.3 From 42a6bc81e9f6ddea5ac61e4b79a75515028dcfae Mon Sep 17 00:00:00 2001 From: Friendika Date: Thu, 30 Jun 2011 15:32:39 -0700 Subject: revup --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index ff036c3df..e303f5fc0 100644 --- a/boot.php +++ b/boot.php @@ -4,7 +4,7 @@ set_time_limit(0); ini_set('pcre.backtrack_limit', 250000); -define ( 'FRIENDIKA_VERSION', '2.2.1026' ); +define ( 'FRIENDIKA_VERSION', '2.2.1027' ); define ( 'DFRN_PROTOCOL_VERSION', '2.21' ); define ( 'DB_UPDATE_VERSION', 1070 ); -- cgit v1.2.3 From cdddfca0b5971d2437eee09ad6985f3df5ae5bfd Mon Sep 17 00:00:00 2001 From: Friendika Date: Thu, 30 Jun 2011 19:02:11 -0700 Subject: photos were not working in private mail --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 1ab00f84b..2160b2548 100644 --- a/boot.php +++ b/boot.php @@ -6,7 +6,7 @@ ini_set('pcre.backtrack_limit', 250000); define ( 'FRIENDIKA_VERSION', '2.2.1027' ); define ( 'DFRN_PROTOCOL_VERSION', '2.21' ); -define ( 'DB_UPDATE_VERSION', 1070 ); +define ( 'DB_UPDATE_VERSION', 1071 ); define ( 'EOL', "
\r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); -- cgit v1.2.3 From 84ee783a2acb3ad0575b8f8cadeda1a009d1bd99 Mon Sep 17 00:00:00 2001 From: Friendika Date: Thu, 30 Jun 2011 20:34:49 -0700 Subject: match the documentation --- boot.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 2160b2548..27c801923 100644 --- a/boot.php +++ b/boot.php @@ -296,6 +296,8 @@ class App { $this->module = str_replace(".", "_", $this->argv[0]); } else { + $this->argc = 1; + $this->argv = array('home'); $this->module = 'home'; } -- cgit v1.2.3 From 481cd708acfd3291eed7eba6af596c541651963c Mon Sep 17 00:00:00 2001 From: Friendika Date: Thu, 30 Jun 2011 21:56:07 -0700 Subject: allow polling to mostly survive minor memory shortages. --- boot.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 27c801923..b81bd9cfc 100644 --- a/boot.php +++ b/boot.php @@ -2908,3 +2908,15 @@ function get_plugin_info($plugin){ } return $info; }} + +if(! function_exists('return_bytes')) { +function return_bytes ($size_str) { + switch (substr ($size_str, -1)) + { + case 'M': case 'm': return (int)$size_str * 1048576; + case 'K': case 'k': return (int)$size_str * 1024; + case 'G': case 'g': return (int)$size_str * 1073741824; + default: return $size_str; + } +}} + -- cgit v1.2.3 From d28d2ff440efba47ad65cf28eab4be96e0ea05b2 Mon Sep 17 00:00:00 2001 From: Friendika Date: Fri, 1 Jul 2011 18:18:01 -0700 Subject: better (more consistent) handling of ostatus contacts --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index b81bd9cfc..2c7836301 100644 --- a/boot.php +++ b/boot.php @@ -4,7 +4,7 @@ set_time_limit(0); ini_set('pcre.backtrack_limit', 250000); -define ( 'FRIENDIKA_VERSION', '2.2.1027' ); +define ( 'FRIENDIKA_VERSION', '2.2.1028' ); define ( 'DFRN_PROTOCOL_VERSION', '2.21' ); define ( 'DB_UPDATE_VERSION', 1071 ); -- cgit v1.2.3 From 9534e335aa3e6897c4714086a71e8c4df088f035 Mon Sep 17 00:00:00 2001 From: Friendika Date: Fri, 1 Jul 2011 18:21:55 -0700 Subject: doco --- boot.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 2c7836301..120fb4660 100644 --- a/boot.php +++ b/boot.php @@ -56,9 +56,9 @@ define ( 'REGISTER_OPEN', 2 ); * this relationship with contact['name'] */ -define ( 'REL_VIP', 1); -define ( 'REL_FAN', 2); -define ( 'REL_BUD', 3); +define ( 'REL_VIP', 1); // other person is 'following' us +define ( 'REL_FAN', 2); // we are 'following' other person +define ( 'REL_BUD', 3); // mutual relationship /** * Hook array order -- cgit v1.2.3 From ccb00d68827b1ec7ebc4e9c436e4f70354d1c9c4 Mon Sep 17 00:00:00 2001 From: Friendika Date: Fri, 1 Jul 2011 19:29:56 -0700 Subject: set user-agent --- boot.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 120fb4660..b9b8871d4 100644 --- a/boot.php +++ b/boot.php @@ -673,7 +673,7 @@ function fetch_url($url,$binary = false, &$redirects = 0) { curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER,true); - + curl_setopt($ch, CURLOPT_USERAGENT, "Friendika"); $curl_time = intval(get_config('system','curl_timeout')); curl_setopt($ch, CURLOPT_TIMEOUT, (($curl_time !== false) ? $curl_time : 60)); @@ -749,6 +749,7 @@ function post_url($url,$params, $headers = null, &$redirects = 0) { curl_setopt($ch, CURLOPT_RETURNTRANSFER,true); curl_setopt($ch, CURLOPT_POST,1); curl_setopt($ch, CURLOPT_POSTFIELDS,$params); + curl_setopt($ch, CURLOPT_USERAGENT, "Friendika"); $curl_time = intval(get_config('system','curl_timeout')); curl_setopt($ch, CURLOPT_TIMEOUT, (($curl_time !== false) ? $curl_time : 60)); -- cgit v1.2.3 From fb0e758ce79c5c6a70d41766e3581bf756881d03 Mon Sep 17 00:00:00 2001 From: Friendika Date: Fri, 1 Jul 2011 22:36:33 -0700 Subject: add some indexes to photos --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index b9b8871d4..1807ff1c4 100644 --- a/boot.php +++ b/boot.php @@ -6,7 +6,7 @@ ini_set('pcre.backtrack_limit', 250000); define ( 'FRIENDIKA_VERSION', '2.2.1028' ); define ( 'DFRN_PROTOCOL_VERSION', '2.21' ); -define ( 'DB_UPDATE_VERSION', 1071 ); +define ( 'DB_UPDATE_VERSION', 1072 ); define ( 'EOL', "
\r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); -- cgit v1.2.3 From 07dc1c3ca931322af683edf9791ef47e295ca6cc Mon Sep 17 00:00:00 2001 From: Friendika Date: Sat, 2 Jul 2011 17:56:57 -0700 Subject: db support for starred (favorited) items --- boot.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 1807ff1c4..5ff8b50af 100644 --- a/boot.php +++ b/boot.php @@ -4,9 +4,9 @@ set_time_limit(0); ini_set('pcre.backtrack_limit', 250000); -define ( 'FRIENDIKA_VERSION', '2.2.1028' ); +define ( 'FRIENDIKA_VERSION', '2.2.1029' ); define ( 'DFRN_PROTOCOL_VERSION', '2.21' ); -define ( 'DB_UPDATE_VERSION', 1072 ); +define ( 'DB_UPDATE_VERSION', 1073 ); define ( 'EOL', "
\r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); -- cgit v1.2.3 From cffc4ef14d5ce10411f9e8f01638e9ba523f3c81 Mon Sep 17 00:00:00 2001 From: Friendika Date: Sun, 3 Jul 2011 00:34:56 -0700 Subject: alter test for http continuation header. Use regex, ignore length. --- boot.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 5ff8b50af..35adae330 100644 --- a/boot.php +++ b/boot.php @@ -704,7 +704,7 @@ function fetch_url($url,$binary = false, &$redirects = 0) { $http_code = intval(curl_getinfo($ch, CURLINFO_HTTP_CODE)); $header = substr($s,0,strpos($s,"\r\n\r\n")); - if(stristr($header,'100') && (strlen($header) < 30)) { + if(preg_match('/HTTP\/.+? 100/',$header)) { // 100 Continue has two headers, get the real one $s = substr($s,strlen($header)+4); $header = substr($s,0,strpos($s,"\r\n\r\n")); @@ -777,7 +777,7 @@ function post_url($url,$params, $headers = null, &$redirects = 0) { $http_code = intval(curl_getinfo($ch, CURLINFO_HTTP_CODE)); $header = substr($s,0,strpos($s,"\r\n\r\n")); - if(stristr($header,'100') && (strlen($header) < 30)) { + if(preg_match('/HTTP\/.+? 100/',$header)) { // 100 Continue has two headers, get the real one $s = substr($s,strlen($header)+4); $header = substr($s,0,strpos($s,"\r\n\r\n")); -- cgit v1.2.3 From 12b114f6adfa3f4cd1a50c832509f7205e5b7284 Mon Sep 17 00:00:00 2001 From: Friendika Date: Sun, 3 Jul 2011 02:19:43 -0700 Subject: use another method to strip out headers --- boot.php | 44 ++++++++++++++------------------------------ 1 file changed, 14 insertions(+), 30 deletions(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 35adae330..0e9abddd3 100644 --- a/boot.php +++ b/boot.php @@ -702,13 +702,12 @@ function fetch_url($url,$binary = false, &$redirects = 0) { $s = @curl_exec($ch); - $http_code = intval(curl_getinfo($ch, CURLINFO_HTTP_CODE)); - $header = substr($s,0,strpos($s,"\r\n\r\n")); - if(preg_match('/HTTP\/.+? 100/',$header)) { - // 100 Continue has two headers, get the real one - $s = substr($s,strlen($header)+4); - $header = substr($s,0,strpos($s,"\r\n\r\n")); - } + $curl_info = curl_getinfo($ch); + $header_size = $curl_info['header_size']; + $http_code = $curl_info['http_code']; + + $header = substr($s,0,$header_size); + if($http_code == 301 || $http_code == 302 || $http_code == 303 || $http_code == 307) { $matches = array(); preg_match('/(Location:|URI:)(.*?)\n/', $header, $matches); @@ -721,14 +720,7 @@ function fetch_url($url,$binary = false, &$redirects = 0) { } $a->set_curl_code($http_code); - $body = substr($s,strlen($header)+4); - - /* one more try to make sure there are no more headers */ - - if(strpos($body,'HTTP/') === 0) { - $header = substr($body,0,strpos($body,"\r\n\r\n")); - $body = substr($body,strlen($header)+4); - } + $body = substr($s,$header_size); $a->set_curl_headers($header); @@ -775,13 +767,12 @@ function post_url($url,$params, $headers = null, &$redirects = 0) { $s = @curl_exec($ch); - $http_code = intval(curl_getinfo($ch, CURLINFO_HTTP_CODE)); - $header = substr($s,0,strpos($s,"\r\n\r\n")); - if(preg_match('/HTTP\/.+? 100/',$header)) { - // 100 Continue has two headers, get the real one - $s = substr($s,strlen($header)+4); - $header = substr($s,0,strpos($s,"\r\n\r\n")); - } + $curl_info = curl_getinfo($ch); + $header_size = $curl_info['header_size']; + $http_code = $curl_info['http_code']; + + $header = substr($s,0,$header_size); + if($http_code == 301 || $http_code == 302 || $http_code == 303) { $matches = array(); preg_match('/(Location:|URI:)(.*?)\n/', $header, $matches); @@ -793,14 +784,7 @@ function post_url($url,$params, $headers = null, &$redirects = 0) { } } $a->set_curl_code($http_code); - $body = substr($s,strlen($header)+4); - - /* one more try to make sure there are no more headers */ - - if(strpos($body,'HTTP/') === 0) { - $header = substr($body,0,strpos($body,"\r\n\r\n")); - $body = substr($body,strlen($header)+4); - } + $body = substr($s,$header_size); $a->set_curl_headers($header); -- cgit v1.2.3 From 34df1538f33c2d7b4e1e24e47735c7168c586b97 Mon Sep 17 00:00:00 2001 From: Friendika Date: Sun, 3 Jul 2011 03:47:18 -0700 Subject: one more try at splitting out multiple (> 2) http headers in curl --- boot.php | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 0e9abddd3..459bec217 100644 --- a/boot.php +++ b/boot.php @@ -702,11 +702,20 @@ function fetch_url($url,$binary = false, &$redirects = 0) { $s = @curl_exec($ch); + $base = $s; $curl_info = curl_getinfo($ch); - $header_size = $curl_info['header_size']; $http_code = $curl_info['http_code']; - $header = substr($s,0,$header_size); + $header = ''; + + // Pull out multiple headers, e.g. proxy and continuation headers + // allow for HTTP/2.x without fixing code + + while(preg_match('/^HTTP\/[1-2].+? [1-5][0-9][0-9]/',$base)) { + $chunk = substr($base,0,strpos($base,"\r\n\r\n")+4); + $header .= $chunk; + $base = substr($base,strlen($chunk)); + } if($http_code == 301 || $http_code == 302 || $http_code == 303 || $http_code == 307) { $matches = array(); @@ -718,9 +727,10 @@ function fetch_url($url,$binary = false, &$redirects = 0) { return fetch_url($url,$binary,$redirects); } } + $a->set_curl_code($http_code); - $body = substr($s,$header_size); + $body = substr($s,strlen($header)); $a->set_curl_headers($header); @@ -767,11 +777,20 @@ function post_url($url,$params, $headers = null, &$redirects = 0) { $s = @curl_exec($ch); + $base = $s; $curl_info = curl_getinfo($ch); - $header_size = $curl_info['header_size']; $http_code = $curl_info['http_code']; - $header = substr($s,0,$header_size); + $header = ''; + + // Pull out multiple headers, e.g. proxy and continuation headers + // allow for HTTP/2.x without fixing code + + while(preg_match('/^HTTP\/[1-2].+? [1-5][0-9][0-9]/',$base)) { + $chunk = substr($base,0,strpos($base,"\r\n\r\n")+4); + $header .= $chunk; + $base = substr($base,strlen($chunk)); + } if($http_code == 301 || $http_code == 302 || $http_code == 303) { $matches = array(); @@ -784,7 +803,7 @@ function post_url($url,$params, $headers = null, &$redirects = 0) { } } $a->set_curl_code($http_code); - $body = substr($s,$header_size); + $body = substr($s,strlen($header)); $a->set_curl_headers($header); -- cgit v1.2.3 From 5ceeb6752d645036b832077d88b71a8825952322 Mon Sep 17 00:00:00 2001 From: Friendika Date: Sun, 3 Jul 2011 19:41:04 -0700 Subject: starred items --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'boot.php') diff --git a/boot.php b/boot.php index 459bec217..855a67dfd 100644 --- a/boot.php +++ b/boot.php @@ -4,7 +4,7 @@ set_time_limit(0); ini_set('pcre.backtrack_limit', 250000); -define ( 'FRIENDIKA_VERSION', '2.2.1029' ); +define ( 'FRIENDIKA_VERSION', '2.2.1030' ); define ( 'DFRN_PROTOCOL_VERSION', '2.21' ); define ( 'DB_UPDATE_VERSION', 1073 ); -- cgit v1.2.3