axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sen...@apache.org
Subject svn commit: r634286 - /webservices/axis2/trunk/c/util/src/url.c
Date Thu, 06 Mar 2008 15:01:26 GMT
Author: senaka
Date: Thu Mar  6 07:01:25 2008
New Revision: 634286

URL: http://svn.apache.org/viewvc?rev=634286&view=rev
Log:
Fixing url.c to support query string & fragment, as they are assumed to be a part of url.c
in the Axis2/C source.

Modified:
    webservices/axis2/trunk/c/util/src/url.c

Modified: webservices/axis2/trunk/c/util/src/url.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/url.c?rev=634286&r1=634285&r2=634286&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/src/url.c (original)
+++ webservices/axis2/trunk/c/util/src/url.c Thu Mar  6 07:01:25 2008
@@ -172,6 +172,14 @@
         path = strchr(host, '/');
         if (!path)
         {
+            path = strchr(host, '?');
+        }
+        if (!path)
+        {
+            path = strchr(host, '#');
+        }
+        if (!path)
+        {
             /* No path - assume def path ('/') */
             /* here we have protocol + host + def port + def path */
             ret = axutil_url_create(env, protocol, host, port, "/");
@@ -180,7 +188,6 @@
         }
         else
         {
-            *path++ = '\0';
             /* here we have protocol + host + def port + path */
             ret = axutil_url_create(env, protocol, host, port, path);
             AXIS2_FREE(env->allocator, tmp_url_str);
@@ -193,6 +200,31 @@
         path = strchr(port_str, '/');
         if (!path)
         {
+            path = strchr(port_str, '?');
+            if (path)
+            {
+                *path = '\0';
+                port = AXIS2_ATOI(port_str);
+                *path = '?';
+            }
+        }
+        else
+        {
+            *path++ = '\0';
+            port = AXIS2_ATOI(port_str);
+        }
+        if (!path)
+        {
+            path = strchr(port_str, '#');
+            if (path)
+            {
+                *path = '\0';
+                port = AXIS2_ATOI(port_str);
+                *path = '#';
+            }
+        }
+        if (!path)
+        {
             port = AXIS2_ATOI(port_str);
             /* here we have protocol + host + port + def path */
             ret = axutil_url_create(env, protocol, host, port, "/");
@@ -201,8 +233,6 @@
         }
         else
         {
-            *path++ = '\0';
-            port = AXIS2_ATOI(port_str);
             if (axutil_strlen(path) > 0)
             {
                 /* here we have protocol + host + port + path */
@@ -541,10 +571,30 @@
     axutil_url_t * url,
     const axutil_env_t * env)
 {
+    axis2_char_t *temp = NULL;
+    axutil_url_t *ret = NULL;
     AXIS2_ENV_CHECK(env, NULL);
 
-    return axutil_url_create(env, url->protocol, url->host, url->port,
-                             url->path);
+    if (url->path && url->query)
+    {
+        temp = axutil_stracat(env, url->path, url->query);
+    }
+    else if (url->path)
+    {
+        temp = axutil_strdup(env, url->path);
+    }
+    else if (url->query)
+    {
+        temp = axutil_strdup(env, url->query);
+    }
+
+    ret = axutil_url_create(env, url->protocol, url->host, url->port,
+                            url->path);
+    if (temp)
+    {
+        AXIS2_FREE(env->allocator, temp);
+    }
+    return ret;
 }
 
 AXIS2_EXTERN axutil_uri_t *AXIS2_CALL



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


Mime
View raw message