-
-
Save ionutrazvanionita/688a4c832049997ca62e to your computer and use it in GitHub Desktop.
Fix "ignoring compact form content-type header"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/modules/b2b_entities/dlg.c b/modules/b2b_entities/dlg.c | |
index ce3927d..dbce03f 100644 | |
--- a/modules/b2b_entities/dlg.c | |
+++ b/modules/b2b_entities/dlg.c | |
@@ -2743,6 +2743,7 @@ int b2breq_complete_ehdr(str* extra_headers, str* ehdr_out, str* body, | |
{ | |
static char buf[BUF_LEN]; | |
str ehdr= {NULL,0}; | |
+ char* found; | |
if((extra_headers?extra_headers->len:0) + 14 + local_contact->len > BUF_LEN) | |
{ | |
@@ -2759,8 +2760,18 @@ int b2breq_complete_ehdr(str* extra_headers, str* ehdr_out, str* body, | |
ehdr.len += sprintf(ehdr.s+ ehdr.len, "Contact: <%.*s>\r\n", | |
local_contact->len, local_contact->s); | |
- /* if not present and body present add content type */ | |
- if(body && !strstr(ehdr.s, "Content-Type:")) | |
+ /* if not present or is present but it is not a header in both forms | |
+ * "Content-Type" and "c" | |
+ * and body present add content type */ | |
+ if(body && | |
+ ( | |
+ ((found=strstr(ehdr.s, "Content-Type:"))==NULL || | |
+ (found != extra_headers->s && *(found-1) != '\n')) | |
+ && | |
+ ((found=strstr(ehdr.s, "c:"))==NULL || | |
+ (found != extra_headers->s && *(found-1) != '\n')) | |
+ ) | |
+ ) | |
{ | |
/* add content type header */ | |
if(ehdr.len + 32 > BUF_LEN) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment