You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by "Beau E. Cox" <be...@beaucox.com> on 2004/04/01 23:38:14 UTC

[PATCH] for Apache2.1

Hello Gerald and all -

I have been testing with Apache2.1/mod_perl 2 and found that the following
two patches are necessary for Embperl to run under Apache2.1.

Both patches have been sucessfully tested under Apache2.0 and Apache2.1.

1) epapfilter.c - 'APR_BRIGADE_FOREACH' has been depreciated and has
finally been removed from 2.1.

--- orig.embperl/epapfilter.c	2004-01-22 20:50:54.000000000 -1000
+++ patched.embperl/epapfilter.c	2004-03-30 15:19:42.000000000 -1000
@@ -206,8 +206,9 @@
     epTHX_
 
 
-    APR_BRIGADE_FOREACH(b, bb) 
-        {
+    for (b = APR_BRIGADE_FIRST(bb);
+         b != APR_BRIGADE_SENTINEL(bb);
+         b = APR_BUCKET_NEXT(b)) {
         /* APR_BUCKET_IS_EOS(b) does give undefined symbol, when running 
outside of Apache */
         /* if (APR_BUCKET_IS_EOS(b)) */
         if (strcmp (b -> type -> name, "EOS") == 0)

2) apr function name changes.

--- embperl.unpatched/mod_embperl.c	2004-03-14 10:17:41.000000000 -1000
+++ embperl/mod_embperl.c	2004-03-31 09:42:10.000000000 -1000
@@ -291,7 +291,7 @@
     dTHX ;
 
 #ifdef APACHE2
-    apr_pool_sub_make(&subpool, p, NULL);
+    apr_pool_create_ex(&subpool, p, NULL, NULL);
 #else
     subpool = ap_make_sub_pool(p);
 #endif
@@ -420,7 +420,7 @@
 static void *embperl_create_dir_config(apr_pool_t * p, char *d)
     {
     /*char buf [20] ;*/
-    tApacheDirConfig *cfg = (tApacheDirConfig *) ap_pcalloc(p, 
sizeof(tApacheDirConfig));
+    tApacheDirConfig *cfg = (tApacheDirConfig *) apr_pcalloc(p, 
sizeof(tApacheDirConfig));
 
     embperl_DefaultReqConfig (&cfg -> ReqConfig) ;
     embperl_DefaultAppConfig (&cfg -> AppConfig) ;
@@ -445,7 +445,7 @@
 
 static void *embperl_create_server_config(apr_pool_t * p, server_rec *s)
     {
-    tApacheDirConfig *cfg = (tApacheDirConfig *) ap_pcalloc(p, 
sizeof(tApacheDirConfig));
+    tApacheDirConfig *cfg = (tApacheDirConfig *) apr_pcalloc(p, 
sizeof(tApacheDirConfig));
 
     bApDebug |= ap_exists_config_define("EMBPERL_APDEBUG") ;
 
@@ -546,7 +546,7 @@
         return addv ;
     
         {
-        tApacheDirConfig *mrg = (tApacheDirConfig *)ap_palloc (p, 
sizeof(tApacheDirConfig));
+        tApacheDirConfig *mrg = (tApacheDirConfig *)apr_palloc (p, 
sizeof(tApacheDirConfig));
         tApacheDirConfig *base = (tApacheDirConfig *)basev;
         tApacheDirConfig *add = (tApacheDirConfig *)addv;
 
@@ -635,7 +635,7 @@
 const char * embperl_Apache_Config_##STRUCT##NAME (cmd_parms *cmd, /* 
tApacheDirConfig */ void * pDirCfg, const char* arg) \
     { \
     apr_pool_t * p = cmd -> pool ;    \
-    ((tApacheDirConfig *)pDirCfg) -> STRUCT.NAME = ap_pstrdup(p, arg) ; \
+    ((tApacheDirConfig *)pDirCfg) -> STRUCT.NAME = apr_pstrdup(p, arg) ; \
     ((tApacheDirConfig *)pDirCfg) -> set_##STRUCT##NAME = 1 ; \
     if (bApDebug) \
         ap_log_error (APLOG_MARK, APLOG_WARNING | APLOG_NOERRNO, 
APLOG_STATUSCODE NULL, "EmbperlDebug: Set "#CFGNAME" (type="#TYPE";STR) = 
%s\n", arg) ; \
@@ -651,7 +651,7 @@
     if (!embperl_CalcExpires(arg, buf, 0)) \
         LogErrorParam (NULL, rcTimeFormatErr, "EMBPERL_"#CFGNAME, arg) ; \
     else \
-        ((tApacheDirConfig *)pDirCfg) -> STRUCT.NAME = ap_pstrdup(p, buf) ; \
+        ((tApacheDirConfig *)pDirCfg) -> STRUCT.NAME = apr_pstrdup(p, buf) ; 
\
     ((tApacheDirConfig *)pDirCfg) -> set_##STRUCT##NAME = 1 ; \
     if (bApDebug) \
         ap_log_error (APLOG_MARK, APLOG_WARNING | APLOG_NOERRNO, 
APLOG_STATUSCODE NULL, "EmbperlDebug: Set "#CFGNAME" (type="#TYPE";STR) = 
%s\n", arg) ; \
@@ -684,7 +684,7 @@
 #define EPCFG_SAVE(STRUCT,TYPE,NAME,CFGNAME) \
 const char * embperl_Apache_Config_##STRUCT##NAME (cmd_parms *cmd, /* 
tApacheDirConfig */ void * pDirCfg, const char* arg) \
     { \
-    ((tApacheDirConfig *)pDirCfg) -> save_##STRUCT##NAME = ap_pstrdup(cmd -> 
pool, arg) ; \
+    ((tApacheDirConfig *)pDirCfg) -> save_##STRUCT##NAME = apr_pstrdup(cmd -> 
pool, arg) ; \
     ((tApacheDirConfig *)pDirCfg) -> set_##STRUCT##NAME = 1 ; \
     if (bApDebug) \
         ap_log_error (APLOG_MARK, APLOG_WARNING | APLOG_NOERRNO, 
APLOG_STATUSCODE NULL, "EmbperlDebug: Set "#CFGNAME" (type="#TYPE") = %s 
(save for later conversion to Perl data)\n", arg) ; \
@@ -982,7 +982,7 @@
     pParam -> sUri         = r -> uri ;
     pParam -> sPathInfo    = r -> path_info ;
     pParam -> sQueryInfo   = r -> args ;  
-    if (p = ep_pstrdup (pPool, ap_table_get (r -> headers_in, 
"Accept-Language")))
+    if (p = ep_pstrdup (pPool, apr_table_get (r -> headers_in, 
"Accept-Language")))
         {
         while (isspace(*p))
             p++ ;
@@ -992,7 +992,7 @@
         *p = '\0' ;
         }
 
-    ap_table_do (embperl_AddCookie, &s, r -> headers_in, "Cookie", NULL) ;
+    apr_table_do (embperl_AddCookie, &s, r -> headers_in, "Cookie", NULL) ;
 
     buf[0] = '\0' ;
 #ifdef APACHE2


Aloha => Beau;


-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: [PATCH] for Apache2.1

Posted by Gerald Richter <ri...@ecos.de>.
Hi,

thanks for the patch. I will include it in the next release

Gerald

Beau E. Cox wrote:
> Hello Gerald and all -
>
> I have been testing with Apache2.1/mod_perl 2 and found that the
> following two patches are necessary for Embperl to run under
> Apache2.1.
>
> Both patches have been sucessfully tested under Apache2.0 and
> Apache2.1.
>
> 1) epapfilter.c - 'APR_BRIGADE_FOREACH' has been depreciated and has
> finally been removed from 2.1.
>
> --- orig.embperl/epapfilter.c 2004-01-22 20:50:54.000000000 -1000
> +++ patched.embperl/epapfilter.c 2004-03-30 15:19:42.000000000 -1000
> @@ -206,8 +206,9 @@
>      epTHX_
>
>
> -    APR_BRIGADE_FOREACH(b, bb)
> -        {
> +    for (b = APR_BRIGADE_FIRST(bb);
> +         b != APR_BRIGADE_SENTINEL(bb);
> +         b = APR_BUCKET_NEXT(b)) {
>          /* APR_BUCKET_IS_EOS(b) does give undefined symbol, when
> running outside of Apache */
>          /* if (APR_BUCKET_IS_EOS(b)) */
>          if (strcmp (b -> type -> name, "EOS") == 0)
>
> 2) apr function name changes.
>
> --- embperl.unpatched/mod_embperl.c 2004-03-14 10:17:41.000000000
> -1000 +++ embperl/mod_embperl.c 2004-03-31 09:42:10.000000000 -1000
> @@ -291,7 +291,7 @@
>      dTHX ;
>
>  #ifdef APACHE2
> -    apr_pool_sub_make(&subpool, p, NULL);
> +    apr_pool_create_ex(&subpool, p, NULL, NULL);
>  #else
>      subpool = ap_make_sub_pool(p);
>  #endif
> @@ -420,7 +420,7 @@
>  static void *embperl_create_dir_config(apr_pool_t * p, char *d)
>      {
>      /*char buf [20] ;*/
> -    tApacheDirConfig *cfg = (tApacheDirConfig *) ap_pcalloc(p,
> sizeof(tApacheDirConfig));
> +    tApacheDirConfig *cfg = (tApacheDirConfig *) apr_pcalloc(p,
> sizeof(tApacheDirConfig));
>
>      embperl_DefaultReqConfig (&cfg -> ReqConfig) ;
>      embperl_DefaultAppConfig (&cfg -> AppConfig) ;
> @@ -445,7 +445,7 @@
>
>  static void *embperl_create_server_config(apr_pool_t * p, server_rec
>      *s) {
> -    tApacheDirConfig *cfg = (tApacheDirConfig *) ap_pcalloc(p,
> sizeof(tApacheDirConfig));
> +    tApacheDirConfig *cfg = (tApacheDirConfig *) apr_pcalloc(p,
> sizeof(tApacheDirConfig));
>
>      bApDebug |= ap_exists_config_define("EMBPERL_APDEBUG") ;
>
> @@ -546,7 +546,7 @@
>          return addv ;
>
>          {
> -        tApacheDirConfig *mrg = (tApacheDirConfig *)ap_palloc (p,
> sizeof(tApacheDirConfig));
> +        tApacheDirConfig *mrg = (tApacheDirConfig *)apr_palloc (p,
> sizeof(tApacheDirConfig));
>          tApacheDirConfig *base = (tApacheDirConfig *)basev;
>          tApacheDirConfig *add = (tApacheDirConfig *)addv;
>
> @@ -635,7 +635,7 @@
>  const char * embperl_Apache_Config_##STRUCT##NAME (cmd_parms *cmd, /*
> tApacheDirConfig */ void * pDirCfg, const char* arg) \
>      { \
>      apr_pool_t * p = cmd -> pool ;    \
> -    ((tApacheDirConfig *)pDirCfg) -> STRUCT.NAME = ap_pstrdup(p,
> arg) ; \ +    ((tApacheDirConfig *)pDirCfg) -> STRUCT.NAME =
>      apr_pstrdup(p, arg) ; \ ((tApacheDirConfig *)pDirCfg) ->
>      set_##STRUCT##NAME = 1 ; \ if (bApDebug) \
>          ap_log_error (APLOG_MARK, APLOG_WARNING | APLOG_NOERRNO,
> APLOG_STATUSCODE NULL, "EmbperlDebug: Set "#CFGNAME"
> (type="#TYPE";STR) = %s\n", arg) ; \
> @@ -651,7 +651,7 @@
>      if (!embperl_CalcExpires(arg, buf, 0)) \
>          LogErrorParam (NULL, rcTimeFormatErr, "EMBPERL_"#CFGNAME,
>      arg) ; \ else \
> -        ((tApacheDirConfig *)pDirCfg) -> STRUCT.NAME = ap_pstrdup(p,
> buf) ; \ +        ((tApacheDirConfig *)pDirCfg) -> STRUCT.NAME =
> apr_pstrdup(p, buf) ; \
>      ((tApacheDirConfig *)pDirCfg) -> set_##STRUCT##NAME = 1 ; \
>      if (bApDebug) \
>          ap_log_error (APLOG_MARK, APLOG_WARNING | APLOG_NOERRNO,
> APLOG_STATUSCODE NULL, "EmbperlDebug: Set "#CFGNAME"
> (type="#TYPE";STR) = %s\n", arg) ; \
> @@ -684,7 +684,7 @@
>  #define EPCFG_SAVE(STRUCT,TYPE,NAME,CFGNAME) \
>  const char * embperl_Apache_Config_##STRUCT##NAME (cmd_parms *cmd, /*
> tApacheDirConfig */ void * pDirCfg, const char* arg) \
>      { \
> -    ((tApacheDirConfig *)pDirCfg) -> save_##STRUCT##NAME =
> ap_pstrdup(cmd -> pool, arg) ; \
> +    ((tApacheDirConfig *)pDirCfg) -> save_##STRUCT##NAME =
> apr_pstrdup(cmd -> pool, arg) ; \
>      ((tApacheDirConfig *)pDirCfg) -> set_##STRUCT##NAME = 1 ; \
>      if (bApDebug) \
>          ap_log_error (APLOG_MARK, APLOG_WARNING | APLOG_NOERRNO,
> APLOG_STATUSCODE NULL, "EmbperlDebug: Set "#CFGNAME" (type="#TYPE") =
> %s (save for later conversion to Perl data)\n", arg) ; \
> @@ -982,7 +982,7 @@
>      pParam -> sUri         = r -> uri ;
>      pParam -> sPathInfo    = r -> path_info ;
>      pParam -> sQueryInfo   = r -> args ;
> -    if (p = ep_pstrdup (pPool, ap_table_get (r -> headers_in,
> "Accept-Language")))
> +    if (p = ep_pstrdup (pPool, apr_table_get (r -> headers_in,
> "Accept-Language")))
>          {
>          while (isspace(*p))
>              p++ ;
> @@ -992,7 +992,7 @@
>          *p = '\0' ;
>          }
>
> -    ap_table_do (embperl_AddCookie, &s, r -> headers_in, "Cookie",
> NULL) ; +    apr_table_do (embperl_AddCookie, &s, r -> headers_in,
> "Cookie", NULL) ;
>
>      buf[0] = '\0' ;
>  #ifdef APACHE2
>
>
> Aloha => Beau;
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> For additional commands, e-mail: embperl-help@perl.apache.org

---------------------------------------------------------------------------
Gerald Richter            ecos electronic communication services gmbh
IT-Securitylösungen * Webapplikationen mit Apache/Perl/mod_perl/Embperl

Post:       Tulpenstrasse 5          D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de          Voice:   +49 6133 939-122
WWW:        http://www.ecos.de/      Fax:     +49 6133 939-333
---------------------------------------------------------------------------
Besuchen Sie uns auf der CeBIT (18. - 24. März 2004)
Halle 6 Stand B38-452

ECOS BB-5000 Firewall- und IT-Security Appliance: www.bb-5000.info
---------------------------------------------------------------------------


-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: [PATCH] for Apache2.1

Posted by Gerald Richter <ri...@ecos.de>.
Hi,

thanks for the patch. I will include it in the next release

Gerald

Beau E. Cox wrote:
> Hello Gerald and all -
>
> I have been testing with Apache2.1/mod_perl 2 and found that the
> following two patches are necessary for Embperl to run under
> Apache2.1.
>
> Both patches have been sucessfully tested under Apache2.0 and
> Apache2.1.
>
> 1) epapfilter.c - 'APR_BRIGADE_FOREACH' has been depreciated and has
> finally been removed from 2.1.
>
> --- orig.embperl/epapfilter.c 2004-01-22 20:50:54.000000000 -1000
> +++ patched.embperl/epapfilter.c 2004-03-30 15:19:42.000000000 -1000
> @@ -206,8 +206,9 @@
>      epTHX_
>
>
> -    APR_BRIGADE_FOREACH(b, bb)
> -        {
> +    for (b = APR_BRIGADE_FIRST(bb);
> +         b != APR_BRIGADE_SENTINEL(bb);
> +         b = APR_BUCKET_NEXT(b)) {
>          /* APR_BUCKET_IS_EOS(b) does give undefined symbol, when
> running outside of Apache */
>          /* if (APR_BUCKET_IS_EOS(b)) */
>          if (strcmp (b -> type -> name, "EOS") == 0)
>
> 2) apr function name changes.
>
> --- embperl.unpatched/mod_embperl.c 2004-03-14 10:17:41.000000000
> -1000 +++ embperl/mod_embperl.c 2004-03-31 09:42:10.000000000 -1000
> @@ -291,7 +291,7 @@
>      dTHX ;
>
>  #ifdef APACHE2
> -    apr_pool_sub_make(&subpool, p, NULL);
> +    apr_pool_create_ex(&subpool, p, NULL, NULL);
>  #else
>      subpool = ap_make_sub_pool(p);
>  #endif
> @@ -420,7 +420,7 @@
>  static void *embperl_create_dir_config(apr_pool_t * p, char *d)
>      {
>      /*char buf [20] ;*/
> -    tApacheDirConfig *cfg = (tApacheDirConfig *) ap_pcalloc(p,
> sizeof(tApacheDirConfig));
> +    tApacheDirConfig *cfg = (tApacheDirConfig *) apr_pcalloc(p,
> sizeof(tApacheDirConfig));
>
>      embperl_DefaultReqConfig (&cfg -> ReqConfig) ;
>      embperl_DefaultAppConfig (&cfg -> AppConfig) ;
> @@ -445,7 +445,7 @@
>
>  static void *embperl_create_server_config(apr_pool_t * p, server_rec
>      *s) {
> -    tApacheDirConfig *cfg = (tApacheDirConfig *) ap_pcalloc(p,
> sizeof(tApacheDirConfig));
> +    tApacheDirConfig *cfg = (tApacheDirConfig *) apr_pcalloc(p,
> sizeof(tApacheDirConfig));
>
>      bApDebug |= ap_exists_config_define("EMBPERL_APDEBUG") ;
>
> @@ -546,7 +546,7 @@
>          return addv ;
>
>          {
> -        tApacheDirConfig *mrg = (tApacheDirConfig *)ap_palloc (p,
> sizeof(tApacheDirConfig));
> +        tApacheDirConfig *mrg = (tApacheDirConfig *)apr_palloc (p,
> sizeof(tApacheDirConfig));
>          tApacheDirConfig *base = (tApacheDirConfig *)basev;
>          tApacheDirConfig *add = (tApacheDirConfig *)addv;
>
> @@ -635,7 +635,7 @@
>  const char * embperl_Apache_Config_##STRUCT##NAME (cmd_parms *cmd, /*
> tApacheDirConfig */ void * pDirCfg, const char* arg) \
>      { \
>      apr_pool_t * p = cmd -> pool ;    \
> -    ((tApacheDirConfig *)pDirCfg) -> STRUCT.NAME = ap_pstrdup(p,
> arg) ; \ +    ((tApacheDirConfig *)pDirCfg) -> STRUCT.NAME =
>      apr_pstrdup(p, arg) ; \ ((tApacheDirConfig *)pDirCfg) ->
>      set_##STRUCT##NAME = 1 ; \ if (bApDebug) \
>          ap_log_error (APLOG_MARK, APLOG_WARNING | APLOG_NOERRNO,
> APLOG_STATUSCODE NULL, "EmbperlDebug: Set "#CFGNAME"
> (type="#TYPE";STR) = %s\n", arg) ; \
> @@ -651,7 +651,7 @@
>      if (!embperl_CalcExpires(arg, buf, 0)) \
>          LogErrorParam (NULL, rcTimeFormatErr, "EMBPERL_"#CFGNAME,
>      arg) ; \ else \
> -        ((tApacheDirConfig *)pDirCfg) -> STRUCT.NAME = ap_pstrdup(p,
> buf) ; \ +        ((tApacheDirConfig *)pDirCfg) -> STRUCT.NAME =
> apr_pstrdup(p, buf) ; \
>      ((tApacheDirConfig *)pDirCfg) -> set_##STRUCT##NAME = 1 ; \
>      if (bApDebug) \
>          ap_log_error (APLOG_MARK, APLOG_WARNING | APLOG_NOERRNO,
> APLOG_STATUSCODE NULL, "EmbperlDebug: Set "#CFGNAME"
> (type="#TYPE";STR) = %s\n", arg) ; \
> @@ -684,7 +684,7 @@
>  #define EPCFG_SAVE(STRUCT,TYPE,NAME,CFGNAME) \
>  const char * embperl_Apache_Config_##STRUCT##NAME (cmd_parms *cmd, /*
> tApacheDirConfig */ void * pDirCfg, const char* arg) \
>      { \
> -    ((tApacheDirConfig *)pDirCfg) -> save_##STRUCT##NAME =
> ap_pstrdup(cmd -> pool, arg) ; \
> +    ((tApacheDirConfig *)pDirCfg) -> save_##STRUCT##NAME =
> apr_pstrdup(cmd -> pool, arg) ; \
>      ((tApacheDirConfig *)pDirCfg) -> set_##STRUCT##NAME = 1 ; \
>      if (bApDebug) \
>          ap_log_error (APLOG_MARK, APLOG_WARNING | APLOG_NOERRNO,
> APLOG_STATUSCODE NULL, "EmbperlDebug: Set "#CFGNAME" (type="#TYPE") =
> %s (save for later conversion to Perl data)\n", arg) ; \
> @@ -982,7 +982,7 @@
>      pParam -> sUri         = r -> uri ;
>      pParam -> sPathInfo    = r -> path_info ;
>      pParam -> sQueryInfo   = r -> args ;
> -    if (p = ep_pstrdup (pPool, ap_table_get (r -> headers_in,
> "Accept-Language")))
> +    if (p = ep_pstrdup (pPool, apr_table_get (r -> headers_in,
> "Accept-Language")))
>          {
>          while (isspace(*p))
>              p++ ;
> @@ -992,7 +992,7 @@
>          *p = '\0' ;
>          }
>
> -    ap_table_do (embperl_AddCookie, &s, r -> headers_in, "Cookie",
> NULL) ; +    apr_table_do (embperl_AddCookie, &s, r -> headers_in,
> "Cookie", NULL) ;
>
>      buf[0] = '\0' ;
>  #ifdef APACHE2
>
>
> Aloha => Beau;
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> For additional commands, e-mail: embperl-help@perl.apache.org

---------------------------------------------------------------------------
Gerald Richter            ecos electronic communication services gmbh
IT-Securitylösungen * Webapplikationen mit Apache/Perl/mod_perl/Embperl

Post:       Tulpenstrasse 5          D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de          Voice:   +49 6133 939-122
WWW:        http://www.ecos.de/      Fax:     +49 6133 939-333
---------------------------------------------------------------------------
Besuchen Sie uns auf der CeBIT (18. - 24. März 2004)
Halle 6 Stand B38-452

ECOS BB-5000 Firewall- und IT-Security Appliance: www.bb-5000.info
---------------------------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org