comparison Sources/IncomingHttpRequestFilter.cpp @ 131:c55b0583084b

integration fix-leak->mainline
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 30 Aug 2023 11:52:45 +0200
parents a3f77cf16396 a862d554753f
children 71d305c29cfa
comparison
equal deleted inserted replaced
130:a3f77cf16396 131:c55b0583084b
49 PythonString str(lock, uri); 49 PythonString str(lock, uri);
50 PyTuple_SetItem(args.GetPyObject(), 0, str.Release()); 50 PyTuple_SetItem(args.GetPyObject(), 0, str.Release());
51 } 51 }
52 52
53 PythonObject kw(lock, PyDict_New()); 53 PythonObject kw(lock, PyDict_New());
54 PyDict_SetItemString(kw.GetPyObject(), "method", PyLong_FromLong(method)); 54
55 {
56 PythonObject tmp(lock, PyLong_FromLong(method));
57 PyDict_SetItemString(kw.GetPyObject(), "method", tmp.GetPyObject());
58 }
55 59
56 { 60 {
57 PythonString str(lock, ip); 61 PythonString str(lock, ip);
58 PyDict_SetItemString(kw.GetPyObject(), "ip", str.Release()); 62 PyDict_SetItemString(kw.GetPyObject(), "ip", str.GetPyObject());
59 } 63 }
60 64
61 { 65 {
62 PythonObject headers(lock, PyDict_New()); 66 PythonObject headers(lock, PyDict_New());
63 67
64 for (uint32_t i = 0; i < headersCount; i++) 68 for (uint32_t i = 0; i < headersCount; i++)
65 { 69 {
66 PythonString str(lock, headersValues[i]); 70 PythonString str(lock, headersValues[i]);
67 PyDict_SetItemString(headers.GetPyObject(), headersKeys[i], str.Release()); 71 PyDict_SetItemString(headers.GetPyObject(), headersKeys[i], str.GetPyObject());
68 } 72 }
69 73
70 PyDict_SetItemString(kw.GetPyObject(), "headers", headers.Release()); 74 PyDict_SetItemString(kw.GetPyObject(), "headers", headers.GetPyObject());
71 } 75 }
72 76
73 if (method == OrthancPluginHttpMethod_Get) 77 if (method == OrthancPluginHttpMethod_Get)
74 { 78 {
75 PythonObject getArguments(lock, PyDict_New()); 79 PythonObject getArguments(lock, PyDict_New());
76 80
77 for (uint32_t i = 0; i < getArgumentsCount; i++) 81 for (uint32_t i = 0; i < getArgumentsCount; i++)
78 { 82 {
79 PythonString str(lock, getArgumentsValues[i]); 83 PythonString str(lock, getArgumentsValues[i]);
80 PyDict_SetItemString(getArguments.GetPyObject(), getArgumentsKeys[i], str.Release()); 84 PyDict_SetItemString(getArguments.GetPyObject(), getArgumentsKeys[i], str.GetPyObject());
81 } 85 }
82 86
83 PyDict_SetItemString(kw.GetPyObject(), "get", getArguments.Release()); 87 PyDict_SetItemString(kw.GetPyObject(), "get", getArguments.GetPyObject());
84 } 88 }
85 89
86 PythonObject result(lock, PyObject_Call(incomingHttpRequestFilter_, 90 PythonObject result(lock, PyObject_Call(incomingHttpRequestFilter_,
87 args.GetPyObject(), kw.GetPyObject())); 91 args.GetPyObject(), kw.GetPyObject()));
88 92