You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by se...@apache.org on 2008/03/15 23:22:44 UTC
svn commit: r637486 - in /webservices/axis2/trunk/c:
include/axis2_http_transport.h src/core/transport/http/common/http_worker.c
src/core/transport/http/server/apache2/apache2_worker.c
Author: senaka
Date: Sat Mar 15 15:22:29 2008
New Revision: 637486
URL: http://svn.apache.org/viewvc?rev=637486&view=rev
Log:
Adding support to report 400 Bad Request for malformed URLs
Modified:
webservices/axis2/trunk/c/include/axis2_http_transport.h
webservices/axis2/trunk/c/src/core/transport/http/common/http_worker.c
webservices/axis2/trunk/c/src/core/transport/http/server/apache2/apache2_worker.c
Modified: webservices/axis2/trunk/c/include/axis2_http_transport.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/include/axis2_http_transport.h?rev=637486&r1=637485&r2=637486&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_http_transport.h (original)
+++ webservices/axis2/trunk/c/include/axis2_http_transport.h Sat Mar 15 15:22:29 2008
@@ -84,6 +84,11 @@
#define AXIS2_HTTP_RESPONSE_ACK_CODE_VAL 202
/**
+ * RESPONSE_BAD_REQUEST_CODE_VAL
+ */
+#define AXIS2_HTTP_RESPONSE_BAD_REQUEST_CODE_VAL 400
+
+ /**
* RESPONSE_HTTP_UNAUTHORIZED_CODE_VAL
*/
#define AXIS2_HTTP_RESPONSE_HTTP_UNAUTHORIZED_CODE_VAL 401
@@ -132,6 +137,11 @@
* RESPONSE_ACK_CODE_NAME
*/
#define AXIS2_HTTP_RESPONSE_ACK_CODE_NAME "Accepted"
+
+ /**
+ * RESPONSE_BAD_REQUEST_CODE_NAME
+ */
+#define AXIS2_HTTP_RESPONSE_BAD_REQUEST_CODE_NAME "Bad Request"
/**
* RESPONSE_HTTP_UNAUTHORIZED_CODE_NAME
Modified: webservices/axis2/trunk/c/src/core/transport/http/common/http_worker.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/http/common/http_worker.c?rev=637486&r1=637485&r2=637486&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/http/common/http_worker.c (original)
+++ webservices/axis2/trunk/c/src/core/transport/http/common/http_worker.c Sat Mar 15 15:22:29 2008
@@ -195,6 +195,27 @@
}
}
+ request_url = axutil_url_create(env, "http", svr_ip,
+ http_worker->svr_port, path);
+ if (request_url)
+ {
+ url_external_form = axutil_url_to_external_form(request_url, env);
+ }
+
+ if (!url_external_form)
+ {
+ axis2_http_simple_response_set_status_line(response, env,
+ http_version,
+ AXIS2_HTTP_RESPONSE_BAD_REQUEST_CODE_VAL,
+ AXIS2_HTTP_RESPONSE_BAD_REQUEST_CODE_NAME);
+ status =
+ axis2_simple_http_svr_conn_write_response(svr_conn, env,
+ response);
+ axis2_http_simple_response_free(response, env);
+ response = NULL;
+ return status;
+ }
+
request_body = axis2_http_simple_request_get_body(simple_request, env);
out_desc = axis2_conf_get_transport_out(axis2_conf_ctx_get_conf
@@ -227,11 +248,6 @@
path =
axis2_http_request_line_get_uri
(axis2_http_simple_request_get_request_line(simple_request, env), env);
-
- request_url = axutil_url_create(env, "http", svr_ip,
- http_worker->svr_port, path);
-
- url_external_form = axutil_url_to_external_form(request_url, env);
axis2_msg_ctx_set_transport_out_stream(msg_ctx, env, out_stream);
Modified: webservices/axis2/trunk/c/src/core/transport/http/server/apache2/apache2_worker.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/http/server/apache2/apache2_worker.c?rev=637486&r1=637485&r2=637486&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/http/server/apache2/apache2_worker.c (original)
+++ webservices/axis2/trunk/c/src/core/transport/http/server/apache2/apache2_worker.c Sat Mar 15 15:22:29 2008
@@ -166,6 +166,7 @@
axis2_op_ctx_t *op_ctx = NULL;
axis2_char_t *peer_ip = NULL;
axutil_property_t *peer_property = NULL;
+ axutil_url_t *test_url = NULL;
AXIS2_ENV_CHECK(env, AXIS2_CRITICAL_FAILURE);
AXIS2_PARAM_CHECK(env->error, request, AXIS2_CRITICAL_FAILURE);
@@ -182,6 +183,18 @@
/* We are sure that the difference lies within the int range */
http_version = request->protocol;
req_url = request->unparsed_uri;
+
+ test_url = axutil_url_parse_string(env, req_url);
+ if (test_url)
+ {
+ axutil_url_free(test_url, env);
+ test_url = NULL;
+ }
+ else
+ {
+ send_status = OK;
+ request->status = HTTP_BAD_REQUEST;
+ }
content_type = (axis2_char_t *) apr_table_get(request->headers_in,
AXIS2_HTTP_HEADER_CONTENT_TYPE);
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org