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/06 15:37:03 UTC

svn commit: r634279 - in /webservices/axis2/trunk/c: src/core/transport/http/sender/ src/core/transport/tcp/sender/ test/core/transport/http/ util/src/

Author: senaka
Date: Thu Mar  6 06:37:02 2008
New Revision: 634279

URL: http://svn.apache.org/viewvc?rev=634279&view=rev
Log:
Fixing source to incorporate bug fixes to url.c.
These are some instances where we've been living with bugs. :D... Glad to have them fixed.

Regards,
Senaka

Modified:
    webservices/axis2/trunk/c/src/core/transport/http/sender/http_client.c
    webservices/axis2/trunk/c/src/core/transport/http/sender/http_sender.c
    webservices/axis2/trunk/c/src/core/transport/tcp/sender/tcp_transport_sender.c
    webservices/axis2/trunk/c/test/core/transport/http/test_http_transport.c
    webservices/axis2/trunk/c/util/src/url.c

Modified: webservices/axis2/trunk/c/src/core/transport/http/sender/http_client.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/http/sender/http_client.c?rev=634279&r1=634278&r2=634279&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/http/sender/http_client.c (original)
+++ webservices/axis2/trunk/c/src/core/transport/http/sender/http_client.c Thu Mar  6 06:37:02 2008
@@ -183,7 +183,7 @@
     {
         client->sockfd = 
             (int)axutil_network_handler_open_socket(env,
-                                               axutil_url_get_server
+                                               axutil_url_get_host
                                                (client->url, env),
                                                axutil_url_get_port
                                                (client->url, env));
@@ -216,7 +216,7 @@
         {
             if (AXIS2_SUCCESS !=
                 axis2_http_client_connect_ssl_host(client, env,
-                                                   axutil_url_get_server
+                                                   axutil_url_get_host
                                                    (client->url, env),
                                                    axutil_url_get_port
                                                    (client->
@@ -296,13 +296,13 @@
          * POST http://host:port/path HTTP/1.x if we have enabled proxies
          */
         axis2_char_t *host_port_str = NULL;
-        axis2_char_t *server = axutil_url_get_server(client->url, env);
+        axis2_char_t *host = axutil_url_get_host(client->url, env);
         axis2_http_request_line_t *request_line =
             axis2_http_simple_request_get_request_line(request, env);
         axis2_char_t *path = axis2_http_request_line_get_uri(request_line, env);
 
-        /* length = len(server) + len(:port) + len("http://") + len(path) + 1 */
-        host_port_str = AXIS2_MALLOC(env->allocator, axutil_strlen(server) +
+        /* length = len(host) + len(:port) + len("http://") + len(path) + 1 */
+        host_port_str = AXIS2_MALLOC(env->allocator, axutil_strlen(host) +
                                      +axutil_strlen(path) +
                                      20 * sizeof(axis2_char_t));
         if (!host_port_str)
@@ -310,7 +310,7 @@
             AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
             return AXIS2_FAILURE;
         }
-        sprintf(host_port_str, "http://%s:%d%s", server,
+        sprintf(host_port_str, "http://%s:%d%s", host,
                 axutil_url_get_port(client->url, env), path);
         str_request_line =
             AXIS2_MALLOC(env->allocator,

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=634279&r1=634278&r2=634279&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 Thu Mar  6 06:37:02 2008
@@ -701,12 +701,12 @@
         axutil_strcmp (sender->http_version, AXIS2_HTTP_HEADER_PROTOCOL_11))
     {
         axis2_char_t *header = NULL;
-        int server_len = 0;
-        server_len = axutil_strlen (axutil_url_get_server (url, env));
+        int host_len = 0;
+        host_len = axutil_strlen (axutil_url_get_host (url, env));
         header = AXIS2_MALLOC (env->allocator,
-                               server_len + 10 * sizeof (axis2_char_t));
+                               host_len + 10 * sizeof (axis2_char_t));
         sprintf (header, "%s:%d",
-                 axutil_url_get_server (url, env), axutil_url_get_port (url,
+                 axutil_url_get_host (url, env), axutil_url_get_port (url,
                                                                         env));
         axis2_http_sender_util_add_header (env, request, AXIS2_HTTP_HEADER_HOST,
                                            header);

Modified: webservices/axis2/trunk/c/src/core/transport/tcp/sender/tcp_transport_sender.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/tcp/sender/tcp_transport_sender.c?rev=634279&r1=634278&r2=634279&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/tcp/sender/tcp_transport_sender.c (original)
+++ webservices/axis2/trunk/c/src/core/transport/tcp/sender/tcp_transport_sender.c Thu Mar  6 06:37:02 2008
@@ -281,7 +281,7 @@
             return AXIS2_FAILURE;
         }
 
-        host = axutil_url_get_server(to_url, env);
+        host = axutil_url_get_host(to_url, env);
         if (!host)
         {
             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "retrieving host failed");

Modified: webservices/axis2/trunk/c/test/core/transport/http/test_http_transport.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/test/core/transport/http/test_http_transport.c?rev=634279&r1=634278&r2=634279&view=diff
==============================================================================
--- webservices/axis2/trunk/c/test/core/transport/http/test_http_transport.c (original)
+++ webservices/axis2/trunk/c/test/core/transport/http/test_http_transport.c Thu Mar  6 06:37:02 2008
@@ -115,8 +115,8 @@
     }
     printf("Starting URL Test ....\n");
     printf
-        ("Parsed URL : \n Protocol :%s|\n Server :%s|\n Port :%d|\n Path : %s|\n",
-         axutil_url_get_protocol(url, env), axutil_url_get_server(url, env),
+        ("Parsed URL : \n Protocol :%s|\n Host :%s|\n Port :%d|\n Path : %s|\n",
+         axutil_url_get_protocol(url, env), axutil_url_get_host(url, env),
          axutil_url_get_port(url, env), axutil_url_get_path(url, env));
     printf("End of URL Test ... \n");
     axutil_url_free(url, env);
@@ -146,7 +146,7 @@
                                                NULL, 0, NULL);
     url = axutil_url_create(env, "http", "localhost", 80, NULL);
     header =
-        axis2_http_header_create(env, "Host", axutil_url_get_server(url, env));
+        axis2_http_header_create(env, "Host", axutil_url_get_host(url, env));
     axis2_http_simple_request_add_header(request, env, header);
     client = axis2_http_client_create(env, url);
 
@@ -211,7 +211,7 @@
     url = axutil_url_create(env, "https", "localhost", 9090, NULL);
 
     header =
-        axis2_http_header_create(env, "Host", axutil_url_get_server(url, env));
+        axis2_http_header_create(env, "Host", axutil_url_get_host(url, env));
     axis2_http_simple_request_add_header(request, env, header);
     client = axis2_http_client_create(env, url);
 

Modified: webservices/axis2/trunk/c/util/src/url.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/url.c?rev=634279&r1=634278&r2=634279&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/src/url.c (original)
+++ webservices/axis2/trunk/c/util/src/url.c Thu Mar  6 06:37:02 2008
@@ -29,6 +29,7 @@
     axis2_char_t *host;
     int port;
     axis2_char_t *path;
+    axis2_char_t *query;
     axis2_char_t *server;
 };
 
@@ -62,6 +63,7 @@
     url->host = NULL;
     url->path = NULL;
     url->server = NULL;
+    url->query = NULL;
 
     if (host)
     {
@@ -94,6 +96,7 @@
         }
         if (params)
         {
+            url->query = (axis2_char_t *) axutil_strdup(env, params);
             *params = '\0';
         }
         url->path = (axis2_char_t *) axutil_strdup(env, temp);
@@ -121,7 +124,6 @@
     axis2_char_t *path = NULL;
     axis2_char_t *port_str = NULL;
     axis2_char_t *host = NULL;
-    axis2_char_t *params = NULL;
     int port = 0;
 
     AXIS2_ENV_CHECK(env, NULL);
@@ -163,15 +165,6 @@
         AXIS2_FREE(env->allocator, tmp_url_str);
         return ret;
     }
-    params = strchr(host, '?');
-    if (!params)
-    {
-        params = strchr(host, '#');
-    }
-    if (params)
-    {
-        *params = '\0';
-    }
 
     port_str = strchr(host, ':');
     if (!port_str)
@@ -254,7 +247,11 @@
         AXIS2_FREE(env->allocator, url->path);
         url->path = NULL;
     }
-
+    if (url->query)
+    {
+        AXIS2_FREE(env->allocator, url->query);
+        url->query = NULL;
+    }
     AXIS2_FREE(env->allocator, url);
     return;
 }
@@ -292,16 +289,21 @@
     {
         len += axutil_strlen(url->path);
     }
+    if (url->query)
+    {
+        len += axutil_strlen(url->query);
+    }
     if (print_port)
     {
         len += axutil_strlen(port_str) + 1;
     }
     external_form = (axis2_char_t *) AXIS2_MALLOC(env->allocator, len);
-    sprintf(external_form, "%s://%s%s%s%s", url->protocol,
+    sprintf(external_form, "%s://%s%s%s%s%s", url->protocol,
             (url->host) ? url->host : "",
             (print_port) ? ":" : "",
             (print_port) ? port_str : "",
-            (url->path) ? url->path : "");
+            (url->path) ? url->path : "",
+            (url->query) ? url->query : "");
     return external_form;
 }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org