comparison src/http/modules/ngx_http_uwsgi_module.c @ 3548:fc7541a6959d

fix the previous commit when value is static string: remove the special static values processing, because it is anyway very seldom case
author Igor Sysoev <igor@sysoev.ru>
date Tue, 01 Jun 2010 17:30:23 +0000
parents c2da61796410
children 0b3613117ac5
comparison
equal deleted inserted replaced
3547:c2da61796410 3548:fc7541a6959d
1374 } 1374 }
1375 1375
1376 src = conf->params_source->elts; 1376 src = conf->params_source->elts;
1377 for (i = 0; i < conf->params_source->nelts; i++) { 1377 for (i = 0; i < conf->params_source->nelts; i++) {
1378 1378
1379 if (ngx_http_script_variables_count(&src[i].value) == 0) { 1379 copy = ngx_array_push_n(conf->params_len,
1380 copy = ngx_array_push_n(conf->params_len, 1380 sizeof(ngx_http_script_copy_code_t));
1381 sizeof(ngx_http_script_copy_code_t)); 1381 if (copy == NULL) {
1382 if (copy == NULL) { 1382 return NGX_CONF_ERROR;
1383 return NGX_CONF_ERROR; 1383 }
1384 } 1384
1385 1385 copy->code = (ngx_http_script_code_pt) ngx_http_script_copy_len_code;
1386 copy->code = (ngx_http_script_code_pt) 1386 copy->len = src[i].key.len;
1387 ngx_http_script_copy_len_code; 1387
1388 copy->len = src[i].key.len; 1388
1389 1389 size = (sizeof(ngx_http_script_copy_code_t)
1390 copy = ngx_array_push_n(conf->params_len, 1390 + src[i].key.len + sizeof(uintptr_t) - 1)
1391 sizeof(ngx_http_script_copy_code_t)); 1391 & ~(sizeof(uintptr_t) - 1);
1392 if (copy == NULL) { 1392
1393 return NGX_CONF_ERROR; 1393 copy = ngx_array_push_n(conf->params, size);
1394 } 1394 if (copy == NULL) {
1395 1395 return NGX_CONF_ERROR;
1396 copy->code = (ngx_http_script_code_pt) 1396 }
1397 ngx_http_script_copy_len_code; 1397
1398 copy->len = src[i].value.len; 1398 copy->code = ngx_http_script_copy_code;
1399 1399 copy->len = src[i].key.len;
1400 1400
1401 size = (sizeof(ngx_http_script_copy_code_t) 1401 p = (u_char *) copy + sizeof(ngx_http_script_copy_code_t);
1402 + src[i].key.len + src[i].value.len 1402 ngx_memcpy(p, src[i].key.data, src[i].key.len);
1403 + sizeof(uintptr_t) - 1) & ~(sizeof(uintptr_t) - 1); 1403
1404 1404
1405 copy = ngx_array_push_n(conf->params, size); 1405 ngx_memzero(&sc, sizeof(ngx_http_script_compile_t));
1406 if (copy == NULL) { 1406
1407 return NGX_CONF_ERROR; 1407 sc.cf = cf;
1408 } 1408 sc.source = &src[i].value;
1409 1409 sc.flushes = &conf->flushes;
1410 copy->code = ngx_http_script_copy_code; 1410 sc.lengths = &conf->params_len;
1411 copy->len = src[i].key.len + src[i].value.len; 1411 sc.values = &conf->params;
1412 1412
1413 p = (u_char *) copy + sizeof(ngx_http_script_copy_code_t); 1413 if (ngx_http_script_compile(&sc) != NGX_OK) {
1414 1414 return NGX_CONF_ERROR;
1415 p = ngx_cpymem(p, src[i].key.data, src[i].key.len);
1416 ngx_memcpy(p, src[i].value.data, src[i].value.len);
1417
1418 } else {
1419 copy = ngx_array_push_n(conf->params_len,
1420 sizeof(ngx_http_script_copy_code_t));
1421 if (copy == NULL) {
1422 return NGX_CONF_ERROR;
1423 }
1424
1425 copy->code = (ngx_http_script_code_pt)
1426 ngx_http_script_copy_len_code;
1427 copy->len = src[i].key.len;
1428
1429
1430 size = (sizeof(ngx_http_script_copy_code_t)
1431 + src[i].key.len + sizeof(uintptr_t) - 1)
1432 & ~(sizeof(uintptr_t) - 1);
1433
1434 copy = ngx_array_push_n(conf->params, size);
1435 if (copy == NULL) {
1436 return NGX_CONF_ERROR;
1437 }
1438
1439 copy->code = ngx_http_script_copy_code;
1440 copy->len = src[i].key.len;
1441
1442 p = (u_char *) copy + sizeof(ngx_http_script_copy_code_t);
1443 ngx_memcpy(p, src[i].key.data, src[i].key.len);
1444
1445
1446 ngx_memzero(&sc, sizeof(ngx_http_script_compile_t));
1447
1448 sc.cf = cf;
1449 sc.source = &src[i].value;
1450 sc.flushes = &conf->flushes;
1451 sc.lengths = &conf->params_len;
1452 sc.values = &conf->params;
1453
1454 if (ngx_http_script_compile(&sc) != NGX_OK) {
1455 return NGX_CONF_ERROR;
1456 }
1457 } 1415 }
1458 1416
1459 code = ngx_array_push_n(conf->params_len, sizeof(uintptr_t)); 1417 code = ngx_array_push_n(conf->params_len, sizeof(uintptr_t));
1460 if (code == NULL) { 1418 if (code == NULL) {
1461 return NGX_CONF_ERROR; 1419 return NGX_CONF_ERROR;