You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Ruediger Pluem <rp...@apache.org> on 2008/04/05 17:51:15 UTC
Re: svn commit: r644748 - in /httpd/httpd/trunk: CHANGES docs/manual/mod/mod_session_cookie.xml
include/util_cookies.h modules/session/config.m4 modules/session/mod_session_cookie.c
server/Makefile.in server/util_cookies.c
On 04/04/2008 06:02 PM, minfrin@apache.org wrote:
> Author: minfrin
> Date: Fri Apr 4 09:02:22 2008
> New Revision: 644748
>
> URL: http://svn.apache.org/viewvc?rev=644748&view=rev
> Log:
> mod_session_cookie: Add a session implementation capable of storing
> session information within cookies on the browser. Useful for high
> volume sites where server bound sessions are too resource intensive.
>
> Added:
> httpd/httpd/trunk/docs/manual/mod/mod_session_cookie.xml
> httpd/httpd/trunk/include/util_cookies.h
> httpd/httpd/trunk/modules/session/mod_session_cookie.c
> httpd/httpd/trunk/server/util_cookies.c
> Modified:
> httpd/httpd/trunk/CHANGES
> httpd/httpd/trunk/modules/session/config.m4
> httpd/httpd/trunk/server/Makefile.in
>
> Added: httpd/httpd/trunk/modules/session/mod_session_cookie.c
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/session/mod_session_cookie.c?rev=644748&view=auto
> ==============================================================================
> --- httpd/httpd/trunk/modules/session/mod_session_cookie.c (added)
> +++ httpd/httpd/trunk/modules/session/mod_session_cookie.c Fri Apr 4 09:02:22 2008
> +/**
> + * Sanity check a given string that it exists, is not empty,
> + * and does not contain special characters.
> + */
> +static const char *check_string(cmd_parms * cmd, const char *string)
> +{
> + if (!string || !*string || ap_strchr_c(string, '=') || ap_strchr_c(string, '&')) {
> + return apr_pstrcat(cmd->pool, cmd->directive->directive,
> + " cannot be empty, or contain '=' or '&'.",
> + NULL);
> + }
> + return NULL;
> +}
Why don't we use ap_cookie_check_string?
> +
> +static const char *set_cookie_name(cmd_parms * cmd, void *config, const char *args)
> +{
> + char *last;
> + char *line = apr_pstrdup(cmd->pool, args);
> + session_cookie_dir_conf *conf = (session_cookie_dir_conf *) config;
> + char *cookie = apr_strtok(line, " \t", &last);
> + conf->name = cookie;
Don't we need to trim trailing spaces from the cookie name?
> + conf->name_set = 1;
> + while (apr_isspace(*last)) {
> + last++;
> + }
> + conf->name_attrs = last;
> + return check_string(cmd, cookie);
> +}
> +
> +static const char *set_cookie_name2(cmd_parms * cmd, void *config, const char *args)
> +{
> + char *last;
> + char *line = apr_pstrdup(cmd->pool, args);
> + session_cookie_dir_conf *conf = (session_cookie_dir_conf *) config;
> + char *cookie = apr_strtok(line, " \t", &last);
> + conf->name2 = cookie;
Don't we need to trim trailing spaces from the cookie name?
> + conf->name2_set = 1;
> + while (apr_isspace(*last)) {
> + last++;
> + }
> + conf->name2_attrs = last;
> + return check_string(cmd, cookie);
> +}
> +
Regards
RĂ¼diger