Hardcoded faultstring in add_soap_fault on HTTP error codes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I see that ext/soap/php_http.c contains hardcoded HTTP messages when creating SoapFault exceptions:

if (http_status == 400) {
 add_soap_fault(this_ptr, "HTTP", "Bad Request", NULL, NULL TSRMLS_CC);
} else if (http_status == 401) {
add_soap_fault(this_ptr, "HTTP", "Unauthorized Request", NULL, NULL TSRMLS_CC);
} else if (http_status == 405) {
add_soap_fault(this_ptr, "HTTP", "Method not allowed", NULL, NULL TSRMLS_CC);
} else if (http_status == 415) {
add_soap_fault(this_ptr, "HTTP", "Unsupported Media Type", NULL, NULL TSRMLS_CC);
} else if (http_status >= 400 && http_status < 500) {
 add_soap_fault(this_ptr, "HTTP", "Client Error", NULL, NULL TSRMLS_CC);
} else if (http_status == 500) {
add_soap_fault(this_ptr, "HTTP", "Internal Server Error", NULL, NULL TSRMLS_CC);
} else if (http_status >= 500 && http_status < 600) {
 add_soap_fault(this_ptr, "HTTP", "Server Error", NULL, NULL TSRMLS_CC);
} else {
add_soap_fault(this_ptr, "HTTP", "Unsupported HTTP status code", NULL, NULL TSRMLS_CC);
}

This seems like a bad decision since we loose the actual response message. I think it would be better to have both the response code and the response string inside the faultstring on these types of HTTP responses.

There are many situations where you may get the same response code for different response messages.

Best regards,
Knut Urdalen

--
PHP Soap Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Kernel Newbies]     [PHP Database]     [Yosemite]

  Powered by Linux