/**
* @brief Destroys the Http session handle.
* @since_tizen 3.0
+ * @remarks http_session should be set to NULL after using it
* @param[in] http_session The http session handle
* @return 0 on success, otherwise negative error value
* @retval #HTTP_ERROR_NONE Successful
/*
* @brief Destroys all transaction.
* @since_tizen 3.0
+ * @remarks All http_transactions should be set to NULL after using it
* @param[in] http_session The http session handle
* @return 0 on success, otherwise negative error value
* @retval #HTTP_ERROR_NONE Successful
* @brief Closes the http transaction handle.
* @since_tizen 3.0
* @remarks The @a transaction is released by http_transaction_destroy().
- * It should be used after finishing http trasaction.
+ * http_transaction should be set to NULL after using it.
* @param[in] http_transaction The http transaction handle
* @return 0 on success, otherwise negative error value
* @retval #HTTP_ERROR_NONE Successful
Name: capi-network-http
Summary: Http Framework
-Version: 0.0.4
+Version: 0.0.5
Release: 0
Group: System/Network
License: Apache-2.0
break;
}
- curl_multi_remove_handle(session->multi_handle, curl_easy);
+ if (session->multi_handle != NULL && curl_easy != NULL) {
+ curl_multi_remove_handle(session->multi_handle, curl_easy);
+ }
}
message = curl_multi_info_read(session->multi_handle, &count);
}
__http_session_h *session = (__http_session_h *)http_session;
- if (session->multi_handle) {
- curl_multi_cleanup(session->multi_handle);
- session->multi_handle = NULL;
- }
+ if (session) {
+ if (session->multi_handle) {
+ curl_multi_cleanup(session->multi_handle);
+ session->multi_handle = NULL;
+ }
- session->active_transaction_count = 0;
- session->still_running = 0;
- session->auto_redirect = FALSE;
+ session->active_transaction_count = 0;
+ session->still_running = 0;
+ session->auto_redirect = FALSE;
- free(session);
+ if (session->timer_event) {
+ g_source_remove(session->timer_event);
+ session->timer_event = 0;
+ }
+
+ free(session);
+ session = NULL;
+ }
return HTTP_ERROR_NONE;
}
transaction->request->body_queue = g_queue_new();
transaction->request->tot_size = 0;
+ transaction->response->status_text = NULL;
+
transaction->header->header_list = NULL;
transaction->header->hash_table = NULL;
transaction->thread = NULL;
+ transaction->thread_loop = NULL;
*http_transaction = (http_transaction_h)transaction;
_add_transaction_to_list(transaction);
free(request);
}
- free(response);
+
+ if (response) {
+
+ if (response->status_text != NULL) {
+ free(response->status_text);
+ response->status_text = NULL;
+ }
+
+ free(response);
+
+ }
if (header) {
if (header->header_list != NULL) {
_remove_transaction_from_list(transaction);
- g_main_loop_quit((GMainLoop*)transaction->thread_loop);
+ if (transaction->thread_loop != NULL) {
+ g_main_loop_quit((GMainLoop*)transaction->thread_loop);
- g_main_loop_unref(transaction->thread_loop);
- transaction->thread_loop = NULL;
+ g_main_loop_unref(transaction->thread_loop);
+ transaction->thread_loop = NULL;
+ }
- g_thread_join(transaction->thread);
- transaction->thread = NULL;
+ if (transaction->thread != NULL) {
+ g_thread_join(transaction->thread);
+ transaction->thread = NULL;
+ }
free(transaction);
transaction = NULL;
ret = http_transaction_destroy(transaction);
if (ret == HTTP_ERROR_NONE) DBG("Success to close transaction\n");
else DBG("Fail to close transaction\n");
+
+ transaction = NULL;
}
void __transaction_aborted_cb(http_transaction_h transaction, int reason, void *user_data)
return 0;
}
+ session = NULL;
+
return 1;
}