r15346@tombo: nickm | 2008-04-29 17:19:18 -0400
authorNick Mathewson <nickm@torproject.org>
Tue, 29 Apr 2008 21:19:26 +0000 (21:19 +0000)
committerNick Mathewson <nickm@torproject.org>
Tue, 29 Apr 2008 21:19:26 +0000 (21:19 +0000)
 Remove the never-exported, never-used, never-threadsafe evhttp_hostportfile()

svn:r746

ChangeLog
evhttp.h
http.c
test/regress_http.c

index 384a278641858a5d6504b2f1fbe06655ba972ef2..43925821daeccb5ca18a934eb7b19c25d4a976c5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -78,7 +78,7 @@ Changes in current version:
  o introduce bufferevent_setcb and bufferevent_setfd to allow better manipulation of bufferevents
  o convert evhttp_connection to use bufferevents.
  o use libevent's internal timercmp on all platforms, to avoid bugs on old platforms where timercmp(a,b,<=) is buggy.
-
+ o Remove the never-exported, never-used evhttp_hostportfile function.
        
 Changes in 1.4.0:
  o allow \r or \n individually to separate HTTP headers instead of the standard "\r\n"; from Charles Kerr.
index 3b88111017312d43ed3a9b8e0807be7e76f041a9..54c504b5d5e73d6b82b1802f2c38805fe56a7d6e 100644 (file)
--- a/evhttp.h
+++ b/evhttp.h
@@ -362,18 +362,6 @@ void evhttp_parse_query(const char *uri, struct evkeyvalq *);
  */
 char *evhttp_htmlescape(const char *html);
 
-/**
- * Separate the host, port and path component from a URL.
- * XXXX This interface will change before release to become threadsafe.
- *
- * @param url the url for which to separate the components
- * @param phost pointer in which to store the pointer to the host
- * @param pport pointer in which to store the port number
- * @param pfile pointer in which to store the pointer to the path
- * @return 0 on success and -1 on failure
- */
-int evhttp_hostportfile(const char *url, char **phost, u_short *pport, char **pfile);
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/http.c b/http.c
index a29bf036e825e6007fefc899921c67b14c5176d6..e78954b68d699693b2b773f20f6dea45ab6d7834 100644 (file)
--- a/http.c
+++ b/http.c
@@ -466,63 +466,6 @@ evhttp_make_header(struct evhttp_connection *evcon, struct evhttp_request *req)
        }
 }
 
-/* Separate host, port and file from URI */
-
-int
-evhttp_hostportfile(const char *url, char **phost, u_short *pport, char **pfile)
-{
-       /* XXX not threadsafe. */
-       static char host[1024];
-       static char file[1024];
-       char *p;
-       const char *p2;
-       int len;
-       u_short port;
-
-       len = strlen(HTTP_PREFIX);
-       if (strncasecmp(url, HTTP_PREFIX, len))
-               return (-1);
-
-       url += len;
-
-       /* We might overrun */
-       if (strlcpy(host, url, sizeof (host)) >= sizeof(host))
-               return (-1);
-
-       p = strchr(host, '/');
-       if (p != NULL) {
-               *p = '\0';
-               p2 = p + 1;
-       } else
-               p2 = NULL;
-
-       if (pfile != NULL) {
-               /* Generate request file */
-               if (p2 == NULL)
-                       p2 = "";
-               snprintf(file, sizeof(file), "/%s", p2);
-       }
-
-       p = strchr(host, ':');
-       if (p != NULL) {
-               *p = '\0';
-               port = atoi(p + 1);
-
-               if (port == 0)
-                       return (-1);
-       } else
-               port = HTTP_DEFAULTPORT;
-
-       if (phost != NULL)
-               *phost = host;
-       if (pport != NULL)
-               *pport = port;
-       if (pfile != NULL)
-               *pfile = file;
-
-       return (0);
-}
-
 static int
 evhttp_connection_incoming_fail(struct evhttp_request *req,
     enum evhttp_connection_error error)
index c6a1d140476cceaa10e44b1870fdab9fc7b7ac69..8b3ba674ac783e706c5f83f22c5b1361f0dce5ab 100644 (file)
@@ -1632,8 +1632,6 @@ static void
 http_primitives(void)
 {
        char *escaped;
-       char *host = NULL, *path = NULL;
-       unsigned short port = 0;
        fprintf(stdout, "Testing HTTP Primitives: ");
 
        escaped = evhttp_htmlescape("<script>");
@@ -1646,24 +1644,6 @@ http_primitives(void)
                goto failed;
        free(escaped);
 
-       if (evhttp_hostportfile("fto://some", NULL, NULL, NULL) != -1)
-               goto failed;
-
-       if (evhttp_hostportfile("http://www.foo.com/path.html",
-               &host, &port, &path) == -1)
-               goto failed;
-
-       if (strcmp(host, "www.foo.com") || port != 80 ||
-           strcmp(path, "/path.html"))
-               goto failed;
-
-       if (evhttp_hostportfile("http://foo.com:8080",
-               &host, &port, &path) == -1)
-               goto failed;
-
-       if (strcmp(host, "foo.com") || port != 8080 || strcmp(path, "/"))
-               goto failed;
-
        fprintf(stdout, "OK\n");
 
        return;