Module: kamailio Branch: master Commit: de1c5397847a3660182832a040d9e9c2e737e654 URL: https://github.com/kamailio/kamailio/commit/de1c5397847a3660182832a040d9e9c2...
Author: grumvalski federico.cabiddu@gmail.com Committer: grumvalski federico.cabiddu@gmail.com Date: 2017-02-02T15:03:39+01:00
http_async_client: handle 100 Continue from server
---
Modified: src/modules/http_async_client/async_http.c
---
Diff: https://github.com/kamailio/kamailio/commit/de1c5397847a3660182832a040d9e9c2... Patch: https://github.com/kamailio/kamailio/commit/de1c5397847a3660182832a040d9e9c2...
---
diff --git a/src/modules/http_async_client/async_http.c b/src/modules/http_async_client/async_http.c index 57d203a..5c1d249 100644 --- a/src/modules/http_async_client/async_http.c +++ b/src/modules/http_async_client/async_http.c @@ -124,6 +124,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) { @@ -142,7 +143,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 @@ -160,7 +160,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); + } } }