You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by yl...@apache.org on 2015/06/23 12:54:15 UTC

svn commit: r1687021 - /httpd/httpd/trunk/modules/session/mod_session_dbd.c

Author: ylavic
Date: Tue Jun 23 10:54:15 2015
New Revision: 1687021

URL: http://svn.apache.org/r1687021
Log:
mod_session_dbd: follow up to r1686122.
DBD entries should also have request lifetime.
Proposed by: Jacob Champion <jacob.champion ni.com>
Reviewed by: ylavic

Modified:
    httpd/httpd/trunk/modules/session/mod_session_dbd.c

Modified: httpd/httpd/trunk/modules/session/mod_session_dbd.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/session/mod_session_dbd.c?rev=1687021&r1=1687020&r2=1687021&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/session/mod_session_dbd.c (original)
+++ httpd/httpd/trunk/modules/session/mod_session_dbd.c Tue Jun 23 10:54:15 2015
@@ -94,8 +94,11 @@ static apr_status_t dbd_init(request_rec
 
 /**
  * Load the session by the key specified.
+ *
+ * The session value is allocated using the passed apr_pool_t.
  */
-static apr_status_t dbd_load(request_rec * r, const char *key, const char **val)
+static apr_status_t dbd_load(request_rec * r, apr_pool_t *pool,
+							 const char *key, const char **val)
 {
 
     apr_status_t rv;
@@ -138,7 +141,7 @@ static apr_status_t dbd_load(request_rec
             return APR_EGENERAL;
         }
         if (*val == NULL) {
-            *val = apr_pstrdup(r->pool,
+            *val = apr_pstrdup(pool,
                                apr_dbd_get_entry(dbd->driver, row, 0));
         }
         /* we can't break out here or row won't get cleaned up */
@@ -204,7 +207,7 @@ static apr_status_t session_dbd_load(req
         /* load an RFC2109 or RFC2965 compliant cookie */
         ap_cookie_read(r, name, &key, conf->remove);
         if (key) {
-            ret = dbd_load(r, key, &val);
+            ret = dbd_load(r, m->pool, key, &val);
             if (ret != APR_SUCCESS) {
                 return ret;
             }
@@ -215,7 +218,7 @@ static apr_status_t session_dbd_load(req
     /* load named session */
     else if (conf->peruser) {
         if (r->user) {
-            ret = dbd_load(r, r->user, &val);
+            ret = dbd_load(r, m->pool, r->user, &val);
             if (ret != APR_SUCCESS) {
                 return ret;
             }



Re: svn commit: r1687021 - /httpd/httpd/trunk/modules/session/mod_session_dbd.c

Posted by Yann Ylavic <yl...@gmail.com>.
Makes sense, thanks, fixed in r1687087.

Regards,
Yann.

On Tue, Jun 23, 2015 at 5:20 PM, Mike Rumph <mi...@oracle.com> wrote:
> Hello Yann,
>
> This is just a matter of style, but isn't it more typical to have pool as
> the first parameter of a function?
> Even in mod_session_dbd.c, this is seen in dbd_clean(),
> session_dbd_monitor(), create_session_dbd_dir_config() and
> merge_session_dbd_dir_config().
>
> Thanks,
>
> Mike
>
> On 6/23/2015 3:54 AM, ylavic@apache.org wrote:
>>
>> Author: ylavic
>> Date: Tue Jun 23 10:54:15 2015
>> New Revision: 1687021
>>
>> URL: http://svn.apache.org/r1687021
>> Log:
>> mod_session_dbd: follow up to r1686122.
>> DBD entries should also have request lifetime.
>> Proposed by: Jacob Champion <jacob.champion ni.com>
>> Reviewed by: ylavic
>>
>> Modified:
>>      httpd/httpd/trunk/modules/session/mod_session_dbd.c
>>
>> Modified: httpd/httpd/trunk/modules/session/mod_session_dbd.c
>> URL:
>> http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/session/mod_session_dbd.c?rev=1687021&r1=1687020&r2=1687021&view=diff
>>
>> ==============================================================================
>> --- httpd/httpd/trunk/modules/session/mod_session_dbd.c (original)
>> +++ httpd/httpd/trunk/modules/session/mod_session_dbd.c Tue Jun 23
>> 10:54:15 2015
>> @@ -94,8 +94,11 @@ static apr_status_t dbd_init(request_rec
>>     /**
>>    * Load the session by the key specified.
>> + *
>> + * The session value is allocated using the passed apr_pool_t.
>>    */
>> -static apr_status_t dbd_load(request_rec * r, const char *key, const char
>> **val)
>> +static apr_status_t dbd_load(request_rec * r, apr_pool_t *pool,
>> +                                                        const char *key,
>> const char **val)
>>   {
>>         apr_status_t rv;
>> @@ -138,7 +141,7 @@ static apr_status_t dbd_load(request_rec
>>               return APR_EGENERAL;
>>           }
>>           if (*val == NULL) {
>> -            *val = apr_pstrdup(r->pool,
>> +            *val = apr_pstrdup(pool,
>>                                  apr_dbd_get_entry(dbd->driver, row, 0));
>>           }
>>           /* we can't break out here or row won't get cleaned up */
>> @@ -204,7 +207,7 @@ static apr_status_t session_dbd_load(req
>>           /* load an RFC2109 or RFC2965 compliant cookie */
>>           ap_cookie_read(r, name, &key, conf->remove);
>>           if (key) {
>> -            ret = dbd_load(r, key, &val);
>> +            ret = dbd_load(r, m->pool, key, &val);
>>               if (ret != APR_SUCCESS) {
>>                   return ret;
>>               }
>> @@ -215,7 +218,7 @@ static apr_status_t session_dbd_load(req
>>       /* load named session */
>>       else if (conf->peruser) {
>>           if (r->user) {
>> -            ret = dbd_load(r, r->user, &val);
>> +            ret = dbd_load(r, m->pool, r->user, &val);
>>               if (ret != APR_SUCCESS) {
>>                   return ret;
>>               }
>>
>>
>>
>

Re: svn commit: r1687021 - /httpd/httpd/trunk/modules/session/mod_session_dbd.c

Posted by Mike Rumph <mi...@oracle.com>.
Hello Yann,

This is just a matter of style, but isn't it more typical to have pool 
as the first parameter of a function?
Even in mod_session_dbd.c, this is seen in dbd_clean(), 
session_dbd_monitor(), create_session_dbd_dir_config() and 
merge_session_dbd_dir_config().

Thanks,

Mike
On 6/23/2015 3:54 AM, ylavic@apache.org wrote:
> Author: ylavic
> Date: Tue Jun 23 10:54:15 2015
> New Revision: 1687021
>
> URL: http://svn.apache.org/r1687021
> Log:
> mod_session_dbd: follow up to r1686122.
> DBD entries should also have request lifetime.
> Proposed by: Jacob Champion <jacob.champion ni.com>
> Reviewed by: ylavic
>
> Modified:
>      httpd/httpd/trunk/modules/session/mod_session_dbd.c
>
> Modified: httpd/httpd/trunk/modules/session/mod_session_dbd.c
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/session/mod_session_dbd.c?rev=1687021&r1=1687020&r2=1687021&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/modules/session/mod_session_dbd.c (original)
> +++ httpd/httpd/trunk/modules/session/mod_session_dbd.c Tue Jun 23 10:54:15 2015
> @@ -94,8 +94,11 @@ static apr_status_t dbd_init(request_rec
>   
>   /**
>    * Load the session by the key specified.
> + *
> + * The session value is allocated using the passed apr_pool_t.
>    */
> -static apr_status_t dbd_load(request_rec * r, const char *key, const char **val)
> +static apr_status_t dbd_load(request_rec * r, apr_pool_t *pool,
> +							 const char *key, const char **val)
>   {
>   
>       apr_status_t rv;
> @@ -138,7 +141,7 @@ static apr_status_t dbd_load(request_rec
>               return APR_EGENERAL;
>           }
>           if (*val == NULL) {
> -            *val = apr_pstrdup(r->pool,
> +            *val = apr_pstrdup(pool,
>                                  apr_dbd_get_entry(dbd->driver, row, 0));
>           }
>           /* we can't break out here or row won't get cleaned up */
> @@ -204,7 +207,7 @@ static apr_status_t session_dbd_load(req
>           /* load an RFC2109 or RFC2965 compliant cookie */
>           ap_cookie_read(r, name, &key, conf->remove);
>           if (key) {
> -            ret = dbd_load(r, key, &val);
> +            ret = dbd_load(r, m->pool, key, &val);
>               if (ret != APR_SUCCESS) {
>                   return ret;
>               }
> @@ -215,7 +218,7 @@ static apr_status_t session_dbd_load(req
>       /* load named session */
>       else if (conf->peruser) {
>           if (r->user) {
> -            ret = dbd_load(r, r->user, &val);
> +            ret = dbd_load(r, m->pool, r->user, &val);
>               if (ret != APR_SUCCESS) {
>                   return ret;
>               }
>
>
>