From 229623f3314d1e7102fbaeb2d7f55bdce7f21a07 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 23 Jun 2017 16:47:03 +0200 Subject: [PATCH] Handle HTTP error responses during log collection upload. --- coreapi/linphonecore.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 4056c294b..454961e2c 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -817,8 +817,7 @@ static void process_response_from_post_file_log_collection(void *data, const bel l = belle_http_request_listener_create_from_callbacks(&cbs, core); belle_sip_object_data_set(BELLE_SIP_OBJECT(req), "http_request_listener", l, belle_sip_object_unref); // Ensure the listener object is destroyed when the request is destroyed belle_http_provider_send_request(core->http_provider, req, l); - } - if (code == 200) { /* The file has been uploaded correctly, get the server reply */ + } else if (code == 200) { /* The file has been uploaded correctly, get the server reply */ xmlDocPtr xmlMessageBody; xmlNodePtr cur; xmlChar *file_url = NULL; @@ -850,6 +849,10 @@ static void process_response_from_post_file_log_collection(void *data, const bel linphone_core_notify_log_collection_upload_state_changed(core, LinphoneCoreLogCollectionUploadStateDelivered, (const char *)file_url); } clean_log_collection_upload_context(core); + } else { + ms_error("Unexpected HTTP response code %i during log collection upload to %s", code, linphone_core_get_log_collection_upload_server_url(core)); + linphone_core_notify_log_collection_upload_state_changed(core, LinphoneCoreLogCollectionUploadStateNotDelivered, "Unexpected HTTP response"); + clean_log_collection_upload_context(core); } } }