You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by "Brett @Google" <br...@gmail.com> on 2012/03/14 10:35:40 UTC

apache 2.4.x and mod_perl 2.0

Hi All,

Apache 2.4.x seems to have changed / deprecated things.. things i have noticed :

in ./src/modules/perl/modperl_constants.c if OPT_INCNOEXEC is not
present, as OPT_INCNOEXEC is now OPT_INCLUDES

c->remote_ip gone, and now split into c->client_ip (tcp endpoint) and
c->useragent_ip (e.g. X-Forwarded-For)

add 3rd argument to ap_add_loaded_module, giving the module's name

remove OPT_INCNOEXEC from ./src/modules/perl/modperl_constants.c -
ifdef it based on presence of OPT_INCNOEXEC

does anybody know the correct way to make the .xs files represent the
*.h defines, for things like OPT_INCNOEXEC rather than hand editing
them ?

eg. It sill has the old c->remote_ip symbols which look like they
might have been originally parsed from the apache source (but not by
default in a build) :

cc -c  -I/home/govops/build-new/mod_perl-2.0-svn/src/modules/perl
-I/home/govops/build-new/mod_perl-2.0-svn/xs
-I/usr/local/directory-libs/include/apr-1
-I/usr/local/apache24/include  -D_REENTRANT -xtarget=ultraT1
-xcode=pic32 -m64 -xarch=generic64 -DDEBUGGING -I/usr/local/include
-DPERL_USE_SAFE_PUTENV -DMOD_PERL -DMP_COMPAT_1X -DSOLARIS2=10
-D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT -O3 -g
-DVERSION=\"2.000006\"  -DXS_VERSION=\"2.000006\" -KPIC
"-I/usr/local/directory-libs/lib/perl5/5.12.2/sun4-solaris-thread-multi-64/CORE"
 -DMP_HAVE_APR_LIBS Connection.c
