mirror of https://github.com/sipwise/kamailio.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
73 lines
2.4 KiB
73 lines
2.4 KiB
From 6c6f25b581e083068e9b3832e8f0235a24a88021 Mon Sep 17 00:00:00 2001
|
|
From: grumvalski <federico.cabiddu@gmail.com>
|
|
Date: Thu, 2 Feb 2017 15:28:16 +0100
|
|
Subject: [PATCH] http_async_client: handle 100 Continue from server
|
|
|
|
(cherry-picked from commit de1c5397847a3660182832a040d9e9c2e737e654)
|
|
---
|
|
modules/http_async_client/async_http.c | 27 ++++++++++++++++++++++++---
|
|
1 file changed, 24 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/modules/http_async_client/async_http.c b/modules/http_async_client/async_http.c
|
|
index 24dc8ba72..4b6c33c4f 100644
|
|
--- a/modules/http_async_client/async_http.c
|
|
+++ b/modules/http_async_client/async_http.c
|
|
@@ -45,7 +45,7 @@
|
|
#include "../../dprint.h"
|
|
#include "../../ut.h"
|
|
#include "../../cfg/cfg_struct.h"
|
|
-#include "../../lib/kcore/faked_msg.h"
|
|
+#include "../../fmsg.h"
|
|
#include "../../modules/tm/tm_load.h"
|
|
|
|
#include "async_http.h"
|
|
@@ -122,6 +122,7 @@ void async_http_cb(struct http_m_reply *reply, void *param)
|
|
unsigned int tlabel;
|
|
struct cell *t = NULL;
|
|
char *p;
|
|
+ str newbuf = {0, 0};
|
|
sip_msg_t *fmsg;
|
|
|
|
if (reply->result != NULL) {
|
|
@@ -140,7 +141,6 @@ void async_http_cb(struct http_m_reply *reply, void *param)
|
|
ah_error.len = strlen(ah_error.s);
|
|
} else {
|
|
/* success */
|
|
-
|
|
/* check for HTTP Via header
|
|
* - HTTP Via format is different that SIP Via
|
|
* - workaround: replace with Hia to be ignored by SIP parser
|
|
@@ -158,7 +158,28 @@ void async_http_cb(struct http_m_reply *reply, void *param)
|
|
if (parse_msg(reply->result->s, reply->result->len, ah_reply) != 0) {
|
|
LM_DBG("failed to parse the http_reply\n");
|
|
} else {
|
|
- LM_DBG("successfully parsed http reply %p\n", ah_reply);
|
|
+ if (ah_reply->first_line.u.reply.statuscode == 100) {
|
|
+ newbuf.s = get_body( ah_reply );
|
|
+ newbuf.len = reply->result->s + reply->result->len - newbuf.s;
|
|
+
|
|
+ if (!(newbuf.len < 0)) {
|
|
+ memset(ah_reply, 0, sizeof(struct sip_msg));
|
|
+ ah_reply->buf = newbuf.s;
|
|
+ ah_reply->len = newbuf.len;
|
|
+
|
|
+ if (parse_msg(ah_reply->buf, ah_reply->len, ah_reply) != 0) {
|
|
+ LM_DBG("failed to parse the http_reply\n");
|
|
+ } else {
|
|
+ LM_DBG("successfully parsed http reply %p\n", ah_reply);
|
|
+ }
|
|
+ } else {
|
|
+ /* this should not happen! */
|
|
+ LM_WARN("something got wrong parsing the 100 Continue: got %d len\n", newbuf.len);
|
|
+ }
|
|
+
|
|
+ } else {
|
|
+ LM_DBG("successfully parsed http reply %p\n", ah_reply);
|
|
+ }
|
|
}
|
|
}
|
|
|
|
--
|
|
2.11.0
|
|
|