in src/server/apache/mod_axis.c [239:390]
static int axis_handler (request_rec* req_rec)
{
int rc;
Ax_soapstream* sstr;
array_header* arr;
#ifndef CHUNCKED_DATA_SUPPORTED
int contentLength = 0;
int index;
sendbuffers* pbuffers;
char strtonum[8];
#endif
sstr = malloc (sizeof (Ax_soapstream));
/*populate Ax_soapstream struct with relevant transport function pointers */
sstr->transport.pSendFunct = send_response_bytes;
sstr->transport.pGetFunct = get_request_bytes;
sstr->transport.pSetTrtFunct = set_transport_information;
sstr->transport.pGetTrtFunct = get_transport_information;
sstr->transport.pRelBufFunct = release_receive_buffer;
sstr->trtype = APTHTTP;
sstr->so.http = malloc (sizeof (Ax_stream_http));
/* req_rec is used as both input and output streams */
sstr->str.ip_stream = req_rec;
sstr->str.op_stream = req_rec;
/* just add some sessionid */
sstr->sessionid = "this is temporary session id";
#ifdef CHUNCKED_DATA_SUPPORTED
/* TODO */
sstr->reserved1 = NULL;
sstr->reserved2 = NULL;
#else
sstr->reserved1 = calloc (NO_OF_SERIALIZE_BUFFERS, sizeof (sendbuffers));
#ifdef USE_XERCES_PARSER
#else
sstr->reserved2 = malloc (SIZEOFMODULEBUFFER);
#endif
#endif
req_rec->content_type = "text/xml";
/* for SOAP 1.2 this this should be "application/soap+xml" but keep this for
* the moment 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);
#ifdef USE_XERCES_PARSER
#else
if (sstr->reserved2)
free (sstr->reserved2);
#endif
free (sstr->so.http);
free (sstr);
return rc;
}
/* the member, "path" of "parsed_uri" contains the uri of the */
/* request (i.e "/abc/xyz" part of http://somehost/abc/xyz) */
sstr->so.http->uri_path = req_rec->parsed_uri.path;
/* ap_table_elts returns an array_header struct. The nelts element of that
* struct contains the number of input header elements. Finally assigns that
* to the axis soap data structure. */
sstr->so.http->ip_headercount = ap_table_elts (req_rec->headers_in)->nelts;
/* casting req_rec->headers_in to axis header struct and assigning that to
* the axis soap structure. Hope this is ok
*/
/* obtain the array_header from the headers_in table and assign it to the
* axis soap structure
*/
arr = ap_table_elts (req_rec->headers_in);
sstr->so.http->ip_headers = (Ax_header*) arr->elts;
/*Determine the http method and assign it to the axis soap structure */
switch (req_rec->method_number)
{
case M_GET:
sstr->so.http->ip_method = AXIS_HTTP_GET;
break;
case M_POST:
sstr->so.http->ip_method = AXIS_HTTP_POST;
break;
default:
sstr->so.http->ip_method = AXIS_HTTP_UNSUPPORTED;
}
/* Tell the client that we are ready to receive content and check whether
* client will send content control will pass to this block only if there is
* body content in the request
*/
if (ap_should_client_block (req_rec));
if (0 != process_request (sstr))
{
if (sstr->reserved1)
free (sstr->reserved1);
#ifdef USE_XERCES_PARSER
#else
if (sstr->reserved2)
free (sstr->reserved2);
#endif
free (sstr->so.http);
free (sstr);
return OK;
}
#ifdef CHUNCKED_DATA_SUPPORTED
/* headers have already been sent. see set_transport_information
* http body too have been sent
* Do we need to send any indication to mark end of chuncked
* data ? Sanjaya ?
*/
#else
/* Calculate Content-Length and set header */
pbuffers = (sendbuffers*) sstr->reserved1;
for (index = 0; index < NO_OF_SERIALIZE_BUFFERS; index++)
{
if (!pbuffers[index].buffer)
break;
contentLength += strlen (pbuffers[index].buffer);
}
if (contentLength != 0) /* do only if the http body is not empty. */
{
sprintf (strtonum, "%d", contentLength);
set_transport_information (SOAP_MESSAGE_LENGTH, strtonum, sstr);
ap_send_http_header (req_rec);
/* Send all buffers */
pbuffers = (sendbuffers*) sstr->reserved1;
for (index = 0; index < NO_OF_SERIALIZE_BUFFERS; index++)
{
if (!pbuffers[index].buffer)
break;
ap_rputs (pbuffers[index].buffer, req_rec);
/* Let Axis know that the buffer is no longer in use */
axis_buffer_release (pbuffers[index].buffer,
pbuffers[index].bufferid, sstr);
}
}
/* Free the array */
if (sstr->reserved1)
free (sstr->reserved1);
#ifdef USE_XERCES_PARSER
#else
if (sstr->reserved2)
free (sstr->reserved2);
#endif
#endif
free (sstr->so.http);
free (sstr);
/* free(arr); */
return OK;
}