You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by se...@apache.org on 2008/03/18 04:55:22 UTC
svn commit: r638199 - in /webservices/axis2/trunk/c:
include/axis2_http_transport.h src/core/transport/http/common/http_worker.c
Author: senaka
Date: Mon Mar 17 20:55:21 2008
New Revision: 638199
URL: http://svn.apache.org/viewvc?rev=638199&view=rev
Log:
Fixing JIRA Issue AXIS2C-1061
Modified:
webservices/axis2/trunk/c/include/axis2_http_transport.h
webservices/axis2/trunk/c/src/core/transport/http/common/http_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=638199&r1=638198&r2=638199&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_http_transport.h (original)
+++ webservices/axis2/trunk/c/include/axis2_http_transport.h Mon Mar 17 20:55:21 2008
@@ -435,6 +435,21 @@
*/
#define AXIS2_HTTP_HEADER_USER_AGENT_AXIS2C "User-Agent: Axis2C/" AXIS2_VERSION_STRING
+ /**
+ * HEADER_SERVER
+ */
+#define AXIS2_HTTP_HEADER_SERVER "Server"
+
+ /**
+ * HEADER_DATE
+ */
+#define AXIS2_HTTP_HEADER_DATE "Date"
+
+ /**
+ * HEADER_SERVER_AXIS2C
+ */
+#define AXIS2_HTTP_HEADER_SERVER_AXIS2C "Server: Axis2C/" AXIS2_VERSION_STRING
+
#define AXIS2_HTTP_HEADER_ACCEPT_ "Accept: "
#define AXIS2_HTTP_HEADER_EXPECT_ "Expect: "
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=638199&r1=638198&r2=638199&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 Mon Mar 17 20:55:21 2008
@@ -34,6 +34,9 @@
#include <axiom_soap.h>
#include <string.h>
#include <axutil_string_util.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <platforms/axutil_platform_auto_sense.h>
struct axis2_http_worker
{
@@ -60,6 +63,10 @@
const axutil_env_t * env,
axis2_http_simple_request_t * request);
+static axis2_char_t *axis2_http_worker_get_server_time(
+ axis2_http_worker_t * http_worker,
+ const axutil_env_t * env);
+
AXIS2_EXTERN axis2_http_worker_t *AXIS2_CALL
axis2_http_worker_create(
const axutil_env_t * env,
@@ -170,6 +177,28 @@
env,
AXIS2_HTTP_HEADER_TRANSFER_ENCODING);
+ if (response)
+ {
+ axis2_http_header_t *server = NULL;
+ axis2_http_header_t *server_date = NULL;
+ axis2_char_t *date_str = NULL;
+ char *date_str_tmp = NULL;
+
+ date_str_tmp = axis2_http_worker_get_server_time(http_worker, env);
+ date_str = AXIS2_MALLOC(env->allocator,
+ sizeof(axis2_char_t) * (strlen(date_str_tmp) + 5));
+ sprintf(date_str, "%s GMT", date_str_tmp);
+ server_date = axis2_http_header_create(env,
+ AXIS2_HTTP_HEADER_DATE, date_str);
+ axis2_http_simple_response_set_header(response, env, server_date);
+
+ server = axis2_http_header_create(env,
+ AXIS2_HTTP_HEADER_SERVER,
+ "Axis2C/" AXIS2_VERSION_STRING
+ " (Simple Axis2 HTTP Server)");
+ axis2_http_simple_response_set_header(response, env, server);
+ }
+
if (encoding_header)
{
encoding_header_value = axis2_http_header_get_value(encoding_header,
@@ -1295,4 +1324,26 @@
{
worker->svr_port = port;
return AXIS2_SUCCESS;
+}
+
+static axis2_char_t *axis2_http_worker_get_server_time(
+ axis2_http_worker_t * http_worker,
+ const axutil_env_t * env)
+{
+ time_t tp;
+ char *time_str;
+ tp = time(&tp);
+ time_str = ctime(&tp);
+ if (!time_str)
+ {
+ return NULL;
+ }
+ if ('\n' == time_str[strlen(time_str) - 1])
+ {
+ time_str[strlen(time_str) - 1] = '\0';
+ }
+ /* We use the ANSI C Date Format, which is Legal according to RFC2616,
+ * Section 3.3.1. We are not a HTTP/1.1 only server, and thus, it suffices.
+ */
+ return time_str;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org