Skip to content

Commit cd7ef59

Browse files
committed
* modules/cache/mod_socache_memcache.c (socache_mc_init): Remove references
to SSL in log messages. (socache_mc_retrieve): Use 'data' not 'der'; correctly return an error for the overflow case. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@726008 13f79535-47bb-0310-9956-ffa450edef68
1 parent fe00fa9 commit cd7ef59

1 file changed

Lines changed: 14 additions & 15 deletions

File tree

modules/cache/mod_socache_memcache.c

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ static apr_status_t socache_mc_init(ap_socache_instance_t *ctx,
103103
rv = apr_memcache_create(p, nservers, 0, &ctx->mc);
104104
if (rv != APR_SUCCESS) {
105105
ap_log_error(APLOG_MARK, APLOG_CRIT, rv, s,
106-
"SSLSessionCache: Failed to create Memcache Object of '%d' size.",
106+
"socache: Failed to create Memcache Object of '%d' size.",
107107
nservers);
108108
return rv;
109109
}
@@ -120,13 +120,13 @@ static apr_status_t socache_mc_init(ap_socache_instance_t *ctx,
120120
rv = apr_parse_addr_port(&host_str, &scope_id, &port, split, p);
121121
if (rv != APR_SUCCESS) {
122122
ap_log_error(APLOG_MARK, APLOG_CRIT, rv, s,
123-
"SSLSessionCache: Failed to Parse Server: '%s'", split);
123+
"socache: Failed to Parse memcache Server: '%s'", split);
124124
return rv;
125125
}
126126

127127
if (host_str == NULL) {
128128
ap_log_error(APLOG_MARK, APLOG_CRIT, rv, s,
129-
"SSLSessionCache: Failed to Parse Server, "
129+
"socache: Failed to Parse Server, "
130130
"no hostname specified: '%s'", split);
131131
return APR_EINVAL;
132132
}
@@ -144,15 +144,15 @@ static apr_status_t socache_mc_init(ap_socache_instance_t *ctx,
144144
&st);
145145
if (rv != APR_SUCCESS) {
146146
ap_log_error(APLOG_MARK, APLOG_CRIT, rv, s,
147-
"SSLSessionCache: Failed to Create Server: %s:%d",
147+
"socache: Failed to Create memcache Server: %s:%d",
148148
host_str, port);
149149
return rv;
150150
}
151151

152152
rv = apr_memcache_add_server(ctx->mc, st);
153153
if (rv != APR_SUCCESS) {
154154
ap_log_error(APLOG_MARK, APLOG_CRIT, rv, s,
155-
"SSLSessionCache: Failed to Add Server: %s:%d",
155+
"socache: Failed to Add memcache Server: %s:%d",
156156
host_str, port);
157157
return rv;
158158
}
@@ -228,8 +228,8 @@ static apr_status_t socache_mc_retrieve(ap_socache_instance_t *ctx,
228228
unsigned char *dest, unsigned int *destlen,
229229
apr_pool_t *p)
230230
{
231-
apr_size_t der_len;
232-
char buf[MC_KEY_LEN], *der;
231+
apr_size_t data_len;
232+
char buf[MC_KEY_LEN], *data;
233233
apr_status_t rv;
234234

235235
if (socache_mc_id2key(ctx, id, idlen, buf, sizeof buf)) {
@@ -239,23 +239,22 @@ static apr_status_t socache_mc_retrieve(ap_socache_instance_t *ctx,
239239
/* ### this could do with a subpool, but _getp looks like it will
240240
* eat memory like it's going out of fashion anyway. */
241241

242-
rv = apr_memcache_getp(ctx->mc, p, buf,
243-
&der, &der_len, NULL);
242+
rv = apr_memcache_getp(ctx->mc, p, buf, &data, &data_len, NULL);
244243
if (rv) {
245244
if (rv != APR_NOTFOUND) {
246245
ap_log_error(APLOG_MARK, APLOG_ERR, rv, s,
247-
"scache_mc: 'get_session' FAIL");
246+
"scache_mc: 'retrieve' FAIL");
248247
}
249248
return rv;
250249
}
251-
else if (der_len > *destlen) {
250+
else if (data_len > *destlen) {
252251
ap_log_error(APLOG_MARK, APLOG_ERR, rv, s,
253-
"scache_mc: 'get_session' OVERFLOW");
254-
return rv;
252+
"scache_mc: 'retrieve' OVERFLOW");
253+
return APR_ENOMEM;
255254
}
256255

257-
memcpy(dest, der, der_len);
258-
*destlen = der_len;
256+
memcpy(dest, data, data_len);
257+
*destlen = data_len;
259258

260259
return APR_SUCCESS;
261260
}

0 commit comments

Comments
 (0)