ws-axis-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sa...@apache.org
Subject svn commit: r386006 - in /webservices/axis2/trunk/c: include/ modules/core/transport/http/ modules/core/transport/http/server/apache2/ modules/util/
Date Wed, 15 Mar 2006 09:06:50 GMT
Author: sahan
Date: Wed Mar 15 01:06:48 2006
New Revision: 386006

URL: http://svn.apache.org/viewcvs?rev=386006&view=rev
Log:
Fixing issue AXIS2C-98.

Modified:
    webservices/axis2/trunk/c/include/axis2_stream.h
    webservices/axis2/trunk/c/modules/core/transport/http/http_chunked_stream.c
    webservices/axis2/trunk/c/modules/core/transport/http/http_transport_utils.c
    webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/apache2_stream.c
    webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/apache2_worker.c
    webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/mod_axis2.c
    webservices/axis2/trunk/c/modules/util/stream.c

Modified: webservices/axis2/trunk/c/include/axis2_stream.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_stream.h?rev=386006&r1=386005&r2=386006&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_stream.h (original)
+++ webservices/axis2/trunk/c/include/axis2_stream.h Wed Mar 15 01:06:48 2006
@@ -48,7 +48,8 @@
 {
 	AXIS2_STREAM_BASIC = 0,
 	AXIS2_STREAM_FILE,
-	AXIS2_STREAM_SOCKET
+	AXIS2_STREAM_SOCKET,
+    AXIS2_STREAM_MANAGED /* Example Wrapper stream for Apache2 read mechanism */
 };
 
 
@@ -186,7 +187,8 @@
 
 #define AXIS2_STREAM_BASIC_GET_LEN(stream, env) \
 		((stream)->ops->get_len(stream, env))
-
+#define AXIS2_STREAM_GET_TYPE(stream, env)\
+        ((stream)->ops->get_type(stream, env))
 /** @} */
     
 #ifdef __cplusplus

Modified: webservices/axis2/trunk/c/modules/core/transport/http/http_chunked_stream.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/transport/http/http_chunked_stream.c?rev=386006&r1=386005&r2=386006&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/http_chunked_stream.c (original)
+++ webservices/axis2/trunk/c/modules/core/transport/http/http_chunked_stream.c Wed Mar 15
01:06:48 2006
@@ -257,6 +257,8 @@
 	chunked_stream_impl->current_chunk_size = strtol(str_chunk_len, NULL, 16);
 	if(0 == chunked_stream_impl->current_chunk_size)
 	{
+        /* Read the last CRLF */
+        read = AXIS2_STREAM_READ(chunked_stream_impl->stream, env, tmp_buf, 2);
 		chunked_stream_impl->end_of_chunks = AXIS2_TRUE;
 	}
 	else
@@ -277,7 +279,7 @@
 	AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
 	
 	stream = AXIS2_INTF_TO_IMPL(chunked_stream)->stream;
-	if(AXIS2_STREAM_WRITE(stream, env, "0\r\n", 3) == 3)
+	if(AXIS2_STREAM_WRITE(stream, env, "0\r\n\r\n", 5) == 5)
 	{
 		return AXIS2_SUCCESS;
 	}

Modified: webservices/axis2/trunk/c/modules/core/transport/http/http_transport_utils.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/transport/http/http_transport_utils.c?rev=386006&r1=386005&r2=386006&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/http_transport_utils.c (original)
+++ webservices/axis2/trunk/c/modules/core/transport/http/http_transport_utils.c Wed Mar 15
01:06:48 2006
@@ -814,24 +814,36 @@
 		axis2_stream_t *in_stream = NULL;
         int read_len = 0;
         in_stream = (axis2_stream_t *)((axis2_callback_info_t*)ctx)->in_stream;
-        if(size > ((axis2_callback_info_t*)ctx)->unread_len && 
-						-1 != ((axis2_callback_info_t*)ctx)->unread_len)
+        /* For managed streams such as Apache2 streams we do not need to 
+         * calculate lenghts
+         */
+        if(AXIS2_STREAM_MANAGED == AXIS2_STREAM_GET_TYPE(in_stream, env))
         {
-            read_len = ((axis2_callback_info_t*)ctx)->unread_len;
+            read_len = size;
         }
         else
         {
-            read_len = size;
+            if(size > ((axis2_callback_info_t*)ctx)->unread_len && 
+                        -1 != ((axis2_callback_info_t*)ctx)->unread_len)
+            {
+                read_len = ((axis2_callback_info_t*)ctx)->unread_len;
+            }
+            else
+            {
+                read_len = size;
+            }
         }
         len = AXIS2_STREAM_READ(in_stream, env, buffer, read_len);
         if(len > 0)
         {
-             buffer[len] = '\0';
-            ((axis2_callback_info_t*)ctx)->unread_len -= len;
+            buffer[len] = '\0';
+            if(AXIS2_STREAM_MANAGED != AXIS2_STREAM_GET_TYPE(in_stream, env))
+            {
+                ((axis2_callback_info_t*)ctx)->unread_len -= len;
+            }            
         }
         return len;
     }
