You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by sa...@apache.org on 2004/02/13 06:55:18 UTC

cvs commit: ws-axis/c/src/server/apache2 mod_axis2.c

sanjaya     2004/02/12 21:55:18

  Modified:    c/src/server/apache2 mod_axis2.c
  Log:
  removed the global buffer from the apache 2.0 axis module becuse it is not
  thread safe
  
  Revision  Changes    Path
  1.5       +18 -5     ws-axis/c/src/server/apache2/mod_axis2.c
  
  Index: mod_axis2.c
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/server/apache2/mod_axis2.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- mod_axis2.c	29 Jan 2004 06:10:09 -0000	1.4
  +++ mod_axis2.c	13 Feb 2004 05:55:18 -0000	1.5
  @@ -92,7 +92,7 @@
   
   #define SIZEOFMODULEBUFFER 4096
   
  -char g_buffer[SIZEOFMODULEBUFFER];
  +
   
   /**
    * This method adds the http header to the Ax_soapstream. These headers will be dispatched later
  @@ -185,14 +185,16 @@
   	 /*How can I detect an error when reading stream ? Sanjaya ?
   	 In case of an error set buffer to null, size 0 and return TRANSPORT_FAILED*/
   	int len_read;
  +	char* pBuffer = stream->reserved2;
  +	if (!pBuffer) return TRANSPORT_FAILED;
   	/* ap_hard_timeout("util_read", (request_rec*)stream->str.ip_stream);*/
  -	len_read = ap_get_client_block((request_rec*)stream->str.ip_stream, g_buffer, SIZEOFMODULEBUFFER);
  +	len_read = ap_get_client_block((request_rec*)stream->str.ip_stream, pBuffer, SIZEOFMODULEBUFFER);
   	/*ap_reset_timeout((request_rec*)stream->str.ip_stream);*/
  -	*req = g_buffer;
  +	*req = pBuffer;
   	*retsize =  len_read;
   	if (len_read < SIZEOFMODULEBUFFER)
   	{
  -		g_buffer[len_read] = '\0';
  +		pBuffer[len_read] = '\0';
   		return TRANSPORT_FINISHED;
   	}
   	else
  @@ -284,12 +286,17 @@
   	sstr->reserved2 = NULL;
   #else
   	sstr->reserved1 = calloc(NO_OF_SERIALIZE_BUFFERS, sizeof(sendbuffers));
  -	sstr->reserved2 = NULL;
  +	sstr->reserved2 = malloc(SIZEOFMODULEBUFFER);
   #endif
   
   	/*set up the read policy from the client.*/
   	if ((rc = ap_setup_client_block(req_rec, REQUEST_CHUNKED_ERROR)) != OK)
   	{
  +		if (sstr->reserved1) free(sstr->reserved1); 
  +        if (sstr->reserved2) free(sstr->reserved2); 
  +        free(sstr->so.http); 
  +        free(sstr); 
  +
   		return rc;
   	}
   
  @@ -338,6 +345,11 @@
   
   	if(0 != process_request(sstr))
   	{
  +		if (sstr->reserved1) free(sstr->reserved1); 
  +        if (sstr->reserved2) free(sstr->reserved2); 
  +        free(sstr->so.http); 
  +        free(sstr); 
  +
   		ap_rputs("SOAP Engine failed to response",req_rec);
   		return OK;
   	}
  @@ -371,6 +383,7 @@
   	}
   	/*Free the array */
   	if (sstr->reserved1) free(sstr->reserved1);
  +	if (sstr->reserved2) free(sstr->reserved2);
   #endif
   
   	free(sstr);