kopia lustrzana https://github.com/nextcloud/social
user agent in requests
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>pull/62/head
rodzic
527313d4a9
commit
b27e31ad5d
|
@ -12,12 +12,12 @@
|
|||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/daita/my-small-php-tools.git",
|
||||
"reference": "ba839f3253672defc4bbb181493c78e2c96e272a"
|
||||
"reference": "12090dc3ae29d2eb49d5274ca3f6ebfb76ce5997"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/daita/my-small-php-tools/zipball/ba839f3253672defc4bbb181493c78e2c96e272a",
|
||||
"reference": "ba839f3253672defc4bbb181493c78e2c96e272a",
|
||||
"url": "https://api.github.com/repos/daita/my-small-php-tools/zipball/12090dc3ae29d2eb49d5274ca3f6ebfb76ce5997",
|
||||
"reference": "12090dc3ae29d2eb49d5274ca3f6ebfb76ce5997",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -40,7 +40,7 @@
|
|||
}
|
||||
],
|
||||
"description": "My small PHP Tools",
|
||||
"time": "2018-11-27T14:31:43+00:00"
|
||||
"time": "2018-11-28T10:47:43+00:00"
|
||||
}
|
||||
],
|
||||
"packages-dev": [],
|
||||
|
|
|
@ -44,6 +44,7 @@ class CurlService {
|
|||
|
||||
|
||||
const ASYNC_TOKEN = '/async/token/{token}';
|
||||
const USER_AGENT = 'Nextcloud Social';
|
||||
|
||||
|
||||
/** @var ConfigService */
|
||||
|
@ -104,6 +105,13 @@ class CurlService {
|
|||
}
|
||||
|
||||
|
||||
public function assignUserAgent(Request $request) {
|
||||
$request->setUserAgent(
|
||||
self::USER_AGENT . ' ' . $this->configService->getAppValue('installed_version')
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $token
|
||||
*
|
||||
|
@ -139,6 +147,7 @@ class CurlService {
|
|||
|
||||
$headers[] = 'Accept: application/ld+json; profile="https://www.w3.org/ns/activitystreams"';
|
||||
|
||||
curl_setopt($curl, CURLOPT_USERAGENT, $request->getUserAgent());
|
||||
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10);
|
||||
curl_setopt($curl, CURLOPT_TIMEOUT, 20);
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue