summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorAndrew Clayton <a.clayton@nginx.com>2023-05-26 20:51:35 +0100
committerAndrew Clayton <a.clayton@nginx.com>2023-11-08 21:53:46 +0000
commitdd0c53a77dbd3c8b7e3496c5e15cef757346ef8b (patch)
tree2e003f20e571d7f4bb13e7fb6cdfb12ad9df25bc /src
parent0b85fe29f7e49c88cab88aa9303d5885fa9c9dd5 (diff)
downloadunit-dd0c53a77dbd3c8b7e3496c5e15cef757346ef8b.tar.gz
unit-dd0c53a77dbd3c8b7e3496c5e15cef757346ef8b.tar.bz2
Python: Do nxt_unit_sptr_get() earlier in nxt_python_field_value().
This is a preparatory patch for fixing an issue with the encoding of http header field values. This patch simply moves the nxt_unit_sptr_get() to the top of the function where we will need it in the next commit. Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
Diffstat (limited to 'src')
-rw-r--r--src/python/nxt_python_wsgi.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/python/nxt_python_wsgi.c b/src/python/nxt_python_wsgi.c
index dfb31509..ce62534b 100644
--- a/src/python/nxt_python_wsgi.c
+++ b/src/python/nxt_python_wsgi.c
@@ -863,6 +863,8 @@ nxt_python_field_value(nxt_unit_field_t *f, int n, uint32_t vl)
char *p, *src;
PyObject *res;
+ src = nxt_unit_sptr_get(&f->value);
+
#if PY_MAJOR_VERSION == 3
res = PyUnicode_New(vl, 255);
#else
@@ -875,7 +877,6 @@ nxt_python_field_value(nxt_unit_field_t *f, int n, uint32_t vl)
p = PyString_AS_STRING(res);
- src = nxt_unit_sptr_get(&f->value);
p = nxt_cpymem(p, src, f->value_length);
for (i = 1; i < n; i++) {