-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathboot.php
77 lines (62 loc) · 2.37 KB
/
boot.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?php
/**
* OpenTHC P2P - Bootstrap
*
* This file is part of OpenTHC P2P Application
*
* OpenTHC P2P Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as published by
* the Free Software Foundation.
*
* OpenTHC P2P Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with OpenTHC P2P Application. If not, see <https://www.gnu.org/licenses/>.
*/
// Update to your own values
define('APP_HOST', 'p2p.openthc.org');
define('APP_NAME', 'OpenTHC P2P');
define('APP_ROOT', __DIR__);
define('APP_SITE', 'https://' . APP_HOST);
define('APP_SALT', sha1(APP_HOST . APP_NAME . APP_ROOT . APP_SITE));
error_reporting(E_ALL & ~ E_NOTICE);
openlog('openthc-p2p', LOG_ODELAY|LOG_PID, LOG_LOCAL0);
// Composer Stuff
$fva = APP_ROOT . '/vendor/autoload.php';
if (!is_file($fva)) {
echo "You must run composer first\n";
exit(1);
}
require_once($fva);
// You may want to tweak stuff here to bootstrap your own environment.
function _curl_init($url)
{
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
// Booleans
curl_setopt($ch, CURLOPT_AUTOREFERER, true);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
curl_setopt($ch, CURLOPT_COOKIESESSION, false);
curl_setopt($ch, CURLOPT_CRLF, false);
curl_setopt($ch, CURLOPT_FAILONERROR, false);
curl_setopt($ch, CURLOPT_FILETIME, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
//curl_setopt($ch, CURLOPT_FORBID_REUSE, false);
//curl_setopt($ch, CURLOPT_FRESH_CONNECT, false);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_NETRC, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLINFO_HEADER_OUT,true);
// curl_setopt($ch, CURLOPT_BUFFERSIZE, 16384);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
// curl_setopt($ch, CURLOPT_SSLVERSION, 3); // 2, 3 or GnuTLS
curl_setopt($ch, CURLOPT_MAXREDIRS, 0);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_USERAGENT, 'OpenTHC/P2P v420.17.248');
return $ch;
}