1
0
Fork 0

VAS GW fixes for DLR

This commit is contained in:
bagyenda 2007-07-27 17:03:15 +00:00
parent 99318916ea
commit d973e24c53
1 changed files with 36 additions and 54 deletions

View File

@ -429,19 +429,15 @@ static int fetch_serviceurl(MmsEnvelope *e,
ms->accept_x_headers, ms->passthro_headers,
err);
if (base_url)
octstr_destroy(base_url);
octstr_destroy(base_url);
}
done:
if (ctype)
octstr_destroy(ctype);
if (rb)
octstr_destroy(rb);
if (rph)
http_destroy_headers(rph);
if (params)
octstr_destroy(params);
done:
octstr_destroy(ctype);
octstr_destroy(rb);
http_destroy_headers(rph);
octstr_destroy(params);
return res;
}
@ -494,10 +490,9 @@ static int mmsbox_service_dispatch(MmsEnvelope *e)
res = fetch_serviceurl(e, ms, msg, me, keyword, &err);
done:
if (err) {
if (err && res != 0)
error(0, "MMSBox error: %s", octstr_get_cstr(err));
octstr_destroy(err);
}
if (res == -1 || res == 0) /* Fatal error, or success delete queue entry. */
for (i = 0, n = gwlist_len(e->to); i < n; i++) {
MmsEnvelopeTo *r = gwlist_get(e->to,i);
@ -513,10 +508,9 @@ done:
if (mms_queue_update(e) != 1)
mms_queue_free_env(e);
if (keyword)
octstr_destroy(keyword);
if (msg)
mms_destroy(msg);
octstr_destroy(err);
octstr_destroy(keyword);
mms_destroy(msg);
if (me)
mime_entity_destroy(me);
return 1;
@ -1075,7 +1069,7 @@ static int make_and_queue_msg(Octstr *data, Octstr *ctype, List *reply_headers,
octstr_imm(MM_NAME));
info(0, "MMSBox: Queued message from service [%s] to outgoing: %s",
octstr_get_cstr(svc_name), octstr_get_cstr(x));
octstr_destroy(x);
*err = x;
res = 0;
done:
@ -1086,18 +1080,16 @@ done:
octstr_destroy(allow_adaptations);
octstr_destroy(from);
octstr_destroy(xfrom);
octstr_destroy(subject);
octstr_destroy(subject);
if (me)
mime_entity_destroy(me);
if (m)
mms_destroy(m);
if (xto)
gwlist_destroy(xto, (gwlist_item_destructor_t *)octstr_destroy);
if (hdrs)
http_destroy_headers(hdrs);
mms_destroy(m);
gwlist_destroy(xto, (gwlist_item_destructor_t *)octstr_destroy);
http_destroy_headers(hdrs);
octstr_destroy(xservice_code);
octstr_destroy(hsvc_code);
return res;
}
@ -1134,7 +1126,7 @@ static void sendmms_func(void *unused)
Octstr *err = NULL;
List *cgivar_ctypes = NULL;
int tparse = parse_cgivars(h, body, &cgivars, &cgivar_ctypes);
int res = 0, tparse = parse_cgivars(h, body, &cgivars, &cgivar_ctypes);
username = http_cgi_variable(cgivars, "username");
password = http_cgi_variable(cgivars, "password");
@ -1145,7 +1137,7 @@ static void sendmms_func(void *unused)
Octstr *rr_url, *allow_adaptations, *subject = NULL;
List *lto = NULL, *rh = http_create_empty_headers();
Octstr *rb = NULL, *base_url;
int i, n, res = 0;
int i, n;
Octstr *vasid = http_cgi_variable(cgivars, "vasid");
Octstr *service_code = http_cgi_variable(cgivars, "servicecode");
Octstr *mclass = http_cgi_variable(cgivars, "mclass");
@ -1269,17 +1261,19 @@ static void sendmms_func(void *unused)
&err);
if (res < 0)
rb = octstr_format("Error in message conversion: %S", err);
else
rb = octstr_format("Accepted: %S", err ? err : octstr_imm("1"));
} else if (!rb)
rb = octstr_imm("Failed to send message");
http_send_reply(client, (res == 0) ? HTTP_OK : HTTP_BAD_REQUEST, hh,
rb ? rb : octstr_imm("Sent"));
info(0, "MMSBox.mmssend: u=%s, %s",
info(0, "MMSBox.mmssend: u=%s, %s [%s]",
u ? octstr_get_cstr(u->user) : "none",
(res == 0) ? "Sent" : "Not Sent");
if (rh)
http_destroy_headers(rh);
(res == 0) ? "Queued" : "Not Queued",
rb ? octstr_get_cstr(rb) : "");
http_destroy_headers(rh);
octstr_destroy(ctype);
octstr_destroy(rb);
octstr_destroy(base_url);
@ -1293,29 +1287,17 @@ static void sendmms_func(void *unused)
password ? octstr_get_cstr(password) : "(null)");
}
if (err) {
error(0, "%s", octstr_get_cstr(err));
octstr_destroy(err);
}
if (err && res != 0)
error(0, "%s", octstr_get_cstr(err));
octstr_destroy(err);
/* Free the ip and other stuff here. */
octstr_destroy(ip);
if (body)
octstr_destroy(body);
if (url)
octstr_destroy(url);
if (cgivars)
http_destroy_cgiargs(cgivars);
if (cgivar_ctypes)
http_destroy_cgiargs(cgivar_ctypes);
if (h)
http_destroy_headers(h);
if (hh)
http_destroy_headers(hh);
octstr_destroy(body);
octstr_destroy(url);
http_destroy_cgiargs(cgivars);
http_destroy_cgiargs(cgivar_ctypes);
http_destroy_headers(h);
http_destroy_headers(hh);
}
}