- u->path = (char *)xmalloc (strlen (url + i) + 8);
- strcpy (u->path, url + i);
+
+ /* dfb: break "path" into "path" and "qstring" if the URL is HTTP
+ if it's not an HTTP url, set l to the last character, so the
+ xmalloc and strncpy work as desired */
+ if (type == URLHTTP) {
+ for (l = i; url[l] && url[l] != '?'; l++);
+ if (l != strlen(url)) {
+ /* copy the query string, including the '?' into u->qstring */
+ u->qstring = (char *)xmalloc (strlen (url + l) + 8);
+ strcpy (u->qstring, url + l);
+ }
+ } else {
+ l = strlen(url);
+ }
+
+
+ u->path = strdupdelim (url + i, url + l);