diff options
Diffstat (limited to 'ext/soap/php_http.c')
-rw-r--r-- | ext/soap/php_http.c | 48 |
1 files changed, 28 insertions, 20 deletions
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 } |