Skip to content

Commit 4f79ae4

Browse files
committed
fix http header sending
1 parent 6ac54cd commit 4f79ae4

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

mod_auth_memcookie.c

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -224,13 +224,13 @@ static apr_table_t *Auth_memCookie_get_session(request_rec *r, strAuth_memCookie
224224
szTokenPos=NULL;
225225
for(szField=apr_strtok(szMyValue,"\r\n",&szTokenPos);szField;szField=apr_strtok(NULL,"\r\n",&szTokenPos)) {
226226
szFieldTokenPos=NULL;
227-
ap_log_rerror(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO, 0,r,LOGTAG_PREFIX "session field:%s",szField);
227+
ap_log_rerror(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO, 0,r,LOGTAG_PREFIX "session field:'%s'",szField);
228228
szFieldName=apr_strtok(szField,"=",&szFieldTokenPos);
229229
szFieldValue=apr_strtok(NULL,"\r\n",&szFieldTokenPos);
230230
if (szFieldName!=NULL&&szFieldValue!=NULL) {
231231
/* add key and value in pMySession table */
232232
apr_table_set(pMySession,szFieldName,szFieldValue);
233-
ap_log_rerror(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO, 0,r,LOGTAG_PREFIX "session information %s=%s",szFieldName,szFieldValue);
233+
ap_log_rerror(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO, 0,r,LOGTAG_PREFIX "session information '%s'='%s'",szFieldName,szFieldValue);
234234

235235
/* count the number of element added to table to check table size not reached */
236236
nbInfo++;
@@ -331,12 +331,14 @@ static int Auth_memCookie_DoSetHeader(void*rec,const char *szKey, const char *sz
331331
apr_base64_encode(szB64_enc_string,szValue,strlen(szValue));
332332

333333
/* set string header */
334-
apr_table_set(r->headers_in,szHeaderName, (char*)szB64_enc_string);
334+
apr_table_setn(r->subprocess_env,szHeaderName,(char*)szB64_enc_string);
335+
ap_log_rerror(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r, LOGTAG_PREFIX "Send HTTP Header %s=%s", szHeaderName,szB64_enc_string);
335336
}
336337
else
337338
{
338339
/* set string header */
339-
apr_table_set(r->headers_in,szHeaderName, (char*)szValue);
340+
apr_table_setn(r->subprocess_env,szHeaderName,(char*)szValue);
341+
ap_log_rerror(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r, LOGTAG_PREFIX "Send HTTP Header %s=%s", szHeaderName,szValue);
340342
}
341343
return 1;
342344
}
@@ -483,7 +485,10 @@ static int Auth_memCookie_check_cookie(request_rec *r)
483485
}
484486

485487
/* send http header of the session value to the backend */
486-
if (conf->nAuth_memCookie_SetSessionHTTPHeader) apr_table_do(Auth_memCookie_DoSetHeader,r,pAuthSession,NULL);
488+
if (conf->nAuth_memCookie_SetSessionHTTPHeader) {
489+
ap_log_rerror(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r, LOGTAG_PREFIX "nAuth_memCookie_SetSessionHTTPHeader is set then send http header...");
490+
apr_table_do(Auth_memCookie_DoSetHeader,r,pAuthSession,NULL);
491+
}
487492

488493
/* cookie found the user is authentified */
489494
apr_table_setn(r->subprocess_env,"AUTHMEMCOOKIE_AUTH","yes");
@@ -538,7 +543,7 @@ static authz_status Auth_memCookie_group_authz_checker(request_rec *r, const cha
538543
return AUTHZ_DENIED_NO_USER;
539544
}
540545

541-
ap_log_rerror(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO, 0,r,LOGTAG_PREFIX "ap_hook_auth_checker in");
546+
ap_log_rerror(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO, 0,r,LOGTAG_PREFIX "Auth_memCookie_group_authz_checker in");
542547

543548
/* get apache config */
544549
conf = ap_get_module_config(r->per_dir_config, &mod_auth_memcookie_module);
@@ -609,7 +614,7 @@ static int Auth_memCookie_check_auth(request_rec *r)
609614
apr_table_t *pAuthSession=NULL;
610615
apr_status_t tRetStatus;
611616

612-
ap_log_rerror(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO, 0,r,LOGTAG_PREFIX "ap_hook_auth_checker in");
617+
ap_log_rerror(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO, 0,r,LOGTAG_PREFIX "Auth_memCookie_check_auth in");
613618

614619
/* get apache config */
615620
conf = ap_get_module_config(r->per_dir_config, &mod_auth_memcookie_module);
@@ -801,16 +806,16 @@ static const command_rec Auth_memCookie_cmds[] =
801806
OR_AUTHCFG, "Session object in memcached expiry time, in secondes."),
802807
AP_INIT_TAKE1("Auth_memCookie_SessionTableSize", ap_set_int_slot,
803808
(void *)APR_OFFSETOF(strAuth_memCookie_config_rec, nAuth_memCookie_SessionTableSize),
804-
OR_AUTHCFG, "Max number of element in session information table. 10 by default"),
809+
OR_AUTHCFG, "Max number of element in session information table. is set to 10 by default"),
805810
AP_INIT_FLAG ("Auth_memCookie_Memcached_SessionObject_ExpiryReset", ap_set_flag_slot,
806811
(void *)APR_OFFSETOF(strAuth_memCookie_config_rec, nAuth_memCookie_MemcacheObjectExpiryReset),
807-
OR_AUTHCFG, "Set to 'no' to not reset object expiry time in memcache... yes by default"),
812+
OR_AUTHCFG, "Set to 'off' to not reset object expiry time in memcache... is 'on' by default"),
808813
AP_INIT_FLAG ("Auth_memCookie_SetSessionHTTPHeader", ap_set_flag_slot,
809814
(void *)APR_OFFSETOF(strAuth_memCookie_config_rec, nAuth_memCookie_SetSessionHTTPHeader),
810-
OR_AUTHCFG, "Set to 'yes' to set session information to http header of the authenticated users, no by default"),
815+
OR_AUTHCFG, "Set to 'on' to set session information to http header of the authenticated users, no by default"),
811816
AP_INIT_FLAG ("Auth_memCookie_SetSessionHTTPHeaderEncode", ap_set_flag_slot,
812817
(void *)APR_OFFSETOF(strAuth_memCookie_config_rec, nAuth_memCookie_SetSessionHTTPHeaderEncode),
813-
OR_AUTHCFG, "Set to 'yes' to mime64 encode session information to http header, no by default"),
818+
OR_AUTHCFG, "Set to 'on' to mime64 encode session information to http header, no by default"),
814819
AP_INIT_TAKE1("Auth_memCookie_SetSessionHTTPHeaderPrefix", ap_set_string_slot,
815820
(void *)APR_OFFSETOF(strAuth_memCookie_config_rec, szAuth_memCookie_SetSessionHTTPHeaderPrefix),
816821
OR_AUTHCFG, "Set HTTP header prefix - set to 'MCAC_' by default"),
@@ -823,14 +828,14 @@ static const command_rec Auth_memCookie_cmds[] =
823828
#if MODULE_MAGIC_NUMBER_MAJOR <= 20051115
824829
AP_INIT_FLAG ("Auth_memCookie_GroupAuthoritative", ap_set_flag_slot,
825830
(void *)APR_OFFSETOF(strAuth_memCookie_config_rec, nAuth_memCookie_GroupAuthoritative),
826-
OR_AUTHCFG, "Set to 'no' to allow access control to be passed along to lower modules, for group acl check, set to 'yes' by default."),
831+
OR_AUTHCFG, "Set to 'off' to allow access control to be passed along to lower modules, for group acl check, is set to 'on' by default."),
827832
#endif
828833
AP_INIT_FLAG ("Auth_memCookie_Authoritative", ap_set_flag_slot,
829834
(void *)APR_OFFSETOF(strAuth_memCookie_config_rec, nAuth_memCookie_Authoritative),
830-
OR_AUTHCFG, "Set to 'yes' to allow access control to be passed along to lower modules, set to 'no' by default"),
835+
OR_AUTHCFG, "Set to 'on' to allow access control to be passed along to lower modules, is set to 'off' by default"),
831836
AP_INIT_FLAG ("Auth_memCookie_SilmulateAuthBasic", ap_set_flag_slot,
832837
(void *)APR_OFFSETOF(strAuth_memCookie_config_rec, nAuth_memCookie_authbasicfix),
833-
OR_AUTHCFG, "Set to 'no' to fix http header and auth_type for simulating auth basic for scripting language like php auth framework work, set to 'yes' by default"),
838+
OR_AUTHCFG, "Set to 'off' to fix http header and auth_type for simulating auth basic for scripting language like php auth framework work, is set to 'on' by default"),
834839
AP_INIT_FLAG ("Auth_memCookie_DisableNoStore", ap_set_flag_slot,
835840
(void *)APR_OFFSETOF(strAuth_memCookie_config_rec, nAuth_memCookie_disable_no_store),
836841
OR_AUTHCFG,

0 commit comments

Comments
 (0)