You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by sh...@apache.org on 2009/08/18 12:15:53 UTC
svn commit: r805347 [21/31] - in /webservices/axis2/trunk/c/src: core/addr/
core/clientapi/ core/context/ core/deployment/ core/description/
core/engine/ core/phaseresolver/ core/receivers/
core/transport/amqp/receiver/ core/transport/amqp/receiver/qpi...
Modified: webservices/axis2/trunk/c/src/core/transport/http/common/simple_http_svr_conn.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/http/common/simple_http_svr_conn.c?rev=805347&r1=805346&r2=805347&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/http/common/simple_http_svr_conn.c (original)
+++ webservices/axis2/trunk/c/src/core/transport/http/common/simple_http_svr_conn.c Tue Aug 18 10:15:49 2009
@@ -39,28 +39,27 @@
{
axis2_simple_http_svr_conn_t *svr_conn = NULL;
- svr_conn = (axis2_simple_http_svr_conn_t *)
- AXIS2_MALLOC(env->allocator, sizeof(axis2_simple_http_svr_conn_t));
+ svr_conn = (axis2_simple_http_svr_conn_t *)AXIS2_MALLOC(env->allocator,
+ sizeof(axis2_simple_http_svr_conn_t));
- if (!svr_conn)
+ if(!svr_conn)
{
AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
return NULL;
}
- memset ((void *)svr_conn, 0, sizeof (axis2_simple_http_svr_conn_t));
+ memset((void *)svr_conn, 0, sizeof(axis2_simple_http_svr_conn_t));
svr_conn->socket = sockfd;
svr_conn->stream = NULL;
svr_conn->keep_alive = AXIS2_FALSE;
- if (-1 != svr_conn->socket)
+ if(-1 != svr_conn->socket)
{
svr_conn->stream = axutil_stream_create_socket(env, svr_conn->socket);
- if (!svr_conn->stream)
+ if(!svr_conn->stream)
{
- AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI,
- "socket creation failed, socket %d", (int)sockfd);
- axis2_simple_http_svr_conn_free((axis2_simple_http_svr_conn_t *)
- svr_conn, env);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "socket creation failed, socket %d",
+ (int)sockfd);
+ axis2_simple_http_svr_conn_free((axis2_simple_http_svr_conn_t *)svr_conn, env);
return NULL;
}
}
@@ -72,7 +71,7 @@
axis2_simple_http_svr_conn_t * svr_conn,
const axutil_env_t * env)
{
- if (!svr_conn)
+ if(!svr_conn)
{
return;
}
@@ -89,7 +88,7 @@
const axutil_env_t * env)
{
axutil_stream_free(svr_conn->stream, env);
- if (-1 != svr_conn->socket)
+ if(-1 != svr_conn->socket)
{
axutil_network_handler_close_socket(env, svr_conn->socket);
svr_conn->socket = -1;
@@ -97,20 +96,18 @@
return AXIS2_SUCCESS;
}
-
AXIS2_EXTERN axis2_bool_t AXIS2_CALL
axis2_simple_http_svr_conn_is_open(
axis2_simple_http_svr_conn_t * svr_conn,
const axutil_env_t * env)
{
- if (-1 != svr_conn->socket)
+ if(-1 != svr_conn->socket)
{
return AXIS2_TRUE;
}
return AXIS2_FALSE;
}
-
AXIS2_EXTERN axis2_status_t AXIS2_CALL
axis2_simple_http_svr_conn_set_keep_alive(
axis2_simple_http_svr_conn_t * svr_conn,
@@ -121,7 +118,6 @@
return AXIS2_SUCCESS;
}
-
AXIS2_EXTERN axis2_bool_t AXIS2_CALL
axis2_simple_http_svr_conn_is_keep_alive(
axis2_simple_http_svr_conn_t * svr_conn,
@@ -130,7 +126,6 @@
return svr_conn->keep_alive;
}
-
AXIS2_EXTERN axutil_stream_t *AXIS2_CALL
axis2_simple_http_svr_conn_get_stream(
const axis2_simple_http_svr_conn_t * svr_conn,
@@ -139,7 +134,6 @@
return svr_conn->stream;
}
-
AXIS2_EXTERN axis2_http_response_writer_t *AXIS2_CALL
axis2_simple_http_svr_conn_get_writer(
const axis2_simple_http_svr_conn_t * svr_conn,
@@ -148,7 +142,6 @@
return axis2_http_response_writer_create(env, svr_conn->stream);
}
-
AXIS2_EXTERN axis2_http_simple_request_t *AXIS2_CALL
axis2_simple_http_svr_conn_read_request(
axis2_simple_http_svr_conn_t * svr_conn,
@@ -162,20 +155,16 @@
axis2_http_request_line_t *request_line = NULL;
axis2_http_simple_request_t *request = NULL;
- while ((read =
- axutil_stream_peek_socket(svr_conn->stream, env, tmp_buf,
- 2048 - 1)) > 0)
+ while((read = axutil_stream_peek_socket(svr_conn->stream, env, tmp_buf, 2048 - 1)) > 0)
{
axis2_char_t *start = tmp_buf;
axis2_char_t *end = NULL;
tmp_buf[read] = AXIS2_ESC_NULL;
end = strstr(tmp_buf, AXIS2_HTTP_CRLF);
- if (end)
+ if(end)
{
- read =
- axutil_stream_read(svr_conn->stream, env, tmp_buf,
- end - start + 2);
- if (read > 0)
+ read = axutil_stream_read(svr_conn->stream, env, tmp_buf, end - start + 2);
+ if(read > 0)
{
axis2_char_t* tmp_str_line = NULL;
tmp_buf[read] = AXIS2_ESC_NULL;
@@ -197,7 +186,7 @@
{
/* not reached end yet */
read = axutil_stream_read(svr_conn->stream, env, tmp_buf, 2048 - 1);
- if (read > 0)
+ if(read > 0)
{
axis2_char_t* tmp_str_line = NULL;
tmp_buf[read] = AXIS2_ESC_NULL;
@@ -215,37 +204,30 @@
AXIS2_FREE(env->allocator, str_line);
str_line = NULL;
- if (!request_line)
+ if(!request_line)
{
- AXIS2_HANDLE_ERROR(env,
- AXIS2_ERROR_INVALID_HTTP_HEADER_START_LINE,
- AXIS2_FAILURE);
+ AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_INVALID_HTTP_HEADER_START_LINE, AXIS2_FAILURE);
return NULL;
}
- request = axis2_http_simple_request_create(env, request_line, NULL, 0,
- svr_conn->stream);
+ request = axis2_http_simple_request_create(env, request_line, NULL, 0, svr_conn->stream);
/* now read the headers */
end_of_line = AXIS2_FALSE;
- while (AXIS2_FALSE == end_of_headers)
+ while(AXIS2_FALSE == end_of_headers)
{
axis2_bool_t is_read = AXIS2_FALSE;
- while ((read =
- axutil_stream_peek_socket(svr_conn->stream, env, tmp_buf,
- 2048 - 1)) > 0)
+ while((read = axutil_stream_peek_socket(svr_conn->stream, env, tmp_buf, 2048 - 1)) > 0)
{
axis2_char_t *start = tmp_buf;
axis2_char_t *end = NULL;
is_read = AXIS2_TRUE;
tmp_buf[read] = AXIS2_ESC_NULL;
end = strstr(tmp_buf, AXIS2_HTTP_CRLF);
- if (end)
+ if(end)
{
- read =
- axutil_stream_read(svr_conn->stream, env, tmp_buf,
- end - start + 2);
- if (read > 0)
+ read = axutil_stream_read(svr_conn->stream, env, tmp_buf, end - start + 2);
+ if(read > 0)
{
- axis2_char_t* tmp_str_line = NULL;
+ axis2_char_t* tmp_str_line = NULL;
tmp_buf[read] = AXIS2_ESC_NULL;
tmp_str_line = axutil_stracat(env, str_line, tmp_buf);
if(tmp_str_line)
@@ -263,12 +245,10 @@
}
else
{
- read =
- axutil_stream_read(svr_conn->stream, env, tmp_buf,
- 2048 - 1);
- if (read > 0)
+ read = axutil_stream_read(svr_conn->stream, env, tmp_buf, 2048 - 1);
+ if(read > 0)
{
- axis2_char_t* tmp_str_line = NULL;
+ axis2_char_t* tmp_str_line = NULL;
tmp_buf[read] = AXIS2_ESC_NULL;
tmp_str_line = axutil_stracat(env, str_line, tmp_buf);
if(tmp_str_line)
@@ -281,22 +261,20 @@
}
- if (AXIS2_TRUE == end_of_line)
+ if(AXIS2_TRUE == end_of_line)
{
- if (0 == axutil_strcmp(str_line, AXIS2_HTTP_CRLF))
+ if(0 == axutil_strcmp(str_line, AXIS2_HTTP_CRLF))
{
end_of_headers = AXIS2_TRUE;
}
else
{
- axis2_http_header_t *tmp_header =
- axis2_http_header_create_by_str(env, str_line);
+ axis2_http_header_t *tmp_header = axis2_http_header_create_by_str(env, str_line);
AXIS2_FREE(env->allocator, str_line);
str_line = NULL;
- if (tmp_header)
+ if(tmp_header)
{
- axis2_http_simple_request_add_header(request, env,
- tmp_header);
+ axis2_http_simple_request_add_header(request, env, tmp_header);
}
}
}
@@ -304,7 +282,7 @@
if(!is_read)
{
/*if nothing is read, this loop should be broken. Otherwise, going to be endless loop */
- break;
+ break;
}
}
return request;
@@ -331,47 +309,41 @@
AXIS2_PARAM_CHECK(env->error, response, AXIS2_FAILURE);
response_writer = axis2_http_response_writer_create(env, svr_conn->stream);
- content_type =
- (axis2_char_t *) axis2_http_simple_response_get_content_type(response,
- env);
- if (content_type)
+ content_type = (axis2_char_t *)axis2_http_simple_response_get_content_type(response, env);
+ if(content_type)
{
- if (strstr(content_type, AXIS2_HTTP_HEADER_ACCEPT_MULTIPART_RELATED)
- && strstr(content_type, AXIS2_HTTP_HEADER_ACCEPT_XOP_XML))
+ if(strstr(content_type, AXIS2_HTTP_HEADER_ACCEPT_MULTIPART_RELATED) && strstr(content_type,
+ AXIS2_HTTP_HEADER_ACCEPT_XOP_XML))
binary_content = AXIS2_TRUE;
}
- if (!response_writer)
+ if(!response_writer)
{
return AXIS2_FAILURE;
}
enc_header = axis2_http_simple_response_get_first_header(response, env,
- AXIS2_HTTP_HEADER_TRANSFER_ENCODING);
- if (enc_header)
+ AXIS2_HTTP_HEADER_TRANSFER_ENCODING);
+ if(enc_header)
{
axis2_char_t *enc_value = axis2_http_header_get_value(enc_header, env);
- if (enc_value)
+ if(enc_value)
{
- if (0 == axutil_strcmp(enc_value,
- AXIS2_HTTP_HEADER_TRANSFER_ENCODING_CHUNKED))
+ if(0 == axutil_strcmp(enc_value, AXIS2_HTTP_HEADER_TRANSFER_ENCODING_CHUNKED))
{
chuked_encoding = AXIS2_TRUE;
/* remove the content length header */
- if (AXIS2_TRUE ==
- axis2_http_simple_response_contains_header(response, env,
- AXIS2_HTTP_HEADER_CONTENT_LENGTH))
+ if(AXIS2_TRUE == axis2_http_simple_response_contains_header(response, env,
+ AXIS2_HTTP_HEADER_CONTENT_LENGTH))
{
axis2_http_simple_response_remove_headers(response, env,
- AXIS2_HTTP_HEADER_CONTENT_LENGTH);
+ AXIS2_HTTP_HEADER_CONTENT_LENGTH);
}
}
}
}
status_line = axis2_http_simple_response_get_status_line(response, env);
- if (!status_line)
+ if(!status_line)
{
- AXIS2_HANDLE_ERROR(env,
- AXIS2_ERROR_INVALID_HTTP_HEADER_START_LINE,
- AXIS2_FAILURE);
+ AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_INVALID_HTTP_HEADER_START_LINE, AXIS2_FAILURE);
axis2_http_response_writer_free(response_writer, env);
response_writer = NULL;
return AXIS2_FAILURE;
@@ -379,20 +351,17 @@
axis2_http_response_writer_print_str(response_writer, env, status_line);
headers = axis2_http_simple_response_get_headers(response, env);
- if (headers)
+ if(headers)
{
- for (i = 0; i < axutil_array_list_size(headers, env); i++)
+ for(i = 0; i < axutil_array_list_size(headers, env); i++)
{
axis2_http_header_t *header = NULL;
- header = (axis2_http_header_t *) axutil_array_list_get(headers, env,
- i);
- if (header)
- {
- axis2_char_t *header_ext_form =
- axis2_http_header_to_external_form((axis2_http_header_t *)
- header, env);
- axis2_http_response_writer_print_str(response_writer, env,
- header_ext_form);
+ header = (axis2_http_header_t *)axutil_array_list_get(headers, env, i);
+ if(header)
+ {
+ axis2_char_t *header_ext_form = axis2_http_header_to_external_form(
+ (axis2_http_header_t *)header, env);
+ axis2_http_response_writer_print_str(response_writer, env, header_ext_form);
AXIS2_FREE(env->allocator, header_ext_form);
}
}
@@ -400,7 +369,7 @@
axis2_http_response_writer_println(response_writer, env);
response_stream = axis2_http_simple_response_get_body(response, env);
- if (response_stream)
+ if(response_stream)
{
body_size = axutil_stream_get_len(response_stream, env);
response_body = axutil_stream_get_buffer(response_stream, env);
@@ -408,48 +377,44 @@
response_body[body_size] = AXIS2_ESC_NULL;
}
- if (body_size <= 0 && !binary_content)
+ if(body_size <= 0 && !binary_content)
{
axis2_http_response_writer_free(response_writer, env);
return AXIS2_SUCCESS;
}
/* This sending a normal SOAP response without chunk transfer encoding */
- if (AXIS2_FALSE == chuked_encoding && !binary_content)
+ if(AXIS2_FALSE == chuked_encoding && !binary_content)
{
axis2_status_t write_stat = AXIS2_FAILURE;
- if (AXIS2_FALSE == binary_content)
+ if(AXIS2_FALSE == binary_content)
{
- write_stat = axis2_http_response_writer_println_str(response_writer,
- env,
- response_body);
+ write_stat
+ = axis2_http_response_writer_println_str(response_writer, env, response_body);
}
else
{
- write_stat = axis2_http_response_writer_write_buf(response_writer,
- env,
- response_body, 0,
- body_size);
+ write_stat = axis2_http_response_writer_write_buf(response_writer, env, response_body,
+ 0, body_size);
}
- if (AXIS2_SUCCESS != write_stat)
+ if(AXIS2_SUCCESS != write_stat)
{
- AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_WRITING_RESPONSE,
- AXIS2_FAILURE);
+ AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_WRITING_RESPONSE, AXIS2_FAILURE);
axis2_http_response_writer_free(response_writer, env);
return AXIS2_FAILURE;
}
}
-
+
/* In the MTOM case we enable chunking inorder to send the attachment */
-
+
else if(binary_content)
{
axutil_http_chunked_stream_t *chunked_stream = NULL;
axis2_status_t write_stat = AXIS2_FAILURE;
axutil_array_list_t *mime_parts = NULL;
axis2_char_t *mtom_sending_callback_name = NULL;
-
+
mime_parts = axis2_http_simple_response_get_mime_parts(response, env);
mtom_sending_callback_name = axis2_http_simple_response_get_mtom_sending_callback_name(
@@ -461,45 +426,42 @@
if(!mtom_sending_callback_name)
{
- if(axis2_http_transport_utils_is_callback_required(
- env, mime_parts))
+ if(axis2_http_transport_utils_is_callback_required(env, mime_parts))
{
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Sender callback not specified");
return AXIS2_FAILURE;
}
}
- chunked_stream = axutil_http_chunked_stream_create(env,
- svr_conn->stream);
+ chunked_stream = axutil_http_chunked_stream_create(env, svr_conn->stream);
if(mime_parts)
- {
- write_stat = axis2_http_transport_utils_send_mtom_message(
- chunked_stream, env, mime_parts, mtom_sending_callback_name);
+ {
+ write_stat = axis2_http_transport_utils_send_mtom_message(chunked_stream, env,
+ mime_parts, mtom_sending_callback_name);
axutil_http_chunked_stream_free(chunked_stream, env);
chunked_stream = NULL;
-
+
if(write_stat == AXIS2_FAILURE)
{
return write_stat;
}
- }
+ }
else
{
return AXIS2_FAILURE;
}
- }
-
+ }
+
/* Sending a normal SOAP response enabling htpp chunking */
- else
- {
+ else
+ {
axutil_http_chunked_stream_t *chunked_stream = NULL;
int left = body_size;
chunked_stream = axutil_http_chunked_stream_create(env, svr_conn->stream);
- while (left > 0)
+ while(left > 0)
{
- left -= axutil_http_chunked_stream_write(chunked_stream, env,
- response_body, body_size);
+ left -= axutil_http_chunked_stream_write(chunked_stream, env, response_body, body_size);
}
axutil_http_chunked_stream_write_last_chunk(chunked_stream, env);
axutil_http_chunked_stream_free(chunked_stream, env);
@@ -509,31 +471,24 @@
return AXIS2_SUCCESS;
}
-
AXIS2_EXTERN axis2_status_t AXIS2_CALL
axis2_simple_http_svr_conn_set_rcv_timeout(
axis2_simple_http_svr_conn_t * svr_conn,
const axutil_env_t * env,
int timeout)
{
- return axutil_network_handler_set_sock_option(env,
- svr_conn->socket, SO_RCVTIMEO,
- timeout);
+ return axutil_network_handler_set_sock_option(env, svr_conn->socket, SO_RCVTIMEO, timeout);
}
-
AXIS2_EXTERN axis2_status_t AXIS2_CALL
axis2_simple_http_svr_conn_set_snd_timeout(
axis2_simple_http_svr_conn_t * svr_conn,
const axutil_env_t * env,
int timeout)
{
- return axutil_network_handler_set_sock_option(env,
- svr_conn->socket, SO_SNDTIMEO,
- timeout);
+ return axutil_network_handler_set_sock_option(env, svr_conn->socket, SO_SNDTIMEO, timeout);
}
-
AXIS2_EXTERN axis2_char_t *AXIS2_CALL
axis2_simple_http_svr_conn_get_svr_ip(
const axis2_simple_http_svr_conn_t * svr_conn,
@@ -542,7 +497,6 @@
return axutil_network_handler_get_svr_ip(env, svr_conn->socket);
}
-
AXIS2_EXTERN axis2_char_t *AXIS2_CALL
axis2_simple_http_svr_conn_get_peer_ip(
const axis2_simple_http_svr_conn_t * svr_conn,
@@ -551,4 +505,3 @@
return axutil_network_handler_get_peer_ip(env, svr_conn->socket);
}
-
Modified: webservices/axis2/trunk/c/src/core/transport/http/receiver/http_receiver.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/http/receiver/http_receiver.c?rev=805347&r1=805346&r2=805347&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/http/receiver/http_receiver.c (original)
+++ webservices/axis2/trunk/c/src/core/transport/http/receiver/http_receiver.c Tue Aug 18 10:15:49 2009
@@ -83,12 +83,8 @@
const axutil_env_t * env);
static const axis2_transport_receiver_ops_t http_transport_receiver_ops_var = {
- axis2_http_server_init,
- axis2_http_server_start,
- axis2_http_server_get_reply_to_epr,
- axis2_http_server_get_conf_ctx,
- axis2_http_server_is_running,
- axis2_http_server_stop,
+ axis2_http_server_init, axis2_http_server_start, axis2_http_server_get_reply_to_epr,
+ axis2_http_server_get_conf_ctx, axis2_http_server_is_running, axis2_http_server_stop,
axis2_http_server_free };
AXIS2_EXTERN axis2_transport_receiver_t *AXIS2_CALL
@@ -325,8 +321,8 @@
AXIS2_FREE(env->allocator, svc_path);
if(!url)
{
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
- "Cannot create reply to epr for service %s.", svc_name);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Cannot create reply to epr for service %s.",
+ svc_name);
return NULL;
}
epr = axis2_endpoint_ref_create(env, axutil_url_to_external_form(url, env));
Modified: webservices/axis2/trunk/c/src/core/transport/http/sender/http_client.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/http/sender/http_client.c?rev=805347&r1=805346&r2=805347&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/http/sender/http_client.c (original)
+++ webservices/axis2/trunk/c/src/core/transport/http/sender/http_client.c Tue Aug 18 10:15:49 2009
@@ -1,4 +1,3 @@
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -50,7 +49,7 @@
axis2_char_t *key_file;
axis2_char_t *req_body;
int req_body_size;
-
+
/* These are for mtom case */
axutil_array_list_t *mime_parts;
axis2_bool_t doing_mtom;
@@ -64,10 +63,9 @@
{
axis2_http_client_t *http_client = NULL;
- http_client = (axis2_http_client_t *) AXIS2_MALLOC
- (env->allocator, sizeof(axis2_http_client_t));
+ http_client = (axis2_http_client_t *)AXIS2_MALLOC(env->allocator, sizeof(axis2_http_client_t));
- if (!http_client)
+ if(!http_client)
{
AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
return NULL;
@@ -104,45 +102,44 @@
axis2_http_client_t * http_client,
const axutil_env_t * env)
{
- if (http_client->proxy_host)
- {
- AXIS2_FREE(env->allocator, http_client->proxy_host);
- }
- if (http_client->proxy_host_port)
- {
- AXIS2_FREE(env->allocator, http_client->proxy_host_port);
+ if(http_client->proxy_host)
+ {
+ AXIS2_FREE(env->allocator, http_client->proxy_host);
}
- if (http_client->url)
+ if(http_client->proxy_host_port)
+ {
+ AXIS2_FREE(env->allocator, http_client->proxy_host_port);
+ }
+ if(http_client->url)
{
axutil_url_free(http_client->url, env);
}
- if (http_client->response)
+ if(http_client->response)
{
axis2_http_simple_response_free(http_client->response, env);
}
- if (-1 != http_client->sockfd)
+ if(-1 != http_client->sockfd)
{
axutil_network_handler_close_socket(env, http_client->sockfd);
http_client->sockfd = -1;
}
- if (http_client->req_body)
+ if(http_client->req_body)
{
AXIS2_FREE(env->allocator, http_client->req_body);
}
-
+
/* There is no other appropriate place to free the mime_part list when a
* particular client send requests. */
-
- if (http_client->mime_parts)
+
+ if(http_client->mime_parts)
{
int i = 0;
- for (i = 0; i < axutil_array_list_size(http_client->mime_parts, env); i++)
+ for(i = 0; i < axutil_array_list_size(http_client->mime_parts, env); i++)
{
axiom_mime_part_t *mime_part = NULL;
- mime_part = (axiom_mime_part_t *)
- axutil_array_list_get(http_client->mime_parts, env, i);
- if (mime_part)
+ mime_part = (axiom_mime_part_t *)axutil_array_list_get(http_client->mime_parts, env, i);
+ if(mime_part)
{
axiom_mime_part_free(mime_part, env);
}
@@ -161,7 +158,7 @@
{
axis2_http_client_t *client_l = NULL;
- client_l = (axis2_http_client_t *) client;
+ client_l = (axis2_http_client_t *)client;
axis2_http_client_free(client_l, env);
return;
}
@@ -188,23 +185,23 @@
axis2_status_t status = AXIS2_FAILURE;
axis2_bool_t chunking_enabled = AXIS2_FALSE;
axis2_char_t *host = NULL;
- unsigned int port = 0;
+ unsigned int port = 0;
/* In the MTOM case request body is not set. Instead mime_parts
- array_list is there */
+ array_list is there */
- if (!client->req_body && !(client->doing_mtom))
+ if(!client->req_body && !(client->doing_mtom))
{
- client->req_body_size = axis2_http_simple_request_get_body_bytes(request, env,
- &client->req_body);
+ client->req_body_size = axis2_http_simple_request_get_body_bytes(request, env,
+ &client->req_body);
}
- if (client->dump_input_msg == AXIS2_TRUE)
+ if(client->dump_input_msg == AXIS2_TRUE)
{
return AXIS2_SUCCESS;
}
- if (!client->url)
+ if(!client->url)
{
AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_NULL_URL, AXIS2_FAILURE);
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Request url not set");
@@ -214,16 +211,15 @@
host = axutil_url_get_host(client->url, env);
port = axutil_url_get_port(client->url, env);
-
- if (client->proxy_enabled)
+ if(client->proxy_enabled)
{
- if (!client->proxy_host || client->proxy_port <= 0)
+ if(!client->proxy_host || client->proxy_port <= 0)
{
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Proxy port or Host not set");
return AXIS2_FAILURE;
}
- client->sockfd = (int)axutil_network_handler_open_socket(env, client->proxy_host,
+ client->sockfd = (int)axutil_network_handler_open_socket(env, client->proxy_host,
client->proxy_port);
}
else
@@ -233,14 +229,14 @@
client->sockfd = (int)axutil_network_handler_open_socket(env, host, port);
}
- if (client->sockfd < 0)
+ if(client->sockfd < 0)
{
AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_SOCKET_ERROR, AXIS2_FAILURE);
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Socket Creation failed.");
return AXIS2_FAILURE;
}
- if (client->timeout > 0)
+ if(client->timeout > 0)
{
/*Set the receiving time out*/
axutil_network_handler_set_sock_option(env, client->sockfd, SO_RCVTIMEO, client->timeout);
@@ -249,28 +245,28 @@
axutil_network_handler_set_sock_option(env, client->sockfd, SO_SNDTIMEO, client->timeout);
}
- if (0 == axutil_strcasecmp(axutil_url_get_protocol(client->url, env), AXIS2_TRANSPORT_URL_HTTPS))
+ if(0 == axutil_strcasecmp(axutil_url_get_protocol(client->url, env), AXIS2_TRANSPORT_URL_HTTPS))
{
#ifdef AXIS2_SSL_ENABLED
if (client->proxy_enabled)
{
if (AXIS2_SUCCESS != axis2_http_client_connect_ssl_host(client, env, host, port))
{
- axutil_network_handler_close_socket(env, client->sockfd);
+ axutil_network_handler_close_socket(env, client->sockfd);
client->sockfd = -1;
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "HTTPS connection creation failed");
return AXIS2_FAILURE;
}
}
client->data_stream =
- axutil_stream_create_ssl(env, client->sockfd, axis2_http_client_get_server_cert(client,
- env), axis2_http_client_get_key_file(client, env), ssl_pp);
+ axutil_stream_create_ssl(env, client->sockfd, axis2_http_client_get_server_cert(client,
+ env), axis2_http_client_get_key_file(client, env), ssl_pp);
#else
- axutil_network_handler_close_socket(env, client->sockfd);
+ axutil_network_handler_close_socket(env, client->sockfd);
client->sockfd = -1;
AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_INVALID_TRANSPORT_PROTOCOL, AXIS2_FAILURE);
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
- "Invalid Transport Protocol, HTTPS transport not enabled.");
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "Invalid Transport Protocol, HTTPS transport not enabled.");
return AXIS2_FAILURE;
#endif
@@ -280,12 +276,12 @@
client->data_stream = axutil_stream_create_socket(env, client->sockfd);
}
- if (!client->data_stream)
+ if(!client->data_stream)
{
axutil_network_handler_close_socket(env, client->sockfd);
client->sockfd = -1;
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
- "Data stream creation failed for Host %s and %d port", host, port);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "Data stream creation failed for Host %s and %d port", host, port);
return AXIS2_FAILURE;
}
@@ -293,18 +289,18 @@
/*Accessing HTTP headers*/
headers = axis2_http_simple_request_get_headers(request, env);
- if (headers)
+ if(headers)
{
int header_count = axutil_array_list_size(headers, env);
int i = 0;
char *str_header2 = NULL;
- for (i = 0; i < header_count; i++)
+ for(i = 0; i < header_count; i++)
{
axis2_char_t *header_ext_form = NULL;
- axis2_http_header_t *tmp_header = (axis2_http_header_t *) axutil_array_list_get(headers,
- env, i);
+ axis2_http_header_t *tmp_header = (axis2_http_header_t *)axutil_array_list_get(headers,
+ env, i);
- if (!tmp_header)
+ if(!tmp_header)
{
/* This continue is added as a safey mechanism,
* However I see a problem with this logic, AFAIC
@@ -319,10 +315,9 @@
/* check whether we have transfer encoding and then see whether the
* value is "chunked" */
- if (!axutil_strcmp(axis2_http_header_get_name(tmp_header, env),
- AXIS2_HTTP_HEADER_TRANSFER_ENCODING) &&
- !axutil_strcmp(axis2_http_header_get_value(tmp_header, env),
- AXIS2_HTTP_HEADER_TRANSFER_ENCODING_CHUNKED))
+ if(!axutil_strcmp(axis2_http_header_get_name(tmp_header, env),
+ AXIS2_HTTP_HEADER_TRANSFER_ENCODING) && !axutil_strcmp(axis2_http_header_get_value(
+ tmp_header, env), AXIS2_HTTP_HEADER_TRANSFER_ENCODING_CHUNKED))
{
chunking_enabled = AXIS2_TRUE;
}
@@ -347,10 +342,10 @@
}
}
- if (AXIS2_FALSE == client->proxy_enabled)
+ if(AXIS2_FALSE == client->proxy_enabled)
{
- str_request_line = axis2_http_request_line_to_string
- (axis2_http_simple_request_get_request_line(request, env), env);
+ str_request_line = axis2_http_request_line_to_string(
+ axis2_http_simple_request_get_request_line(request, env), env);
}
else
{
@@ -361,79 +356,79 @@
*/
axis2_char_t *host_port_str = NULL;
axis2_char_t *host = axutil_url_get_host(client->url, env);
- axis2_http_request_line_t *request_line =
- axis2_http_simple_request_get_request_line(request, env);
+ axis2_http_request_line_t *request_line = axis2_http_simple_request_get_request_line(
+ request, env);
axis2_char_t *path = axis2_http_request_line_get_uri(request_line, env);
- host_port_str = AXIS2_MALLOC(env->allocator, axutil_strlen(host) + axutil_strlen(path) +
- 20 * sizeof(axis2_char_t));
+ host_port_str = AXIS2_MALLOC(env->allocator, axutil_strlen(host) + axutil_strlen(path) + 20
+ * sizeof(axis2_char_t));
- if (!host_port_str)
+ if(!host_port_str)
{
- axutil_network_handler_close_socket(env, client->sockfd);
+ axutil_network_handler_close_socket(env, client->sockfd);
client->sockfd = -1;
AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
- AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI,
- "Memory allocation failed for host %s and %s path", host, path);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "Memory allocation failed for host %s and %s path", host, path);
return AXIS2_FAILURE;
}
sprintf(host_port_str, "http://%s:%d%s", host, axutil_url_get_port(client->url, env), path);
- str_request_line = AXIS2_MALLOC(env->allocator, axutil_strlen(host_port_str) +
- 20 * sizeof(axis2_char_t));
+ str_request_line = AXIS2_MALLOC(env->allocator, axutil_strlen(host_port_str) + 20
+ * sizeof(axis2_char_t));
- if (!str_request_line)
+ if(!str_request_line)
{
- axutil_network_handler_close_socket(env, client->sockfd);
- client->sockfd = -1;
+ axutil_network_handler_close_socket(env, client->sockfd);
+ client->sockfd = -1;
AXIS2_FREE(env->allocator, host_port_str);
AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
- AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI,
- "memory allocation failed for host %s and %s path", host, path);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "memory allocation failed for host %s and %s path", host, path);
return AXIS2_FAILURE;
}
- sprintf(str_request_line, "%s %s %s\r\n", axis2_http_request_line_get_method(request_line,
+ sprintf(str_request_line, "%s %s %s\r\n", axis2_http_request_line_get_method(request_line,
env), host_port_str, axis2_http_request_line_get_http_version(request_line, env));
AXIS2_FREE(env->allocator, host_port_str);
host_port_str = NULL;
}
-
- /* Here first we send the http header part */
+
+ /* Here first we send the http header part */
wire_format = axutil_stracat(env, str_request_line, str_header);
AXIS2_FREE(env->allocator, str_header);
str_header = NULL;
AXIS2_FREE(env->allocator, str_request_line);
str_request_line = NULL;
- written = axutil_stream_write(client->data_stream, env, wire_format, axutil_strlen(wire_format));
+ written
+ = axutil_stream_write(client->data_stream, env, wire_format, axutil_strlen(wire_format));
AXIS2_FREE(env->allocator, wire_format);
wire_format = NULL;
/* Then we write the two new line charaters before the http body*/
written = axutil_stream_write(client->data_stream, env, AXIS2_HTTP_CRLF, 2);
-
+
/* When sending MTOM it is bit different. We keep the attachment + other
- mime headers in an array_list and send them one by one */
+ mime headers in an array_list and send them one by one */
if(client->doing_mtom)
{
axis2_status_t status = AXIS2_SUCCESS;
axutil_http_chunked_stream_t *chunked_stream = NULL;
-
+
/* If the callback name is not there, then we will check whether there
* is any mime_parts which has type callback. If we found then no point
* of continuing we should return a failure */
-
+
if(!(client->mtom_sending_callback_name))
{
- if(axis2_http_transport_utils_is_callback_required(
- env, client->mime_parts))
+ if(axis2_http_transport_utils_is_callback_required(env, client->mime_parts))
{
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Sender callback not specified");
return AXIS2_FAILURE;
@@ -441,38 +436,35 @@
}
/* For MTOM we automatically enabled chunking */
- chunked_stream = axutil_http_chunked_stream_create(env,
- client->data_stream);
-
+ chunked_stream = axutil_http_chunked_stream_create(env, client->data_stream);
/* This method will write the Attachment + data to the wire */
- status = axis2_http_transport_utils_send_mtom_message(chunked_stream, env,
- client->mime_parts, client->mtom_sending_callback_name);
+ status = axis2_http_transport_utils_send_mtom_message(chunked_stream, env,
+ client->mime_parts, client->mtom_sending_callback_name);
axutil_http_chunked_stream_free(chunked_stream, env);
chunked_stream = NULL;
-
+
}
/* Non MTOM case */
- else if (client->req_body_size > 0 && client->req_body)
+ else if(client->req_body_size > 0 && client->req_body)
{
int len = 0;
written = 0;
/* Keep on writing data in a loop until we finised
- with all the data in the buffer */
+ with all the data in the buffer */
- if (!chunking_enabled)
+ if(!chunking_enabled)
{
status = AXIS2_SUCCESS;
- while (written < client->req_body_size)
+ while(written < client->req_body_size)
{
len = 0;
- len = axutil_stream_write(client->data_stream, env,
- client->req_body + written,
- client->req_body_size - written);
- if (-1 == len)
+ len = axutil_stream_write(client->data_stream, env, client->req_body + written,
+ client->req_body_size - written);
+ if(-1 == len)
{
status = AXIS2_FAILURE;
break;
@@ -489,27 +481,27 @@
axutil_http_chunked_stream_t *chunked_stream = NULL;
chunked_stream = axutil_http_chunked_stream_create(env, client->data_stream);
status = AXIS2_SUCCESS;
- if (!chunked_stream)
+ if(!chunked_stream)
{
- axutil_network_handler_close_socket(env, client->sockfd);
+ axutil_network_handler_close_socket(env, client->sockfd);
client->sockfd = -1;
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Creatoin of chunked stream failed");
return AXIS2_FAILURE;
}
- while (written < client->req_body_size)
+ while(written < client->req_body_size)
{
- written = axutil_http_chunked_stream_write(chunked_stream, env, client->req_body,
- client->req_body_size);
+ written = axutil_http_chunked_stream_write(chunked_stream, env, client->req_body,
+ client->req_body_size);
- if (-1 == written)
+ if(-1 == written)
{
status = AXIS2_FAILURE;
break;
}
}
- if (AXIS2_SUCCESS == status)
+ if(AXIS2_SUCCESS == status)
{
/* Writing the trailing null charactor */
axutil_http_chunked_stream_write_last_chunk(chunked_stream, env);
@@ -538,9 +530,7 @@
axis2_bool_t end_of_line = AXIS2_FALSE;
axis2_bool_t end_of_headers = AXIS2_FALSE;
-
- if (-1 == client->sockfd || !client->data_stream ||
- AXIS2_FALSE == client->request_sent)
+ if(-1 == client->sockfd || !client->data_stream || AXIS2_FALSE == client->request_sent)
{
axis2_char_t *host;
unsigned int port;
@@ -548,10 +538,9 @@
port = axutil_url_get_port(client->url, env);
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
- "client data stream null or socket error for host \
+ "client data stream null or socket error for host \
%s and %d port", host, port);
- AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_HTTP_REQUEST_NOT_SENT,
- AXIS2_FAILURE);
+ AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_HTTP_REQUEST_NOT_SENT, AXIS2_FAILURE);
return -1;
}
@@ -559,120 +548,102 @@
do
{
memset(str_status_line, 0, 512);
- while ((read = axutil_stream_read(client->data_stream, env, tmp_buf,
- 1)) > 0)
+ while((read = axutil_stream_read(client->data_stream, env, tmp_buf, 1)) > 0)
{
/* "read" variable is number of characters read by stream */
tmp_buf[read] = '\0';
strcat(str_status_line, tmp_buf);
- if (0 != strstr(str_status_line, AXIS2_HTTP_CRLF))
+ if(0 != strstr(str_status_line, AXIS2_HTTP_CRLF))
{
end_of_line = AXIS2_TRUE;
break;
}
}
- if (read < 0)
+ if(read < 0)
{
- AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
- "http client , response timed out");
- AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_RESPONSE_TIMED_OUT,
- AXIS2_FAILURE);
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "http client , response timed out");
+ AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_RESPONSE_TIMED_OUT, AXIS2_FAILURE);
return -1;
}
- else if (read == 0)
+ else if(read == 0)
{
- AXIS2_HANDLE_ERROR(env,
- AXIS2_ERROR_RESPONSE_SERVER_SHUTDOWN,
- AXIS2_FAILURE);
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
- "Response error, Server Shutdown");
+ AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_RESPONSE_SERVER_SHUTDOWN, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Response error, Server Shutdown");
return 0;
}
status_line = axis2_http_status_line_create(env, str_status_line);
- if (!status_line)
+ if(!status_line)
{
- AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI,
- "axis2_http_status_line_create failed for \
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "axis2_http_status_line_create failed for \
str_status_line %s", str_status_line);
- AXIS2_HANDLE_ERROR(env,
- AXIS2_ERROR_INVALID_HTTP_HEADER_START_LINE,
- AXIS2_FAILURE);
+ AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_INVALID_HTTP_HEADER_START_LINE, AXIS2_FAILURE);
http_status = 0;
continue;
}
http_status = axis2_http_status_line_get_status_code(status_line, env);
- }while (AXIS2_HTTP_RESPONSE_OK_CODE_VAL > http_status);
+ }
+ while(AXIS2_HTTP_RESPONSE_OK_CODE_VAL > http_status);
- if (client->response)
+ if(client->response)
axis2_http_simple_response_free(client->response, env);
client->response = axis2_http_simple_response_create_default(env);
- axis2_http_simple_response_set_status_line(
- client->response, env,
- axis2_http_status_line_get_http_version (status_line, env),
- axis2_http_status_line_get_status_code (status_line, env),
- axis2_http_status_line_get_reason_phrase (status_line, env));
+ axis2_http_simple_response_set_status_line(client->response, env,
+ axis2_http_status_line_get_http_version(status_line, env),
+ axis2_http_status_line_get_status_code(status_line, env),
+ axis2_http_status_line_get_reason_phrase(status_line, env));
/* now read the headers */
memset(str_header, 0, 512);
end_of_line = AXIS2_FALSE;
- while (AXIS2_FALSE == end_of_headers)
+ while(AXIS2_FALSE == end_of_headers)
{
- while ((read = axutil_stream_read(client->data_stream, env, tmp_buf,
- 1)) > 0)
+ while((read = axutil_stream_read(client->data_stream, env, tmp_buf, 1)) > 0)
{
tmp_buf[read] = '\0';
strcat(str_header, tmp_buf);
- if (0 != strstr(str_header, AXIS2_HTTP_CRLF))
+ if(0 != strstr(str_header, AXIS2_HTTP_CRLF))
{
end_of_line = AXIS2_TRUE;
break;
}
}
- if (AXIS2_TRUE == end_of_line)
+ if(AXIS2_TRUE == end_of_line)
{
- if (0 == axutil_strcmp(str_header, AXIS2_HTTP_CRLF))
+ if(0 == axutil_strcmp(str_header, AXIS2_HTTP_CRLF))
{
end_of_headers = AXIS2_TRUE;
}
else
{
- axis2_http_header_t *tmp_header =
- axis2_http_header_create_by_str(env, str_header);
+ axis2_http_header_t *tmp_header = axis2_http_header_create_by_str(env, str_header);
memset(str_header, 0, 512);
- if (tmp_header)
+ if(tmp_header)
{
- axis2_http_simple_response_set_header(client->response,
- env, tmp_header);
+ axis2_http_simple_response_set_header(client->response, env, tmp_header);
}
}
}
end_of_line = AXIS2_FALSE;
}
- axis2_http_simple_response_set_body_stream(client->response, env,
- client->data_stream);
- if (status_line)
+ axis2_http_simple_response_set_body_stream(client->response, env, client->data_stream);
+ if(status_line)
{
status_code = axis2_http_status_line_get_status_code(status_line, env);
axis2_http_status_line_free(status_line, env);
status_line = NULL;
}
- if (AXIS2_FALSE ==
- axis2_http_simple_response_contains_header(
- client->response, env,
- AXIS2_HTTP_HEADER_CONTENT_TYPE)
- && 202 != status_code &&
- axis2_http_simple_response_get_content_length(client->response,
- env) > 0)
+ if(AXIS2_FALSE == axis2_http_simple_response_contains_header(client->response, env,
+ AXIS2_HTTP_HEADER_CONTENT_TYPE) && 202 != status_code
+ && axis2_http_simple_response_get_content_length(client->response, env) > 0)
{
- AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_RESPONSE_CONTENT_TYPE_MISSING,
- AXIS2_FAILURE);
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
- "Response does not contain" " Content-Type");
+ AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_RESPONSE_CONTENT_TYPE_MISSING, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Response does not contain" " Content-Type");
return -1;
}
return status_code;
@@ -695,7 +666,7 @@
AXIS2_PARAM_CHECK(env->error, url, AXIS2_FAILURE);
AXIS2_PARAM_CHECK(env->error, client, AXIS2_FAILURE);
- if (client->url)
+ if(client->url)
{
axutil_url_free(client->url, env);
client->url = NULL;
@@ -743,33 +714,32 @@
AXIS2_PARAM_CHECK(env->error, proxy_host, AXIS2_FAILURE);
AXIS2_PARAM_CHECK(env->error, client, AXIS2_FAILURE);
- if (proxy_port <= 0)
+ if(proxy_port <= 0)
{
return AXIS2_FAILURE;
}
client->proxy_port = proxy_port;
- if (client->proxy_host)
+ if(client->proxy_host)
{
AXIS2_FREE(env->allocator, client->proxy_host);
client->proxy_host = NULL;
}
- if (client->proxy_host_port)
+ if(client->proxy_host_port)
{
AXIS2_FREE(env->allocator, client->proxy_host_port);
client->proxy_host_port = NULL;
}
client->proxy_host = axutil_strdup(env, proxy_host);
- if (!client->proxy_host)
+ if(!client->proxy_host)
{
return AXIS2_FAILURE;
}
- client->proxy_host_port =
- AXIS2_MALLOC(env->allocator,
- axutil_strlen(proxy_host) + 10 * sizeof(axis2_char_t));
+ client->proxy_host_port = AXIS2_MALLOC(env->allocator, axutil_strlen(proxy_host) + 10
+ * sizeof(axis2_char_t));
sprintf(client->proxy_host_port, "%s:%d", proxy_host, proxy_port);
client->proxy_enabled = AXIS2_TRUE;
@@ -800,88 +770,83 @@
axis2_bool_t end_of_line = AXIS2_FALSE;
axis2_bool_t end_of_response = AXIS2_FALSE;
axis2_http_status_line_t *status_line = NULL;
-
AXIS2_PARAM_CHECK(env->error, host, AXIS2_FAILURE);
AXIS2_PARAM_CHECK(env->error, client, AXIS2_FAILURE);
AXIS2_PARAM_CHECK(env->error, client->url, AXIS2_FAILURE);
/* This host and port will use for give undersandable log messages
* */
-
- if (port <= 0)
+
+ if(port <= 0)
{
return AXIS2_FAILURE;
}
tmp_stream = axutil_stream_create_socket(env, client->sockfd);
- if (!tmp_stream)
+ if(!tmp_stream)
{
- AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI,
- "unable to create open socket for ssl host %s and %d \
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "unable to create open socket for ssl host %s and %d \
port", host, port);
return AXIS2_FAILURE;
}
- connect_string = AXIS2_MALLOC(env->allocator,
- axutil_strlen(host) * sizeof(axis2_char_t) +
- 30 * sizeof(axis2_char_t));
+ connect_string = AXIS2_MALLOC(env->allocator, axutil_strlen(host) * sizeof(axis2_char_t) + 30
+ * sizeof(axis2_char_t));
sprintf(connect_string, "CONNECT %s:%d HTTP/1.0\r\n\r\n", host, port);
- axutil_stream_write(tmp_stream, env, connect_string,
- axutil_strlen(connect_string) * sizeof(axis2_char_t));
+ axutil_stream_write(tmp_stream, env, connect_string, axutil_strlen(connect_string)
+ * sizeof(axis2_char_t));
memset(str_status_line, 0, 512);
- while ((read = axutil_stream_read(tmp_stream, env, tmp_buf, 1)) > 0)
+ while((read = axutil_stream_read(tmp_stream, env, tmp_buf, 1)) > 0)
{
tmp_buf[read] = '\0';
strcat(str_status_line, tmp_buf);
- if (0 != strstr(str_status_line, AXIS2_HTTP_CRLF))
+ if(0 != strstr(str_status_line, AXIS2_HTTP_CRLF))
{
end_of_line = AXIS2_TRUE;
break;
}
}
- if (read < 0)
+ if(read < 0)
{
- AXIS2_HANDLE_ERROR(env,
- AXIS2_ERROR_RESPONSE_TIMED_OUT, AXIS2_FAILURE);
- AXIS2_FREE(env->allocator, connect_string);
+ AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_RESPONSE_TIMED_OUT, AXIS2_FAILURE);
+ AXIS2_FREE(env->allocator, connect_string);
axutil_stream_free(tmp_stream, env);
return AXIS2_FAILURE;
}
status_line = axis2_http_status_line_create(env, str_status_line);
- if (!status_line)
+ if(!status_line)
{
- AXIS2_HANDLE_ERROR(env,
- AXIS2_ERROR_INVALID_HTTP_HEADER_START_LINE,
- AXIS2_FAILURE);
- AXIS2_FREE(env->allocator, connect_string);
+ AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_INVALID_HTTP_HEADER_START_LINE, AXIS2_FAILURE);
+ AXIS2_FREE(env->allocator, connect_string);
axutil_stream_free(tmp_stream, env);
return AXIS2_FAILURE;
}
- if (200 != axis2_http_status_line_get_status_code(status_line, env))
+ if(200 != axis2_http_status_line_get_status_code(status_line, env))
{
- AXIS2_FREE(env->allocator, connect_string);
+ AXIS2_FREE(env->allocator, connect_string);
axutil_stream_free(tmp_stream, env);
return AXIS2_FAILURE;
}
/* We need to empty the stream before we return
*/
memset(str_status_line, 0, 512);
- while (AXIS2_FALSE == end_of_response)
+ while(AXIS2_FALSE == end_of_response)
{
- while ((read = axutil_stream_read(tmp_stream, env, tmp_buf, 1)) > 0)
+ while((read = axutil_stream_read(tmp_stream, env, tmp_buf, 1)) > 0)
{
tmp_buf[read] = '\0';
strcat(str_status_line, tmp_buf);
- if (0 != strstr(str_status_line, AXIS2_HTTP_CRLF))
+ if(0 != strstr(str_status_line, AXIS2_HTTP_CRLF))
{
end_of_line = AXIS2_TRUE;
break;
}
}
- if (AXIS2_TRUE == end_of_line)
+ if(AXIS2_TRUE == end_of_line)
{
- if (0 == axutil_strcmp(str_status_line, AXIS2_HTTP_CRLF))
+ if(0 == axutil_strcmp(str_status_line, AXIS2_HTTP_CRLF))
{
end_of_response = AXIS2_TRUE;
}
@@ -942,7 +907,6 @@
return client->key_file;
}
-
AXIS2_EXTERN axis2_status_t AXIS2_CALL
axis2_http_client_set_mime_parts(
axis2_http_client_t * client,
@@ -985,7 +949,6 @@
const axutil_env_t * env,
axis2_char_t *callback_name)
{
- client->mtom_sending_callback_name =
- callback_name;
+ client->mtom_sending_callback_name = callback_name;
return AXIS2_SUCCESS;
}