-
 	return 0;	
 }
 

Modified: webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/apache2_stream.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/apache2_stream.c?rev=386006&r1=386005&r2=386006&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/apache2_stream.c
(original)
+++ webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/apache2_stream.c
Wed Mar 15 01:06:48 2006
@@ -27,7 +27,8 @@
   
 struct apache2_stream_impl
 {
-	axis2_stream_t stream; 
+	axis2_stream_t stream;
+    axis2_stream_type_t stream_type;
     request_rec *request;   
 };
 
@@ -37,6 +38,9 @@
 axis2_status_t AXIS2_CALL 
 apache2_stream_free (axis2_stream_t *stream, axis2_env_t **env);
 
+axis2_stream_type_t AXIS2_CALL
+apache2_stream_get_type (axis2_stream_t *stream, axis2_env_t **env);
+
 int AXIS2_CALL
 apache2_stream_write(axis2_stream_t *stream, axis2_env_t **env, 
 						const void *buffer, size_t count);
@@ -70,6 +74,7 @@
 	}
     
     stream_impl->request = request;
+    stream_impl->stream_type = AXIS2_STREAM_MANAGED;
 	stream_impl->stream.ops = (axis2_stream_ops_t *) AXIS2_MALLOC (
                         (*env)->allocator, sizeof (axis2_stream_ops_t));
 	if (NULL == stream_impl->stream.ops)
@@ -84,6 +89,7 @@
     stream_impl->stream.ops->write = apache2_stream_write;
     stream_impl->stream.ops->skip = apache2_stream_skip;
     stream_impl->stream.ops->get_char = apache2_stream_get_char;
+    stream_impl->stream.ops->get_type = apache2_stream_get_type;
     
 	return &(stream_impl->stream);
 }
@@ -188,4 +194,11 @@
     
     /* TODO implement this */
     return ret;
+}
+
+axis2_stream_type_t AXIS2_CALL
+apache2_stream_get_type (axis2_stream_t *stream, axis2_env_t **env)
+{
+    AXIS2_ENV_CHECK(env, AXIS2_CRTICAL_FAILURE);
+    return AXIS2_INTF_TO_IMPL(stream)->stream_type;
 }

Modified: webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/apache2_worker.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/apache2_worker.c?rev=386006&r1=386005&r2=386006&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/apache2_worker.c
(original)
+++ webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/apache2_worker.c
Wed Mar 15 01:06:48 2006
@@ -174,6 +174,7 @@
     if(request->read_chunked == AXIS2_TRUE && 0 == content_length)
     {
         content_length = -1;
+        request->chunked = 1;
     }
 	if(NULL == http_version)
 	{

Modified: webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/mod_axis2.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/mod_axis2.c?rev=386006&r1=386005&r2=386006&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/mod_axis2.c (original)
+++ webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/mod_axis2.c Wed Mar
15 01:06:48 2006
@@ -105,6 +105,7 @@
     {
         return rv;
     }
+    ap_should_client_block(req);
     rv = AXIS2_APACHE2_WORKER_PROCESS_REQUEST(axis2_worker, &axis2_env, req);
     if(AXIS2_CRTICAL_FAILURE == rv)
     {

Modified: webservices/axis2/trunk/c/modules/util/stream.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/stream.c?rev=386006&r1=386005&r2=386006&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/util/stream.c (original)
+++ webservices/axis2/trunk/c/modules/util/stream.c Wed Mar 15 01:06:48 2006
@@ -137,6 +137,7 @@
     stream_impl->stream.axis2_eof = EOF;
 	
 	stream_impl->stream.ops->free = axis2_stream_free;
+    stream_impl->stream.ops->get_type = axis2_stream_get_type;
 	stream_impl->stream.ops->free_void_arg = axis2_stream_free_void_arg; 
 	return &(stream_impl->stream);
 }
@@ -178,6 +179,7 @@
 			stream_impl->len = -1;
 			break;
 		}
+        default: break;
 	}
 		
 	if (NULL != stream_impl->stream.ops)



Mime
View raw message