00001
00002
00003
00004
00005
00006
00007 #include "envH.h"
00008 #ifdef __cplusplus
00009 extern "C" {
00010 #endif
00011
00012 SOAP_SOURCE_STAMP("@(#) envServer.c ver 2.7.9l 2007-10-11 18:09:39 GMT")
00013
00014
00015 SOAP_FMAC5 int SOAP_FMAC6 soap_serve(struct soap *soap)
00016 {
00017 #ifndef WITH_FASTCGI
00018 unsigned int k = soap->max_keep_alive;
00019 #endif
00020
00021 do
00022 {
00023 #ifdef WITH_FASTCGI
00024 if (FCGI_Accept() < 0)
00025 {
00026 soap->error = SOAP_EOF;
00027 return soap_send_fault(soap);
00028 }
00029 #endif
00030
00031 soap_begin(soap);
00032
00033 #ifndef WITH_FASTCGI
00034 if (soap->max_keep_alive > 0 && !--k)
00035 soap->keep_alive = 0;
00036 #endif
00037
00038 if (soap_begin_recv(soap))
00039 { if (soap->error < SOAP_STOP)
00040 {
00041 #ifdef WITH_FASTCGI
00042 soap_send_fault(soap);
00043 #else
00044 return soap_send_fault(soap);
00045 #endif
00046 }
00047 soap_closesock(soap);
00048
00049 continue;
00050 }
00051
00052 if (soap_envelope_begin_in(soap)
00053 || soap_recv_header(soap)
00054 || soap_body_begin_in(soap)
00055 || soap_serve_request(soap)
00056 || (soap->fserveloop && soap->fserveloop(soap)))
00057 {
00058 #ifdef WITH_FASTCGI
00059 soap_send_fault(soap);
00060 #else
00061 return soap_send_fault(soap);
00062 #endif
00063 }
00064
00065 #ifdef WITH_FASTCGI
00066 soap_destroy(soap);
00067 soap_end(soap);
00068 } while (1);
00069 #else
00070 } while (soap->keep_alive);
00071 #endif
00072 return SOAP_OK;
00073 }
00074
00075 #ifndef WITH_NOSERVEREQUEST
00076 SOAP_FMAC5 int SOAP_FMAC6 soap_serve_request(struct soap *soap)
00077 {
00078 soap_peek_element(soap);
00079 return soap->error = SOAP_NO_METHOD;
00080 }
00081 #endif
00082
00083 #ifdef __cplusplus
00084 }
00085 #endif
00086
00087