"Connection.xs", line 117: undefined struct/union member: remote_addr
"Connection.xs", line 134: undefined struct/union member: remote_ip
"Connection.xs", line 138: improper member use: remote_ip
"Connection.xs", line 139: warning: improper pointer/integer combination: op "="
cc: acomp failed for Connection.c
*** Error code 2
make: Fatal error: Command failed for target `Connection.o'
Current working directory
/home/govops/build-new/mod_perl-2.0-svn/WrapXS/Apache2/Connection
*** Error code 1

Cheers
Brett

My local random edits so far are:

svn diff
Index: src/modules/perl/modperl_module.c
===================================================================
--- src/modules/perl/modperl_module.c   (revision 1300466)
+++ src/modules/perl/modperl_module.c   (working copy)
@@ -832,7 +832,7 @@

     modperl_module_insert(modp);

-    ap_add_loaded_module(modp, p);
+    ap_add_loaded_module(modp, p, modp->name);

     apr_pool_cleanup_register(p, modp, modperl_module_remove,
                               apr_pool_cleanup_null);
Index: src/modules/perl/modperl_apache_compat.h
===================================================================
--- src/modules/perl/modperl_apache_compat.h    (revision 1300466)
+++ src/modules/perl/modperl_apache_compat.h    (working copy)
@@ -68,7 +68,7 @@
 #define MP_HTTPD_OVERRIDE_OPTS_UNSET (-1)
 #define MP_HTTPD_OVERRIDE_OPTS_DEFAULT (OPT_UNSET | \
                                         OPT_ALL | \
-                                        OPT_INCNOEXEC | \
+                                        OPT_INCLUDES | \
                                         OPT_SYM_OWNER | \
                                         OPT_MULTI)

Index: src/modules/perl/modperl_interp.c
===================================================================
--- src/modules/perl/modperl_interp.c   (revision 1300466)
+++ src/modules/perl/modperl_interp.c   (working copy)
@@ -500,7 +500,7 @@
                    "set interp 0x%lx in %s 0x%lx (%s request for %s)\n",
                    (unsigned long)interp, desc, (unsigned long)p,
                    (r ? (is_subrequest ? "sub" : "main") : "conn"),
-                   (r ? r->uri : c->remote_ip));
+                   (r ? r->uri : c->client_ip));
     }

     /* set context (THX) for this thread */

--
The only thing that interferes with my learning is my education.

Albert Einstein

Re: apache 2.4.x and mod_perl 2.0

Posted by Torsten Förtsch <to...@gmx.net>.
On Thursday, 15 March 2012 10:28:39 Brett @Google wrote:
> "modperl_interp.c", line 503: undefined struct/union member: remote_ip
> "modperl_interp.c", line 503: warning: improper pointer/integer

The prefork code path is much simpler. For that reason I started with that MPM 
and a perl without ithreads or multiplicity. In that case the part of 
modperl_interp.c that is actually compiled is very short (USE_ITHREADS is not 
defined). 

In short, I didn't get to this point.

Torsten Förtsch

-- 
Need professional modperl support? Hire me! (http://foertsch.name)

Like fantasy? http://kabatinte.net


Re: apache 2.4.x and mod_perl 2.0

Posted by "Kevin A. McGrail" <KM...@PCCC.com>.
On 3/15/2012 2:17 PM, Torsten Förtsch wrote:
> IMHO, we should implement a compatibility function that maps 
> remote_ip() to client_ip and provide the new structure members 
> independently. Torsten Förtsch 

I've got a production box setup now with 2.4.1 installed so I can play 
with mod_perl if we need some testers to get a 2.4.X compatible version 
out the door.

And yes, I think your compatibility function is a good idea for existing 
code so you don't need to modify existing modules to replace  
$c->remote_ip or $c->remote_addr for example (discussed off-list).

Though I think we might consider pushing to mod_perl 2.4.X for httpd 
2.4.X and leave mod_perl 2.X for Apache 2.X.

Torsten, if you respond, let's take this to the dev list.

Regards,
KAM

Re: apache 2.4.x and mod_perl 2.0

Posted by Torsten Förtsch <to...@gmx.net>.
On Thursday, 15 March 2012 10:28:39 Brett @Google wrote:
> "modperl_interp.c", line 503: undefined struct/union member: remote_ip

Further, last fall struct conn_rec was changed again in these commits:

$ svn log -r1206291 -r1204968
------------------------------------------------------------------------
r1206291 | minfrin | 2011-11-25 20:42:04 +0100 (Fri, 25 Nov 2011) | 4 lines

Introduce a per connection "peer_ip" and a per request "client_ip" to
distinguish between the raw IP address of the connection and the effective
IP address of the request.

------------------------------------------------------------------------
r1204968 | minfrin | 2011-11-22 14:10:39 +0100 (Tue, 22 Nov 2011) | 4 lines

Introduce a per request version of the remote IP address, which can be
optionally modified by a module when the effective IP of the client
is not the same as the real IP of the client (such as a load balancer).

------------------------------------------------------------------------

These changes were then at least partly backported to httpd 2.4, see

http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/include/httpd.h?r1=1208378&r2=1214022
http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/include/httpd.h?r1=1204743&r2=1208378

IMHO, we should implement a compatibility function that maps remote_ip() to 
client_ip and provide the new structure members independently.

Torsten Förtsch

-- 
Need professional modperl support? Hire me! (http://foertsch.name)

Like fantasy? http://kabatinte.net


Re: apache 2.4.x and mod_perl 2.0

Posted by "Brett @Google" <br...@gmail.com>.
in Apache-Test/lib/Apache/TestRun.pm line 1100, i commented out the
"use warnings FATAL => 'all';"

i still get :

cc -I/home/govops/build-new/mod_perl-2.0-apache24/src/modules/perl
-I/home/govops/build-new/mod_perl-2.0-apache24/xs
-I/usr/local/directory-libs/include/apr-1
-I/usr/local/directory-libs/include/apr-1
-I/usr/local/directory-libs/include -I/usr/local/directory-lib/include
-I/usr/local/apache24/include -D_REENTRANT -xtarget=ultraT1
-xcode=pic32 -m64 -xarch=generic64 -DDEBUGGING -I/usr/local/include
-DPERL_USE_SAFE_PUTENV
-I/usr/local/directory-libs/lib/perl5/5.12.2/sun4-solaris-thread-multi-64/CORE
-DMOD_PERL -DMP_COMPAT_1X -DSOLARIS2=10 -D_POSIX_PTHREAD_SEMANTICS -O3
-g -KPIC \
-c modperl_interp.c && mv modperl_interp.o modperl_interp.lo
cc: Warning: -xarch=generic64 is deprecated, use -m64 to create 64-bit programs
"modperl_interp.c", line 503: undefined struct/union member: remote_ip
"modperl_interp.c", line 503: warning: improper pointer/integer
combination: op ":"
cc: acomp failed for modperl_interp.c
*** Error code 2

This is the variable that was removed in apache 2.4, as in my previous email :

c->remote_ip gone, and now split into c->client_ip (tcp endpoint) and
c->useragent_ip (e.g. X-Forwarded-For)

Maybe some logic like :

if ($c->useragent_ip exists) then ($ip=$c->useragent_ip) else
($ip=c->client_ip) ?

Cheers
Brett

2012/3/15 Brett @Google <br...@gmail.com>:
> I checked it out and got :
>
> ~/build-new/mod_perl-2.0-apache24> perl Makefile.PL
> MP_APR_CONFIG=/usr/local/apache-libs/bin/apr-1-config
> MP_APXS=/usr/local/apache24/bin/apxs
> Reading Makefile.PL args from @ARGV
>   MP_APR_CONFIG = /usr/local/directory-libs/bin/apr-1-config
>   MP_APXS = /usr/local/apache24/bin/apxs
> no conflicting prior mod_perl version found - good.
> Configuring Apache/2.4.1 mod_perl/2.0.6-dev Perl/v5.12.2
> ERROR from evaluation of
> /home/govops/build-new/mod_perl-2.0-apache24/Apache-Reload/Makefile.PL:
> Use of uninitialized value $v in substitution (s///) at
> Apache-Test/lib/Apache/TestRun.pm line 1100.
>
> I am just using the current apr/apr-util, do i need a special one ?
>
> Cheers
> Brett
>
> 2012/3/14 Brett @Google <br...@gmail.com>:
>> I don't want to re-invent the wheel, i was just poking around in the
>> trunk.. but didn't know there was a 2.4 branch :)
>>
>> I could not see links to anything new on the download page, i'll check
>> out the 2.4 branch now and report back..
>>
>> Maybe you can list the branch under the "Development" links.. with a
>> disclaimer that is is not release quality ?
>>
>> Cheers
>> Brett
>>
>> 2012/3/14 Torsten Förtsch <to...@gmx.net>:
>>> On Wednesday, 14 March 2012 19:35:40 Brett @Google wrote:
>>>> Apache 2.4.x seems to have changed...
>>>
>>> You are very welcome to work on the httpd 2.4 port. But please check out
>>>
>>>  http://svn.apache.org/repos/asf/perl/modperl/branches/httpd24
>>>
>>> as a starting point. It probably compiles and passes most tests.
>>>
>>> Why do you want to do the same work that I have done last summer again?
>>>
>>> Torsten Förtsch
>>>
>>> --
>>> Need professional modperl support? Hire me! (http://foertsch.name)
>>>
>>> Like fantasy? http://kabatinte.net
>>>
>>
>>
>>
>> --
>> The only thing that interferes with my learning is my education.
>>
>> Albert Einstein
>
>
>
> --
> The only thing that interferes with my learning is my education.
>
> Albert Einstein



-- 
The only thing that interferes with my learning is my education.

Albert Einstein

Re: apache 2.4.x and mod_perl 2.0

Posted by "Brett @Google" <br...@gmail.com>.
I checked it out and got :

~/build-new/mod_perl-2.0-apache24> perl Makefile.PL
MP_APR_CONFIG=/usr/local/apache-libs/bin/apr-1-config
MP_APXS=/usr/local/apache24/bin/apxs
Reading Makefile.PL args from @ARGV
   MP_APR_CONFIG = /usr/local/directory-libs/bin/apr-1-config
   MP_APXS = /usr/local/apache24/bin/apxs
no conflicting prior mod_perl version found - good.
Configuring Apache/2.4.1 mod_perl/2.0.6-dev Perl/v5.12.2
ERROR from evaluation of
/home/govops/build-new/mod_perl-2.0-apache24/Apache-Reload/Makefile.PL:
Use of uninitialized value $v in substitution (s///) at
Apache-Test/lib/Apache/TestRun.pm line 1100.

I am just using the current apr/apr-util, do i need a special one ?

Cheers
Brett

2012/3/14 Brett @Google <br...@gmail.com>:
> I don't want to re-invent the wheel, i was just poking around in the
> trunk.. but didn't know there was a 2.4 branch :)
>
> I could not see links to anything new on the download page, i'll check
> out the 2.4 branch now and report back..
>
> Maybe you can list the branch under the "Development" links.. with a
> disclaimer that is is not release quality ?
>
> Cheers
> Brett
>
> 2012/3/14 Torsten Förtsch <to...@gmx.net>:
>> On Wednesday, 14 March 2012 19:35:40 Brett @Google wrote:
>>> Apache 2.4.x seems to have changed...
>>
>> You are very welcome to work on the httpd 2.4 port. But please check out
>>
>>  http://svn.apache.org/repos/asf/perl/modperl/branches/httpd24
>>
>> as a starting point. It probably compiles and passes most tests.
>>
>> Why do you want to do the same work that I have done last summer again?
>>
>> Torsten Förtsch
>>
>> --
>> Need professional modperl support? Hire me! (http://foertsch.name)
>>
>> Like fantasy? http://kabatinte.net
>>
>
>
>
> --
> The only thing that interferes with my learning is my education.
>
> Albert Einstein



-- 
The only thing that interferes with my learning is my education.

Albert Einstein

Re: apache 2.4.x and mod_perl 2.0

Posted by "Brett @Google" <br...@gmail.com>.
I don't want to re-invent the wheel, i was just poking around in the
trunk.. but didn't know there was a 2.4 branch :)

I could not see links to anything new on the download page, i'll check
out the 2.4 branch now and report back..

Maybe you can list the branch under the "Development" links.. with a
disclaimer that is is not release quality ?

Cheers
Brett

2012/3/14 Torsten Förtsch <to...@gmx.net>:
> On Wednesday, 14 March 2012 19:35:40 Brett @Google wrote:
>> Apache 2.4.x seems to have changed...
>
> You are very welcome to work on the httpd 2.4 port. But please check out
>
>  http://svn.apache.org/repos/asf/perl/modperl/branches/httpd24
>
> as a starting point. It probably compiles and passes most tests.
>
> Why do you want to do the same work that I have done last summer again?
>
> Torsten Förtsch
>
> --
> Need professional modperl support? Hire me! (http://foertsch.name)
>
> Like fantasy? http://kabatinte.net
>



-- 
The only thing that interferes with my learning is my education.

Albert Einstein

Re: apache 2.4.x and mod_perl 2.0

Posted by Torsten Förtsch <to...@gmx.net>.
On Wednesday, 14 March 2012 19:35:40 Brett @Google wrote:
> Apache 2.4.x seems to have changed...

You are very welcome to work on the httpd 2.4 port. But please check out

  http://svn.apache.org/repos/asf/perl/modperl/branches/httpd24

as a starting point. It probably compiles and passes most tests.

Why do you want to do the same work that I have done last summer again?

Torsten Förtsch

-- 
Need professional modperl support? Hire me! (http://foertsch.name)

Like fantasy? http://kabatinte.net