Skip to content

Commit 588edbf

Browse files
committed
Ensure upload size calculation includes the size of the headers sent (including any sent in redirected requests)
1 parent ef8f053 commit 588edbf

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Browser.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ class Browser {
6666
CURLOPT_TCP_NODELAY => true,
6767
CURLOPT_UPLOAD_BUFFERSIZE => 10485764*2, //Increase the upload buffer
6868
//CURLOPT_VERBOSE => true,
69+
//CURLINFO_HEADER_OUT => true,
6970
//CURLOPT_HSTS_ENABLE => true, //PHP8.2
7071
];
7172

@@ -581,13 +582,14 @@ private function constructResponseFromCurl(CurlHandle $curl, string $rawHeaders,
581582
$headers['X-Certificate'] = $certs[0]['Cert'];
582583
}
583584

585+
$uploadSize = $info['request_size'] + $info['size_upload'];
584586
$downloadSize = $info['header_size'] + $info['size_download'];
585587

586588
$headers['X-Connection'] = [
587589
"effective_url=" . $info['url'],
588590
"connection;count=" . curl_getinfo($curl, CURLINFO_NUM_CONNECTS),
589591
"redirect;count=" . $redirectCount,
590-
"upload;size=" . $info['size_upload'] . ";speed=" . curl_getinfo($curl, CURLINFO_SPEED_UPLOAD_T),
592+
"upload;size=$uploadSize;speed=" . curl_getinfo($curl, CURLINFO_SPEED_UPLOAD_T),
591593
"download;size=$downloadSize;speed=" . curl_getinfo($curl, CURLINFO_SPEED_DOWNLOAD_T),
592594
];
593595

0 commit comments

Comments
 (0)