Skip to content

Add support for CURLINFO_QUEUE_TIME_T in curl_getinfo() #19147

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Jul 17, 2025
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions UPGRADING
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,11 @@ PHP 8.5 UPGRADE NOTES
used by a cURL transfer. It is primarily useful when connection reuse or
connection pooling logic is needed in PHP-level applications. When
curl_getinfo() returns an array, this value is available as the "conn_id" key.
. Added support for CURLINFO_QUEUE_TIME_T (libcurl >= 8.6.0) to the curl_getinfo()
function. This constant allows retrieving the time (in microseconds) that the
request spent in libcurl’s connection queue before it was sent.
This value can also be retrieved by passing CURLINFO_QUEUE_TIME_T to the
curl_getinfo() $option parameter. This requires libcurl 8.6.0 or later.

- DOM:
. Added Dom\Element::$outerHTML.
Expand Down Expand Up @@ -523,6 +528,7 @@ PHP 8.5 UPGRADE NOTES
. CURLINFO_HTTPAUTH_USED.
. CURLINFO_PROXYAUTH_USED.
. CURLINFO_CONN_ID.
. CURLINFO_QUEUE_TIME_T.
. CURLOPT_INFILESIZE_LARGE.
. CURLFOLLOW_ALL.
. CURLFOLLOW_OBEYCODE.
Expand Down
7 changes: 7 additions & 0 deletions ext/curl/curl.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -3054,6 +3054,13 @@
* @cvalue CURLAUTH_BEARER
*/
const CURLAUTH_BEARER = UNKNOWN;
#if LIBCURL_VERSION_NUM >= 0x080600 /* Available since 8.6.0 */
/**
* @var int
* @cvalue CURLINFO_QUEUE_TIME_T
*/
const CURLINFO_QUEUE_TIME_T = UNKNOWN;
#endif
/**
* @var int
* @cvalue CURLINFO_APPCONNECT_TIME_T
Expand Down
5 changes: 4 additions & 1 deletion ext/curl/curl_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions ext/curl/interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -2571,6 +2571,11 @@ PHP_FUNCTION(curl_getinfo)
if (curl_easy_getinfo(ch->cp, CURLINFO_APPCONNECT_TIME_T, &co) == CURLE_OK) {
CAAL("appconnect_time_us", co);
}
#if LIBCURL_VERSION_NUM >= 0x080600 /* Available since 8.6.0 */
if (curl_easy_getinfo(ch->cp, CURLINFO_QUEUE_TIME_T , &co) == CURLE_OK) {
CAAL("queue_time_us", co);
}
#endif
if (curl_easy_getinfo(ch->cp, CURLINFO_CONNECT_TIME_T, &co) == CURLE_OK) {
CAAL("connect_time_us", co);
}
Expand Down
41 changes: 41 additions & 0 deletions ext/curl/tests/curl_getinfo_CURLINFO_QUEUE_TIME_T.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
--TEST--
Curlinfo CURLINFO_QUEUE_TIME_T
--EXTENSIONS--
curl
--SKIPIF--
<?php
$curl_version = curl_version();
if ($curl_version['version_number'] < 0x080600) die("skip: test works only with curl >= 8.6.0");
?>
--FILE--
<?php
include 'server.inc';

$host = curl_cli_server_start();
$port = (int) (explode(':', $host))[1];

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "{$host}/get.inc?test=file");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$info = curl_getinfo($ch);
var_dump(isset($info['queue_time_us']));
var_dump($info['queue_time_us'] === 0); // this is always 0 before executing the transfer

$result = curl_exec($ch);

$info = curl_getinfo($ch);
var_dump(isset($info['queue_time_us']));
var_dump(is_int($info['queue_time_us']));
var_dump(curl_getinfo($ch, CURLINFO_QUEUE_TIME_T) === $info['queue_time_us']);
var_dump(curl_getinfo($ch, CURLINFO_QUEUE_TIME_T) > 0);

?>
--EXPECT--
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)