From dd0c53a77dbd3c8b7e3496c5e15cef757346ef8b Mon Sep 17 00:00:00 2001 From: Andrew Clayton Date: Fri, 26 May 2023 20:51:35 +0100 Subject: [PATCH] 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 --- src/python/nxt_python_wsgi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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++) {