mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-03 03:20:57 +00:00
Fix mime parsing by re-adding support for passing headers to callback functions
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@135235 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -203,6 +203,8 @@ static struct ast_str *http_post_callback(struct ast_tcptls_session_instance *se
|
||||
}
|
||||
|
||||
for (var = headers; var; var = var->next) {
|
||||
fprintf(f, "%s: %s\r\n", var->name, var->value);
|
||||
|
||||
if (!strcasecmp(var->name, "Content-Length")) {
|
||||
if ((sscanf(var->value, "%u", &content_len)) != 1) {
|
||||
ast_log(LOG_ERROR, "Invalid Content-Length in POST request!\n");
|
||||
@@ -211,11 +213,11 @@ static struct ast_str *http_post_callback(struct ast_tcptls_session_instance *se
|
||||
return NULL;
|
||||
}
|
||||
ast_debug(1, "Got a Content-Length of %d\n", content_len);
|
||||
} else if (!strcasecmp(var->name, "Content-Type")) {
|
||||
fprintf(f, "Content-Type: %s\r\n\r\n", var->value);
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(f, "\r\n");
|
||||
|
||||
for (res = sizeof(buf); content_len; content_len -= res) {
|
||||
if (content_len < res) {
|
||||
res = content_len;
|
||||
|
Reference in New Issue
Block a user