Changeset c79fa6 for server/src/http/modules/ngx_http_memcached_module.c
- Timestamp:
- 02/19/08 16:28:06 (4 years ago)
- Branches:
- master-v0.7, master-v0.6, upstream_count_limit
- Children:
- 034113
- Parents:
- 2a12f7 (diff), 2340f0 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - git-author:
- Tomash Brechko <tomash.brechko@…> (02/19/08 16:28:06)
- git-committer:
- Tomash Brechko <tomash.brechko@…> (02/19/08 16:28:06)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
server/src/http/modules/ngx_http_memcached_module.c
re1c857 rc79fa6 15 15 ngx_int_t index; 16 16 ngx_uint_t gzip_flag; 17 ngx_int_t ns_index; 17 18 } ngx_http_memcached_loc_conf_t; 18 19 … … 158 159 159 160 static ngx_str_t ngx_http_memcached_key = ngx_string("memcached_key"); 161 static ngx_str_t ngx_http_memcached_ns = ngx_string("memcached_namespace"); 160 162 161 163 … … 235 237 { 236 238 size_t len; 237 uintptr_t escape ;239 uintptr_t escape, ns_escape = 0; 238 240 ngx_buf_t *b; 239 241 ngx_chain_t *cl; 240 242 ngx_http_memcached_ctx_t *ctx; 241 ngx_http_variable_value_t *vv ;243 ngx_http_variable_value_t *vv, *ns_vv; 242 244 ngx_http_memcached_loc_conf_t *mlcf; 243 245 … … 254 256 escape = 2 * ngx_escape_uri(NULL, vv->data, vv->len, NGX_ESCAPE_MEMCACHED); 255 257 256 len = sizeof("get ") - 1 + vv->len + escape + sizeof(CRLF) - 1; 258 ns_vv = ngx_http_get_indexed_variable(r, mlcf->ns_index); 259 260 if (ns_vv != NULL && !ns_vv->not_found && ns_vv->len != 0) { 261 ns_escape = 2 * ngx_escape_uri(NULL, ns_vv->data, 262 ns_vv->len, NGX_ESCAPE_MEMCACHED); 263 } 264 265 len = sizeof("get ") - 1 + ns_vv->len + ns_escape 266 + vv->len + escape + sizeof(CRLF) - 1; 257 267 258 268 b = ngx_create_temp_buf(r->pool, len); … … 276 286 277 287 ctx->key.data = b->last; 288 289 if (ns_vv != NULL && !ns_vv->not_found && ns_vv->len != 0) { 290 if (ns_escape == 0) { 291 b->last = ngx_copy(b->last, ns_vv->data, ns_vv->len); 292 } else { 293 b->last = (u_char *) ngx_escape_uri(b->last, ns_vv->data, 294 ns_vv->len, 295 NGX_ESCAPE_MEMCACHED); 296 } 297 } 278 298 279 299 if (escape == 0) { … … 588 608 * 589 609 * conf->index = 0; 610 * conf->ns_index = 0; 590 611 */ 591 612 … … 697 718 } 698 719 720 lcf->ns_index = ngx_http_get_variable_index(cf, &ngx_http_memcached_ns); 721 722 if (lcf->ns_index == NGX_ERROR) { 723 return NGX_CONF_ERROR; 724 } 725 699 726 return NGX_CONF_OK; 700 727 }
Note: See TracChangeset
for help on using the changeset viewer.
