From: Seonah Moon Date: Thu, 27 Apr 2017 08:03:26 +0000 (+0900) Subject: Fixed bug related with POST X-Git-Tag: submit/tizen_3.0/20170802.052417~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d772e66b044732fa983434b0b476d01e1c03b108;p=platform%2Fcore%2Fapi%2Fhttp.git Fixed bug related with POST Change-Id: If93f49f5c4c36cb9c87cb16f536e1bb359bc0f43 Signed-off-by: Seonah Moon --- diff --git a/src/http_transaction.c b/src/http_transaction.c index 46fd259..ce075a3 100644 --- a/src/http_transaction.c +++ b/src/http_transaction.c @@ -414,13 +414,11 @@ int _transaction_submit(gpointer user_data) _get_request_body_size(transaction, &body_size); /* Setup for POST method */ - if (transaction->write_event) { - if (content_len > 0 && content_len <= body_size) - write_event = FALSE; - else - write_event = TRUE; - DBG("The write_event is %d.\n", write_event); - } + if (transaction->write_event) + write_event = TRUE; + + DBG("The write_event[%d/%d] formpost[%d] upload_event[%d]\n", + transaction->write_event, write_event, request->formpost, transaction->upload_event); if ((_get_method(request->method) == HTTP_METHOD_POST) && !write_event && !request->formpost) { gchar *body = NULL; @@ -520,7 +518,9 @@ API int http_session_open_transaction(http_session_h http_session, http_method_e transaction->timer_event = 0; transaction->interface_name = NULL; transaction->timeout = 0; - transaction->verify_peer = 1; + transaction->write_event = 0; + transaction->upload_event = FALSE; + transaction->verify_peer = TRUE; transaction->ca_path = g_strdup(HTTP_DEFAULT_CA_PATH); transaction->error[0] = '\0'; transaction->cancel = 0; @@ -1152,6 +1152,7 @@ API int http_transaction_open_authentication(http_transaction_h http_transaction auth_transaction->realm = g_strdup(transaction->realm); auth_transaction->write_event = FALSE; + auth_transaction->upload_event = FALSE; auth_transaction->header_cb = NULL; auth_transaction->header_user_data = NULL; diff --git a/test/http_test.c b/test/http_test.c index 7121314..615cbca 100644 --- a/test/http_test.c +++ b/test/http_test.c @@ -302,12 +302,12 @@ int test_simple_post(void) ERR("Fail to open transaction", ret); return 0; } - ret = http_transaction_request_set_uri(transaction, "http://posttestserver.com/post.php"); + ret = http_transaction_request_set_uri(transaction, "http://httpbin.org/post"); if (ret != 0) { ERR("Fail to set URI", ret); return 0; } - http_transaction_set_ready_to_write(transaction, TRUE); + http_transaction_header_add_field(transaction, "Expect", ""); http_transaction_request_write_body(transaction, post_msg); _register_callbacks(transaction);