Skip to content

Commit 599d913

Browse files
committed
- add CURLINFO_REDIRECT_URL
1 parent 4aac903 commit 599d913

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

ext/curl/interface.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,10 @@ PHP_MINIT_FUNCTION(curl)
644644
#if LIBCURL_VERSION_NUM > 0x071301
645645
REGISTER_CURL_CONSTANT(CURLINFO_CERTINFO);
646646
#endif
647+
#if LIBCURL_VERSION_NUM >= 0x071202
648+
REGISTER_CURL_CONSTANT(CURLINFO_REDIRECT_URL);
649+
#endif
650+
647651

648652
/* cURL protocol constants (curl_version) */
649653
REGISTER_CURL_CONSTANT(CURL_VERSION_IPV6);
@@ -2346,6 +2350,11 @@ PHP_FUNCTION(curl_getinfo)
23462350
if (curl_easy_getinfo(ch->cp, CURLINFO_LOCAL_PORT, &l_code) == CURLE_OK) {
23472351
CAAL("local_port", l_code);
23482352
}
2353+
#endif
2354+
#if LIBCURL_VERSION_NUM >= 0x071202
2355+
if (curl_easy_getinfo(ch->cp, CURLINFO_REDIRECT_URL, &s_code) == CURLE_OK) {
2356+
CAAS("redirect_url", s_code);
2357+
}
23492358
#endif
23502359
if (ch->header.str_len > 0) {
23512360
CAAS("request_header", ch->header.str);
@@ -2361,7 +2370,11 @@ PHP_FUNCTION(curl_getinfo)
23612370
#endif
23622371
case CURLINFO_PRIVATE:
23632372
case CURLINFO_EFFECTIVE_URL:
2364-
case CURLINFO_CONTENT_TYPE: {
2373+
case CURLINFO_CONTENT_TYPE:
2374+
#if LIBCURL_VERSION_NUM >= 0x071202
2375+
case CURLINFO_REDIRECT_URL:
2376+
#endif
2377+
{
23652378
char *s_code = NULL;
23662379

23672380
if (curl_easy_getinfo(ch->cp, option, &s_code) == CURLE_OK && s_code) {

0 commit comments

Comments
 (0)