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/17 20:44:26 UTC
svn commit: r638047 - in /webservices/axis2/trunk/c:
include/axis2_http_transport.h src/core/transport/http/sender/http_sender.c
tools/tcpmon/src/tcpmon.c
Author: senaka
Date: Mon Mar 17 12:44:24 2008
New Revision: 638047
URL: http://svn.apache.org/viewvc?rev=638047&view=rev
Log:
Fixing User-Agent Header to suit definition in RFC2616, [1]. And, removing hardcoded header names in tcpmon.c
[1] http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.8
Regards,
Senaka
Modified:
webservices/axis2/trunk/c/include/axis2_http_transport.h
webservices/axis2/trunk/c/src/core/transport/http/sender/http_sender.c
webservices/axis2/trunk/c/tools/tcpmon/src/tcpmon.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=638047&r1=638046&r2=638047&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_http_transport.h (original)
+++ webservices/axis2/trunk/c/include/axis2_http_transport.h Mon Mar 17 12:44:24 2008
@@ -19,6 +19,7 @@
#define AXIS2_HTTP_TRANSPORT_H
#include <axis2_const.h>
+#include <axutil_version.h>
#ifdef __cplusplus
extern "C"
@@ -432,7 +433,7 @@
/**
* HEADER_USER_AGENT_AXIS2C
*/
-#define AXIS2_HTTP_HEADER_USER_AGENT_AXIS2C "User-Agent: Axis2/C"
+#define AXIS2_HTTP_HEADER_USER_AGENT_AXIS2C "User-Agent: Axis2C/" AXIS2_VERSION_STRING
#define AXIS2_HTTP_HEADER_ACCEPT_ "Accept: "
Modified: webservices/axis2/trunk/c/src/core/transport/http/sender/http_sender.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/http/sender/http_sender.c?rev=638047&r1=638046&r2=638047&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/http/sender/http_sender.c (original)
+++ webservices/axis2/trunk/c/src/core/transport/http/sender/http_sender.c Mon Mar 17 12:44:24 2008
@@ -35,6 +35,7 @@
#include <axis2_const.h>
#include <axis2_util.h>
#include <axiom_soap.h>
+#include <axutil_version.h>
#ifdef AXIS2_LIBCURL_ENABLED
#include "libcurl/axis2_libcurl.h"
@@ -503,7 +504,8 @@
axis2_http_sender_util_add_header (env,
request,
- AXIS2_HTTP_HEADER_USER_AGENT, "Axis2/C");
+ AXIS2_HTTP_HEADER_USER_AGENT, "Axis2C/"
+ AXIS2_VERSION_STRING);
http_property =
axis2_msg_ctx_get_property (msg_ctx,
Modified: webservices/axis2/trunk/c/tools/tcpmon/src/tcpmon.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/tcpmon/src/tcpmon.c?rev=638047&r1=638046&r2=638047&view=diff
==============================================================================
--- webservices/axis2/trunk/c/tools/tcpmon/src/tcpmon.c (original)
+++ webservices/axis2/trunk/c/tools/tcpmon/src/tcpmon.c Mon Mar 17 12:44:24 2008
@@ -28,6 +28,8 @@
#include <stdio.h>
#include <axutil_stream.h>
#include <axutil_network_handler.h>
+#include <axis2_http_transport.h>
+#include <axutil_version.h>
#define SIZE 1024
axis2_char_t *tcpmon_traffic_log = "tcpmon_traffic.log";
@@ -264,7 +266,8 @@
if (status == 0)
{
- if (strstr(TCPMON_ENTRY_SENT_HEADERS(entry, env), "User-Agent: Axis2/C TCPMon\r\n"))
+ if (strstr(TCPMON_ENTRY_SENT_HEADERS(entry, env), AXIS2_HTTP_HEADER_USER_AGENT
+ ": Axis2C/" AXIS2_VERSION_STRING " TCPMon\r\n"))
{
resend = 1;
}
@@ -700,14 +703,15 @@
req_content_len -= (int)strlen(tmp1);
tmp1 = str_replace(tmp1, ";\n\t", "; ");
req_header = tmp1;
- tmp2 = strstr(req_header, "User-Agent:");
+ tmp2 = strstr(req_header, AXIS2_HTTP_HEADER_USER_AGENT ":");
if (tmp2)
{
tmp3 = strstr(tmp2, "\r\n");
if (tmp3)
{
int header_len = 0;
- axis2_char_t *user_agent = "User-Agent: Axis2/C TCPMon";
+ axis2_char_t *user_agent = AXIS2_HTTP_HEADER_USER_AGENT
+ ": Axis2C/" AXIS2_VERSION_STRING " TCPMon";
header_len = (int)(tmp3 - tmp2) + 2;
tmp1 = AXIS2_MALLOC(env->allocator,
sizeof(axis2_char_t) * header_len + 1);
@@ -726,7 +730,7 @@
}
if (!has_raw_binary)
{
- tmp2 = strstr(req_header, "Content-Length:");
+ tmp2 = strstr(req_header, AXIS2_HTTP_HEADER_CONTENT_LENGTH ":");
if (tmp2)
{
tmp3 = strstr(tmp2, "\r\n");
@@ -741,7 +745,8 @@
tmp2 = AXIS2_MALLOC(env->allocator,
sizeof(axis2_char_t) * (header_len + 2));
req_content_len = (int)strlen(req_payload);
- sprintf(tmp2, "%s%d\r\n", "Content-Length: ", req_content_len);
+ sprintf(tmp2, "%s%d\r\n", AXIS2_HTTP_HEADER_CONTENT_LENGTH
+ ": ", req_content_len);
req_header = str_replace(req_header, tmp1, tmp2);
AXIS2_FREE(env->allocator, tmp1);
AXIS2_FREE(env->allocator, tmp2);
@@ -750,7 +755,7 @@
}
}
}
- tmp2 = strstr(req_header, "Host:");
+ tmp2 = strstr(req_header, AXIS2_HTTP_HEADER_HOST ":");
if (tmp2)
{
tmp3 = strstr(tmp2, "\r\n");
@@ -765,7 +770,7 @@
header_len = 16 + (int)strlen(listen_host);
tmp2 = AXIS2_MALLOC(env->allocator,
sizeof(axis2_char_t) * (header_len + 1));
- sprintf(tmp2, "%s%s:%d\r\n", "Host: ", listen_host,
+ sprintf(tmp2, "%s%s:%d\r\n", AXIS2_HTTP_HEADER_HOST ": ", listen_host,
TCPMON_SESSION_GET_LISTEN_PORT(session, env));
req_header = str_replace(req_header, tmp1, tmp2);
AXIS2_FREE(env->allocator, tmp1);
@@ -836,7 +841,7 @@
if (status == 0)
{
- if (strstr(TCPMON_ENTRY_SENT_HEADERS(entry, env), "User-Agent: Axis2/C TCPMon\r\n"))
+ if (strstr(TCPMON_ENTRY_SENT_HEADERS(entry, env), AXIS2_HTTP_HEADER_USER_AGENT ": Axis2C/" AXIS2_VERSION_STRING " TCPMon\r\n"))
{
resend = 1;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org