summaryrefslogtreecommitdiffhomepage
path: root/src/python
diff options
context:
space:
mode:
Diffstat (limited to 'src/python')
-rw-r--r--src/python/nxt_python_asgi.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/python/nxt_python_asgi.c b/src/python/nxt_python_asgi.c
index 8f300b53..702f4d8d 100644
--- a/src/python/nxt_python_asgi.c
+++ b/src/python/nxt_python_asgi.c
@@ -693,15 +693,17 @@ nxt_py_asgi_create_http_scope(nxt_unit_request_info_t *req,
: nxt_py_1_0_str)
SET_ITEM(scope, scheme, scheme)
- v = PyString_FromStringAndSize(nxt_unit_sptr_get(&r->method),
- r->method_length);
- if (nxt_slow_path(v == NULL)) {
- nxt_unit_req_alert(req, "Python failed to create 'method' string");
- goto fail;
- }
+ if (!r->websocket_handshake) {
+ v = PyString_FromStringAndSize(nxt_unit_sptr_get(&r->method),
+ r->method_length);
+ if (nxt_slow_path(v == NULL)) {
+ nxt_unit_req_alert(req, "Python failed to create 'method' string");
+ goto fail;
+ }
- SET_ITEM(scope, method, v)
- Py_DECREF(v);
+ SET_ITEM(scope, method, v)
+ Py_DECREF(v);
+ }
v = PyUnicode_DecodeUTF8(nxt_unit_sptr_get(&r->path), r->path_length,
"replace");