diff options
-rw-r--r-- | include/axis2_http_client.h | 10 | ||||
-rw-r--r-- | src/core/transport/http/sender/http_client.c | 33 | ||||
-rw-r--r-- | src/core/transport/http/sender/http_sender.c | 7 |
3 files changed, 48 insertions, 2 deletions
diff --git a/include/axis2_http_client.h b/include/axis2_http_client.h index fbad8d4..9e14a95 100644 --- a/include/axis2_http_client.h +++ b/include/axis2_http_client.h @@ -261,6 +261,16 @@ extern "C" const axutil_env_t * env, axis2_char_t *callback_name); + AXIS2_EXTERN axis2_status_t AXIS2_CALL + axis2_http_client_consume_stream( + axis2_http_client_t * client, + const axutil_env_t * env); + + AXIS2_EXTERN axis2_status_t AXIS2_CALL + axis2_http_client_reset( + axis2_http_client_t * client, + const axutil_env_t * env); + /** @} */ #ifdef __cplusplus 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); } |