Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 7fb6afb

Browse files
Add support for CURLINFO_QUEUE_TIME_T in curl_getinfo() (#19147)
This patch adds support for the CURLINFO_QUEUE_TIME_T constant in the curl_getinfo() function when compiled with libcurl >= 8.6.0. CURLINFO_QUEUE_TIME_T This constant allows retrieving the time (in microseconds) that the request spent in libcurl’s connection queue before it was sent.
1 parent 0e80be8 commit 7fb6afb

File tree

5 files changed

+63
-1
lines changed

5 files changed

+63
-1
lines changed

‎UPGRADING‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,11 @@ PHP 8.5 UPGRADE NOTES
193193
used by a cURL transfer. It is primarily useful when connection reuse or
194194
connection pooling logic is needed in PHP-level applications. When
195195
curl_getinfo() returns an array, this value is available as the "conn_id" key.
196+
. Added support for CURLINFO_QUEUE_TIME_T (libcurl >= 8.6.0) to the curl_getinfo()
197+
function. This constant allows retrieving the time (in microseconds) that the
198+
request spent in libcurl’s connection queue before it was sent.
199+
This value can also be retrieved by passing CURLINFO_QUEUE_TIME_T to the
200+
curl_getinfo() $option parameter.
196201

197202
- DOM:
198203
. Added Dom\Element::$outerHTML.
@@ -526,6 +531,7 @@ PHP 8.5 UPGRADE NOTES
526531
. CURLINFO_HTTPAUTH_USED.
527532
. CURLINFO_PROXYAUTH_USED.
528533
. CURLINFO_CONN_ID.
534+
. CURLINFO_QUEUE_TIME_T.
529535
. CURLOPT_INFILESIZE_LARGE.
530536
. CURLFOLLOW_ALL.
531537
. CURLFOLLOW_OBEYCODE.

‎ext/curl/curl.stub.php‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3054,6 +3054,13 @@
30543054
* @cvalue CURLAUTH_BEARER
30553055
*/
30563056
const CURLAUTH_BEARER = UNKNOWN;
3057+
#if LIBCURL_VERSION_NUM >= 0x080600 /* Available since 8.6.0 */
3058+
/**
3059+
* @var int
3060+
* @cvalue CURLINFO_QUEUE_TIME_T
3061+
*/
3062+
const CURLINFO_QUEUE_TIME_T = UNKNOWN;
3063+
#endif
30573064
/**
30583065
* @var int
30593066
* @cvalue CURLINFO_APPCONNECT_TIME_T

‎ext/curl/curl_arginfo.h‎

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎ext/curl/interface.c‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2571,6 +2571,11 @@ PHP_FUNCTION(curl_getinfo)
25712571
if (curl_easy_getinfo(ch->cp, CURLINFO_APPCONNECT_TIME_T, &co) == CURLE_OK) {
25722572
CAAL("appconnect_time_us", co);
25732573
}
2574+
#if LIBCURL_VERSION_NUM >= 0x080600 /* Available since 8.6.0 */
2575+
if (curl_easy_getinfo(ch->cp, CURLINFO_QUEUE_TIME_T , &co) == CURLE_OK) {
2576+
CAAL("queue_time_us", co);
2577+
}
2578+
#endif
25742579
if (curl_easy_getinfo(ch->cp, CURLINFO_CONNECT_TIME_T, &co) == CURLE_OK) {
25752580
CAAL("connect_time_us", co);
25762581
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
--TEST--
2+
Curlinfo CURLINFO_QUEUE_TIME_T
3+
--EXTENSIONS--
4+
curl
5+
--SKIPIF--
6+
<?php
7+
$curl_version = curl_version();
8+
if ($curl_version['version_number'] < 0x080600) die("skip: test works only with curl >= 8.6.0");
9+
?>
10+
--FILE--
11+
<?php
12+
include 'server.inc';
13+
14+
$host = curl_cli_server_start();
15+
$port = (int) (explode(':', $host))[1];
16+
17+
$ch = curl_init();
18+
curl_setopt($ch, CURLOPT_URL, "{$host}/get.inc?test=file");
19+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
20+
21+
$info = curl_getinfo($ch);
22+
var_dump(isset($info['queue_time_us']));
23+
var_dump($info['queue_time_us'] === 0); // this is always 0 before executing the transfer
24+
25+
$result = curl_exec($ch);
26+
27+
$info = curl_getinfo($ch);
28+
var_dump(isset($info['queue_time_us']));
29+
var_dump(is_int($info['queue_time_us']));
30+
var_dump(curl_getinfo($ch, CURLINFO_QUEUE_TIME_T) === $info['queue_time_us']);
31+
var_dump(curl_getinfo($ch, CURLINFO_QUEUE_TIME_T) > 0);
32+
33+
?>
34+
--EXPECT--
35+
bool(true)
36+
bool(true)
37+
bool(true)
38+
bool(true)
39+
bool(true)
40+
bool(true)
41+

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /