Skip to content

Commit f8b2def

Browse files
authored
Agent communication protocol (#9175)
* Agent communication protocol Add brotli compression support Add accepted encodings Add common headers for agent Use common headers on inventory requests Work with new protocol
1 parent 90fc4b5 commit f8b2def

File tree

8 files changed

+999
-353
lines changed

8 files changed

+999
-353
lines changed

.composer-require-checker.config.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,11 @@
6262
"sodium_crypto_aead_chacha20poly1305_ietf_keygen", "SODIUM_CRYPTO_AEAD_XCHACHA20POLY1305_IETF_NPUBBYTES", "sodium_crypto_aead_xchacha20poly1305_ietf_encrypt", "sodium_crypto_aead_xchacha20poly1305_ietf_decrypt",
6363

6464
"//xhprof",
65-
"XHPROF_FLAGS_NO_BUILTINS", "XHPROF_FLAGS_CPU", "XHPROF_FLAGS_MEMORY"
65+
"XHPROF_FLAGS_NO_BUILTINS", "XHPROF_FLAGS_CPU", "XHPROF_FLAGS_MEMORY",
66+
67+
"//brotli compression",
68+
"brotli_uncompress",
69+
"brotli_compress"
6670
],
6771
"scan-files": [
6872
"ajax/**/*.php",

front/inventory.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
include ('../inc/includes.php');
3636

3737
$inventory_request = new Request();
38-
38+
$inventory_request->handleHeaders();
3939

4040
$handle = true;
4141
if (isset($_GET['refused'])) {
@@ -61,10 +61,10 @@
6161
$redirect_url = $refused->handleInventoryRequest($inventory_request);
6262
Html::redirect($redirect_url);
6363
} else {
64-
header('Content-Type: ' . $inventory_request->getContentType());
65-
header('Cache-Control: no-cache,no-store');
66-
header('Pragma: no-cache');
67-
header('Connection: close');
68-
64+
$headers = $inventory_request->getHeaders(true);
65+
http_response_code($inventory_request->getHttpResponseCode());
66+
foreach ($headers as $key => $value) {
67+
header(sprintf('%1$s: %2$s', $key, $value));
68+
}
6969
echo $inventory_request->getResponse();
7070
}

0 commit comments

Comments
 (0)