MantisBT

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000598XdebugFeature/Change requestpublic2010-07-23 15:152012-09-07 11:03
Reportersarnowski 
Assigned Toderick 
PrioritynormalSeveritytweakReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version2.2dev 
Target Version2.2.2Fixed in Version2.2.2 
Summary0000598: Use HTTP_X_FORWARDED_FOR to determine remote debugger
DescriptionUse HTTP_X_FORWARDED_FOR in addition to REMOTE_ADDR to determine the remote debugger. With the following patch, xdebug can handle debuggers even if the webserver runs behind a loadbalancer/proxy.
Additional Information~/xdebug # svn diff
Index: xdebug_stack.c
===================================================================
--- xdebug_stack.c (revision 3323)
+++ xdebug_stack.c (working copy)
@@ -417,7 +417,10 @@
        if (!XG(remote_enabled) && XG(remote_enable) && (XG(remote_mode) == XDEBUG_JIT)) {
                if (XG(remote_connect_back)) {
                        zval **remote_addr = NULL;
- zend_hash_find(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER]), "REMOTE_ADDR", 12, (void**)&remote_addr);
+ zend_hash_find(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER]), "HTTP_X_FORWARDED_FOR", 21, (void**)&remote_addr);
+ if (!remote_addr) {
+ zend_hash_find(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER]), "REMOTE_ADDR", 12, (void**)&remote_addr);
+ }
                        XG(context).socket = xdebug_create_socket(Z_STRVAL_PP(remote_addr), XG(remote_port));
                } else {
                        XG(context).socket = xdebug_create_socket(XG(remote_host), XG(remote_port));
Index: xdebug.c
===================================================================
--- xdebug.c (revision 3323)
+++ xdebug.c (working copy)
@@ -1158,7 +1158,10 @@
                        /* Initialize debugging session */
                        if (XG(remote_connect_back)) {
                                zval **remote_addr = NULL;
- zend_hash_find(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER]), "REMOTE_ADDR", 12, (void**)&remote_addr);
+ zend_hash_find(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER]), "HTTP_X_FORWARDED_FOR", 21, (void**)&remote_addr);
+ if (!remote_addr) {
+ zend_hash_find(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER]), "REMOTE_ADDR", 12, (void**)&remote_addr);
+ }
                                if (remote_addr) {
                                        XG(context).socket = xdebug_create_socket(Z_STRVAL_PP(remote_addr), XG(remote_port));
                                } else {
TagsNo tags attached.
Operating System
PHP Version5.2.10
Attached Files

- Relationships

-  Notes
(0002340)
darrenoh (reporter)
2012-09-06 18:46

I just ran into this problem. I would really appreciate this feature.
(0002341)
darrenoh (reporter)
2012-09-06 20:18

I see that this feature has already been added.
(0002342)
darrenoh (reporter)
2012-09-06 21:14

Duplicate of 0000660. I have no explanation for why I’m experiencing this problem in version 2.2.1.
(0002343)
darrenoh (reporter)
2012-09-07 00:00

This is a bug. Xdebug is checking for X_HTTP_FORWARDED_FOR instead of HTTP_X_FORWARDED_FOR.
(0002344)
darrenoh (reporter)
2012-09-07 00:34

I have submitted a pull request: https://github.com/derickr/xdebug/pull/30 [^]
(0002345)
derick (administrator)
2012-09-07 11:03

Fixed on github, thanks for the patch! I won't be releasing Xdebug 2.2.2 soon, but I will see if I can compile you some dev binaries.

- Issue History
Date Modified Username Field Change
2010-07-23 15:15 sarnowski New Issue
2010-07-23 15:15 sarnowski PHP Version => 5.2.10
2010-07-23 15:15 sarnowski Xdebug Version => 2.2.0-dev
2012-09-06 18:46 darrenoh Note Added: 0002340
2012-09-06 20:18 darrenoh Note Added: 0002341
2012-09-06 21:14 darrenoh Note Added: 0002342
2012-09-07 00:00 darrenoh Note Added: 0002343
2012-09-07 00:34 darrenoh Note Added: 0002344
2012-09-07 11:02 derick Fixed in Version => 2.2.2
2012-09-07 11:02 derick Target Version => 2.2.2
2012-09-07 11:03 derick Note Added: 0002345
2012-09-07 11:03 derick Status new => closed
2012-09-07 11:03 derick Assigned To => derick
2012-09-07 11:03 derick Resolution open => fixed


Copyright © 2000 - 2017 MantisBT Team
Powered by Mantis Bugtracker