From 7823d122b1c9a8d2ea896492d953a248085b2266 Mon Sep 17 00:00:00 2001 From: shankar Date: Thu, 11 Mar 2010 04:03:19 +0000 Subject: Fixing issue AXIS2C-1468 git-svn-id: http://svn.apache.org/repos/asf/axis/axis2/c/core/trunk@921684 13f79535-47bb-0310-9956-ffa450edef68 --- src/core/transport/http/sender/http_client.c | 33 ++++++++++++++++++++++++++-- src/core/transport/http/sender/http_sender.c | 7 ++++++ 2 files changed, 38 insertions(+), 2 deletions(-) (limited to 'src/core') diff --git a/src/core/transport/http/sender/http_client.c b/src/core/transport/http/sender/http_client.c index 80e7ee3..e662581 100644 --- a/src/core/transport/http/sender/http_client.c +++ b/src/core/transport/http/sender/http_client.c @@ -190,11 +190,11 @@ axis2_http_client_send( /* In the MTOM case request body is not set. Instead mime_parts array_list is there */ - if(client->req_body) + /*if(client->req_body) { AXIS2_FREE(env->allocator, client->req_body); client->req_body = NULL; - } + }*/ if(!client->req_body && !(client->doing_mtom)) { client->req_body_size = axis2_http_simple_request_get_body_bytes(request, env, @@ -963,3 +963,32 @@ axis2_http_client_set_mtom_sending_callback_name( client->mtom_sending_callback_name = callback_name; return AXIS2_SUCCESS; } + +AXIS2_EXTERN axis2_status_t AXIS2_CALL +axis2_http_client_consume_stream( + axis2_http_client_t * client, + const axutil_env_t * env) +{ + /*axutil_stream_close(client->data_stream, env);*/ + axis2_char_t tmp_buffer[512]; + int read; + + while((read = axutil_stream_read(client->data_stream, env, tmp_buffer, 511)) == 511) + { + } + + return AXIS2_SUCCESS; +} + +AXIS2_EXTERN axis2_status_t AXIS2_CALL +axis2_http_client_reset( + axis2_http_client_t * client, + const axutil_env_t * env) +{ + if(client->req_body) + { + AXIS2_FREE(env->allocator, client->req_body); + client->req_body = NULL; + } + return AXIS2_SUCCESS; +} \ No newline at end of file diff --git a/src/core/transport/http/sender/http_sender.c b/src/core/transport/http/sender/http_sender.c index 56f11e0..5ccc5fb 100644 --- a/src/core/transport/http/sender/http_sender.c +++ b/src/core/transport/http/sender/http_sender.c @@ -1190,6 +1190,9 @@ header"); if(AXIS2_HTTP_RESPONSE_HTTP_UNAUTHORIZED_CODE_VAL == status_code && !test_http_auth) { + /* consume the buffer */ + axis2_http_client_consume_stream(sender->client, env); + if(!http_auth_header_added) { if(force_proxy_auth_with_head) @@ -3292,6 +3295,10 @@ axis2_http_sender_connection_map_get( if(server) { http_client = axutil_hash_get(connection_map, server, AXIS2_HASH_KEY_STRING); + if(http_client) + { + axis2_http_client_reset(http_client, env); + } } axutil_url_free(url, env); } -- cgit v1.1-32-gdbae