summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorShane Caraveo <shane@php.net>2002-07-14 22:16:21 +0000
committerShane Caraveo <shane@php.net>2002-07-14 22:16:21 +0000
commitda1a01ee934162065f8f61f6a4b10522e5304af1 (patch)
tree95aa8ffcff2f83898013bb1790cf9eadc184b8e8 /ext
parenteaf442b97fd6fa399920c6b94f6e92992c00043c (diff)
downloadphp-git-da1a01ee934162065f8f61f6a4b10522e5304af1.tar.gz
a few fixes
fix __isfault fix decimal encoding fix a couple crashers in release builds by initializing variables set http to 1.0 since 1.1 features are not really supported
Diffstat (limited to 'ext')
-rw-r--r--ext/soap/php_encoding.c4
-rw-r--r--ext/soap/php_http.c48
-rw-r--r--ext/soap/php_soap.h2
-rw-r--r--ext/soap/soap.c33
4 files changed, 49 insertions, 38 deletions
diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c
index 55e4e4f4f4..4ce6a18fff 100644
--- a/ext/soap/php_encoding.c
+++ b/ext/soap/php_encoding.c
@@ -17,7 +17,7 @@ encode defaultEncoding[] = {
{{XSD_STRING, XSD_STRING_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_string},
{{XSD_BOOLEAN, XSD_BOOLEAN_STRING, XSD_NAMESPACE, NULL}, to_zval_bool, to_xml_bool},
- {{XSD_DECIMAL, XSD_DECIMAL_STRING, XSD_NAMESPACE, NULL}, to_zval_long, to_xml_string},
+ {{XSD_DECIMAL, XSD_DECIMAL_STRING, XSD_NAMESPACE, NULL}, to_zval_double, to_xml_string},
{{XSD_FLOAT, XSD_FLOAT_STRING, XSD_NAMESPACE, NULL}, to_zval_double, to_xml_string},
{{XSD_DOUBLE, XSD_DOUBLE_STRING, XSD_NAMESPACE, NULL}, to_zval_double, to_xml_string},
{{XSD_DATETIME, XSD_DATETIME_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_datetime},
@@ -43,7 +43,7 @@ encode defaultEncoding[] = {
//support some of the 1999 data types
{{XSD_STRING, XSD_STRING_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_string, to_xml_string},
{{XSD_BOOLEAN, XSD_BOOLEAN_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_bool, to_xml_bool},
- {{XSD_DECIMAL, XSD_DECIMAL_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_long, to_xml_string},
+ {{XSD_DECIMAL, XSD_DECIMAL_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_double, to_xml_string},
{{XSD_FLOAT, XSD_FLOAT_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_double, to_xml_string},
{{XSD_DOUBLE, XSD_DOUBLE_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_double, to_xml_string},
{{XSD_LONG, XSD_LONG_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_long, to_xml_long},
diff --git a/ext/soap/php_http.c b/ext/soap/php_http.c
index 73c60a3e05..5ec7d0d4fd 100644
--- a/ext/soap/php_http.c
+++ b/ext/soap/php_http.c
@@ -9,7 +9,7 @@ void send_http_soap_request(zval *this_ptr, xmlDoc *doc, char *function_name, ch
php_url *phpurl = NULL;
SOAP_STREAM stream;
-#ifdef PHP_DEBUG
+#ifdef SOAP_DEBUG
zval *raw_request;
#endif
@@ -21,7 +21,7 @@ void send_http_soap_request(zval *this_ptr, xmlDoc *doc, char *function_name, ch
xmlDocDumpMemory(doc, &buf, &buf_size);
-#ifdef PHP_DEBUG
+#ifdef SOAP_DEBUG
MAKE_STD_ZVAL(raw_request);
ZVAL_STRINGL(raw_request, buf, buf_size, 1);
add_property_zval(this_ptr, "__last_request", raw_request);
@@ -60,19 +60,19 @@ void send_http_soap_request(zval *this_ptr, xmlDoc *doc, char *function_name, ch
}
else
php_error(E_ERROR,"Could not connect to host");
- //php_url_free(phpurl);
+ /*php_url_free(phpurl);*/
}
if(stream)
{
zval **cookies;
- char *header = "POST %s HTTP/1.1\r\nConnection: close\r\nAccept: text/html; text/xml; text/plain\r\nUser-Agent: PHP SOAP 0.1\r\nHost: %s\r\nContent-Type: text/xml\r\nContent-Length: %d\r\nSOAPAction: \"%s\"\r\n";
+ char *header = "POST %s HTTP/1.0\r\nConnection: close\r\nAccept: text/html; text/xml; text/plain\r\nUser-Agent: PHP SOAP 0.1\r\nHost: %s\r\nContent-Type: text/xml\r\nContent-Length: %d\r\nSOAPAction: \"%s\"\r\n";
int size = strlen(header) + strlen(phpurl->host) + strlen(phpurl->path) + 10;
- // TODO: Add authication
+ /* TODO: Add authication */
if(sdl != NULL)
{
- // TODO: need to grab soap action from wsdl....
+ /* TODO: need to grab soap action from wsdl.... */
soap_headers = emalloc(size + strlen(soapaction));
sprintf(soap_headers, header, phpurl->path, phpurl->host, buf_size, soapaction);
}
@@ -90,7 +90,7 @@ void send_http_soap_request(zval *this_ptr, xmlDoc *doc, char *function_name, ch
if(err != (int)strlen(soap_headers))
php_error(E_ERROR,"Failed Sending HTTP Headers");
- // Send cookies along with request
+ /* Send cookies along with request */
if(zend_hash_find(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies"), (void **)&cookies) == SUCCESS)
{
smart_str cookie_str = {0};
@@ -155,7 +155,7 @@ void get_http_soap_response(zval *this_ptr, char **buffer, int *buffer_len)
zval **socket_ref;
SOAP_STREAM stream;
-#ifdef PHP_DEBUG
+#ifdef SOAP_DEBUG
zval *raw_response;
#endif
@@ -220,16 +220,19 @@ void get_http_soap_response(zval *this_ptr, char **buffer, int *buffer_len)
if(!get_http_body(stream, http_headers, &http_body, &http_body_size))
php_error(E_ERROR, "Error Fetching http body");
-#ifdef PHP_DEBUG
+#ifdef SOAP_DEBUG
MAKE_STD_ZVAL(raw_response);
ZVAL_STRINGL(raw_response, http_body, http_body_size, 1);
add_property_zval(this_ptr, "__last_response", raw_response);
#endif
- // Close every time right now till i can spend more time on it
- // it works.. it's just slower??
- //See if the server requested a close
+ /*
+ * Close every time right now till i can spend more time on it
+ * it works.. it's just slower??
+ * See if the server requested a close
+ */
http_close = TRUE;
+ /*
connection = get_http_header_value(http_headers,"Connection: ");
if(connection)
{
@@ -242,6 +245,7 @@ void get_http_soap_response(zval *this_ptr, char **buffer, int *buffer_len)
if(!strncmp(http_version,"1.1", 3))
http_close = FALSE;
}
+ */
if(http_close)
{
@@ -254,7 +258,7 @@ void get_http_soap_response(zval *this_ptr, char **buffer, int *buffer_len)
zend_hash_del(Z_OBJPROP_P(this_ptr), "httpsocket", strlen("httpsocket") + 1);
}
- //Check and see if the server even sent a xml document
+ /* Check and see if the server even sent a xml document */
content_type = get_http_header_value(http_headers,"Content-Type: ");
if(content_type)
{
@@ -281,10 +285,12 @@ void get_http_soap_response(zval *this_ptr, char **buffer, int *buffer_len)
efree(content_type);
}
- //Grab and send back every cookie
- //Not going to worry about Path: because
- //we shouldn't be changing urls so path dont
- //matter too much
+ /*
+ Grab and send back every cookie
+ Not going to worry about Path: because
+ we shouldn't be changing urls so path dont
+ matter too much
+ */
cookie_itt = strstr(http_headers,"Set-Cookie: ");
while(cookie_itt)
{
@@ -357,8 +363,10 @@ int get_http_body(SOAP_STREAM stream, char *headers, char **response, int *out_
trans_enc = get_http_header_value(headers, "Transfer-Encoding: ");
content_length = get_http_header_value(headers, "Content-Length: ");
- //this is temp...
- // netscape enterprise server sends in lowercase???
+ /*
+ this is temp...
+ netscape enterprise server sends in lowercase???
+ */
if(content_length == NULL)
content_length = get_http_header_value(headers, "Content-length: ");
@@ -394,7 +402,7 @@ int get_http_body(SOAP_STREAM stream, char *headers, char **response, int *out_
#ifdef PHP_STREAMS
php_stream_getc(stream);php_stream_getc(stream);
#else
- //Eat up '\r' '\n'
+ /* Eat up '\r' '\n' */
php_sock_fgetc(stream);php_sock_fgetc(stream);
#endif
}
diff --git a/ext/soap/php_soap.h b/ext/soap/php_soap.h
index 98c9e57f35..681e5b0ca0 100644
--- a/ext/soap/php_soap.h
+++ b/ext/soap/php_soap.h
@@ -22,6 +22,8 @@
# define PHP_STREAMS
#endif
+#define SOAP_DEBUG 1
+
#ifdef PHP_WIN32
# ifdef PHP_STREAMS
# define SOAP_STREAM php_stream *
diff --git a/ext/soap/soap.c b/ext/soap/soap.c
index 23daffe421..074c5846d3 100644
--- a/ext/soap/soap.c
+++ b/ext/soap/soap.c
@@ -53,7 +53,7 @@ static zend_function_entry soap_client_functions[] = {
PHP_FE(__call, NULL)
PHP_FE(__parse, NULL)
-#ifdef PHP_DEBUG
+#ifdef SOAP_DEBUG
PHP_FE(__getlastrequest, NULL)
PHP_FE(__getlastresponse, NULL)
PHP_FE(__getfunctions, NULL)
@@ -416,8 +416,9 @@ PHP_FUNCTION(soapfault)
int fault_string_len, fault_code_len, fault_actor_len;
zval *thisObj, *details = NULL;
- if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|zs", &fault_string, &fault_string_len,
- &fault_code, &fault_code_len, &details, &fault_actor, &fault_actor_len) == FAILURE)
+ if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|zs",
+ &fault_code, &fault_code_len, &fault_string, &fault_string_len,
+ &details, &fault_actor, &fault_actor_len) == FAILURE)
php_error(E_ERROR, "Invalid arguments to SoapFault constructor");
GET_THIS_OBJECT(thisObj);
@@ -1179,18 +1180,18 @@ PHP_FUNCTION(__parse)
PHP_FUNCTION(__call)
{
- char *function, *soap_action, *uri;
- int function_len, soap_action_len, uri_len, i = 0;
- zval *args;
- zval **real_args;
- zval **param;
+ char *function=NULL, *soap_action=NULL, *uri=NULL;
+ int function_len=0, soap_action_len=0, uri_len=0, i = 0;
+ zval *args=NULL;
+ zval **real_args=NULL;
+ zval **param=NULL;
xmlDocPtr request = NULL;
- int num_params, arg_count;
- zval **ret_params;
+ int num_params=0, arg_count=0;
+ zval **ret_params=NULL;
- char *buffer;
+ char *buffer=NULL;
- int len;
+ int len=0;
if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sa|ss",
&function, &function_len, &args, &soap_action, &soap_action_len, &uri, &uri_len) == FAILURE)
@@ -1235,7 +1236,7 @@ PHP_FUNCTION(__isfault)
GET_THIS_OBJECT(thisObj);
- if(zend_hash_exists(Z_OBJPROP_P(thisObj), "__soap_fault", sizeof("__soap_fault")) == SUCCESS)
+ if(zend_hash_exists(Z_OBJPROP_P(thisObj), "__soap_fault", sizeof("__soap_fault")))
RETURN_TRUE
else
RETURN_FALSE
@@ -1257,7 +1258,7 @@ PHP_FUNCTION(__getfault)
RETURN_NULL();
}
-#ifdef PHP_DEBUG
+#ifdef SOAP_DEBUG
PHP_FUNCTION(__getfunctions)
{
sdlPtr sdl;
@@ -1469,7 +1470,7 @@ void add_soap_fault(zval *obj, char *fault_code, char *fault_string, char *fault
{
zval *fault;
MAKE_STD_ZVAL(fault);
- set_soap_fault(fault, fault_string, fault_code, fault_actor, fault_detail);
+ set_soap_fault(fault, fault_code, fault_string, fault_actor, fault_detail);
add_property_zval(obj, "__soap_fault", fault);
}
@@ -1912,7 +1913,7 @@ void delete_http_socket(void *handle)
TSRMLS_FETCH();
php_stream_close(stream);
#else
- close(stream);
+ SOCK_CLOSE(stream);
#endif
}