Skip to content

Commit

Permalink
Merged pull request #661
Browse files Browse the repository at this point in the history
  • Loading branch information
derickr committed Sep 30, 2020
2 parents 539e2bb + 925badd commit c39e010
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 18 deletions.
8 changes: 4 additions & 4 deletions src/debugger/com.c
Expand Up @@ -374,11 +374,11 @@ static void xdebug_init_normal_debugger(xdebug_str *connection_attempts)
}

xdebug_log(XLOG_CHAN_DEBUG, XLOG_INFO, "Checking remote connect back address.");
if (XINI_DBG(remote_addr_header) && XINI_DBG(remote_addr_header)[0]) {
header = XINI_DBG(remote_addr_header);
xdebug_log(XLOG_CHAN_DEBUG, XLOG_INFO, "Checking user configured header '%s'.", XINI_DBG(remote_addr_header));
if (XINI_DBG(client_discovery_header) && XINI_DBG(client_discovery_header)[0]) {
header = XINI_DBG(client_discovery_header);
xdebug_log(XLOG_CHAN_DEBUG, XLOG_INFO, "Checking user configured header '%s'.", XINI_DBG(client_discovery_header));

remote_addr = zend_hash_str_find(Z_ARRVAL(PG(http_globals)[TRACK_VARS_SERVER]), XINI_DBG(remote_addr_header), HASH_KEY_STRLEN(XINI_DBG(remote_addr_header)));
remote_addr = zend_hash_str_find(Z_ARRVAL(PG(http_globals)[TRACK_VARS_SERVER]), XINI_DBG(client_discovery_header), HASH_KEY_STRLEN(XINI_DBG(client_discovery_header)));
}
if (!remote_addr) {
header = "HTTP_X_FORWARDED_FOR";
Expand Down
2 changes: 1 addition & 1 deletion src/debugger/debugger.h
Expand Up @@ -54,7 +54,7 @@ typedef struct _xdebug_debugger_settings_t {
zend_long client_port; /* 9000 */
char *client_host; /* localhost */
zend_bool discover_client_host; /* (try to) connect back to the HTTP requestor */
char *remote_addr_header; /* User configured header to check for forwarded IP address */
char *client_discovery_header; /* User configured header to check for forwarded IP address */
zend_long connect_timeout_ms; /* Timeout in MS for remote connections */

char *ide_key_setting; /* Set through php.ini and friends */
Expand Down
2 changes: 1 addition & 1 deletion tests/debugger/bug01656.phpt
Expand Up @@ -5,7 +5,7 @@ I_LIKE_COOKIES=127.0.0.1, 127.0.0.2
XDEBUG_CONFIG="idekey=foobar"
--INI--
xdebug.mode=debug
xdebug.remote_addr_header=I_LIKE_COOKIES
xdebug.client_discovery_header=I_LIKE_COOKIES
xdebug.discover_client_host=1
xdebug.client_port=9999
--FILE--
Expand Down
2 changes: 1 addition & 1 deletion tests/debugger/remote_log-unix-2.phpt
Expand Up @@ -14,7 +14,7 @@ xdebug.log={TMPDIR}/{RUNID}remote-unix.txt
xdebug.discover_client_host=1
xdebug.client_host=unix:///tmp/xdbg.sock
xdebug.client_port=0
xdebug.remote_addr_header=I_LIKE_COOKIES
xdebug.client_discovery_header=I_LIKE_COOKIES
--FILE--
<?php
echo strlen("foo"), "\n";
Expand Down
2 changes: 1 addition & 1 deletion tests/debugger/remote_log-win.phpt
Expand Up @@ -14,7 +14,7 @@ xdebug.log=C:\Windows\Temp\remote-log4.txt
xdebug.discover_client_host=1
xdebug.client_host=doesnotexist2
xdebug.client_port=9003
xdebug.remote_addr_header=I_LIKE_COOKIES
xdebug.client_discovery_header=I_LIKE_COOKIES
--FILE--
<?php
@unlink ("C:\\Windows\\Temp\\remote-log4.txt");
Expand Down
4 changes: 2 additions & 2 deletions tests/debugger/remote_log3.phpt
@@ -1,5 +1,5 @@
--TEST--
Test for Xdebug's remote log (with xdebug.remote_addr_header)
Test for Xdebug's remote log (with xdebug.client_discovery_header)
--SKIPIF--
<?php
require __DIR__ . '/../utils.inc';
Expand All @@ -12,7 +12,7 @@ xdebug.log={TMPDIR}/{RUNID}remote-log3.txt
xdebug.discover_client_host=1
xdebug.client_host=doesnotexist2
xdebug.client_port=9003
xdebug.remote_addr_header=I_LIKE_COOKIES
xdebug.client_discovery_header=I_LIKE_COOKIES
--FILE--
<?php
echo strlen("foo"), "\n";
Expand Down
4 changes: 2 additions & 2 deletions tests/debugger/remote_log4.phpt
@@ -1,5 +1,5 @@
--TEST--
Test for Xdebug's remote log (with xdebug.remote_addr_header value)
Test for Xdebug's remote log (with xdebug.client_discovery_header value)
--SKIPIF--
<?php
require __DIR__ . '/../utils.inc';
Expand All @@ -14,7 +14,7 @@ xdebug.log={TMPDIR}/{RUNID}remote-log4.txt
xdebug.discover_client_host=1
xdebug.client_host=doesnotexist2
xdebug.client_port=9003
xdebug.remote_addr_header=I_LIKE_COOKIES
xdebug.client_discovery_header=I_LIKE_COOKIES
--FILE--
<?php
echo strlen("foo"), "\n";
Expand Down
12 changes: 6 additions & 6 deletions xdebug.c
Expand Up @@ -268,12 +268,12 @@ PHP_INI_BEGIN()
STD_PHP_INI_ENTRY("xdebug.cloud.userid", "", PHP_INI_SYSTEM, OnUpdateString, settings.debugger.cloud_userid, zend_xdebug_globals, xdebug_globals)

/* Remote debugger settings */
STD_PHP_INI_ENTRY("xdebug.client_host", "localhost", PHP_INI_ALL, OnUpdateString, settings.debugger.client_host, zend_xdebug_globals, xdebug_globals)
STD_PHP_INI_ENTRY("xdebug.client_port", "9003", PHP_INI_ALL, OnUpdateLong, settings.debugger.client_port, zend_xdebug_globals, xdebug_globals)
STD_PHP_INI_BOOLEAN("xdebug.discover_client_host", "0", PHP_INI_ALL, OnUpdateBool, settings.debugger.discover_client_host, zend_xdebug_globals, xdebug_globals)
STD_PHP_INI_ENTRY("xdebug.idekey", "", PHP_INI_ALL, OnUpdateString, settings.debugger.ide_key_setting, zend_xdebug_globals, xdebug_globals)
STD_PHP_INI_ENTRY("xdebug.remote_addr_header", "", PHP_INI_ALL, OnUpdateString, settings.debugger.remote_addr_header, zend_xdebug_globals, xdebug_globals)
STD_PHP_INI_ENTRY("xdebug.connect_timeout_ms", "200", PHP_INI_ALL, OnUpdateLong, settings.debugger.connect_timeout_ms, zend_xdebug_globals, xdebug_globals)
STD_PHP_INI_ENTRY("xdebug.client_host", "localhost", PHP_INI_ALL, OnUpdateString, settings.debugger.client_host, zend_xdebug_globals, xdebug_globals)
STD_PHP_INI_ENTRY("xdebug.client_port", "9003", PHP_INI_ALL, OnUpdateLong, settings.debugger.client_port, zend_xdebug_globals, xdebug_globals)
STD_PHP_INI_BOOLEAN("xdebug.discover_client_host", "0", PHP_INI_ALL, OnUpdateBool, settings.debugger.discover_client_host, zend_xdebug_globals, xdebug_globals)
STD_PHP_INI_ENTRY("xdebug.client_discovery_header", "", PHP_INI_ALL, OnUpdateString, settings.debugger.client_discovery_header, zend_xdebug_globals, xdebug_globals)
STD_PHP_INI_ENTRY("xdebug.idekey", "", PHP_INI_ALL, OnUpdateString, settings.debugger.ide_key_setting, zend_xdebug_globals, xdebug_globals)
STD_PHP_INI_ENTRY("xdebug.connect_timeout_ms", "200", PHP_INI_ALL, OnUpdateLong, settings.debugger.connect_timeout_ms, zend_xdebug_globals, xdebug_globals)

/* Scream support */
STD_PHP_INI_BOOLEAN("xdebug.scream", "0", PHP_INI_ALL, OnUpdateBool, settings.develop.do_scream, zend_xdebug_globals, xdebug_globals)
Expand Down

0 comments on commit c39e010

Please sign in to comment.