[sr-dev] git:3.3: app_python: Bugfix for rewrite_ruri (backport from 4.x)

Konstantin Mosesov ez at voipgroup.org.ua
Mon Feb 25 14:42:54 CET 2013


Module: sip-router
Branch: 3.3
Commit: fdf285621eee4f5c78def8ca824a9f8d53dd286b
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=fdf285621eee4f5c78def8ca824a9f8d53dd286b

Author: Konstantin Mosesov <ez at voipgroup.org.ua>
Committer: Konstantin Mosesov <ez at voipgroup.org.ua>
Date:   Mon Feb 25 15:35:19 2013 +0200

app_python: Bugfix for rewrite_ruri (backport from 4.x)

*) Fixed a bug in msg_rewrite_ruri discovered by "V Tone" <vtone001 at gmail.com>.
*) Removed 'python exception' when do_action returns error. Reason: it is not an exception.
*) Removed abort() if first_line type is invalid.

---

 modules/app_python/python_msgobj.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/modules/app_python/python_msgobj.c b/modules/app_python/python_msgobj.c
index 3e4a2cd..0cec77c 100644
--- a/modules/app_python/python_msgobj.c
+++ b/modules/app_python/python_msgobj.c
@@ -106,14 +106,13 @@ msg_rewrite_ruri(msgobject *self, PyObject *args)
     memset(&act, '\0', sizeof(act));
 
     act.type = SET_URI_T;
-    act.val[0].type = STR_ST;
+    act.val[0].type = STRING_ST;
     act.val[0].u.str.s = ruri;
     act.val[0].u.str.len = strlen(ruri);
 
     init_run_actions_ctx(&ra_ctx);
     if (do_action(&ra_ctx, &act, self->msg) < 0) {
         LM_ERR("Error in do_action\n");
-        PyErr_SetString(PyExc_RuntimeError, "Error in do_action\n");
     }
 
     Py_INCREF(Py_None);
@@ -312,6 +311,7 @@ msg_getType(msgobject *self, PyObject *unused)
     }
 
     switch ((self->msg->first_line).type) {
+
     case SIP_REQUEST:
        rval = "SIP_REQUEST";
        break;
@@ -321,8 +321,9 @@ msg_getType(msgobject *self, PyObject *unused)
        break;
 
     default:
-       /* Shouldn't happen */
-       abort();
+        rval = "SIP_INVALID";
+        break;
+
     }
     return PyString_FromString(rval);
 }




More information about the sr-dev mailing list