diff --git a/client/http_client.c b/client/http_client.c index ae73f71..433ca73 100644 --- a/client/http_client.c +++ b/client/http_client.c @@ -53,6 +53,10 @@ int main(int argc, char* argv[]) { * @param host_buffer A buffer large enough to hold the host of the dest */ void get_parts(const char *dest, char *path_buffer, char *host_buffer) { + // If the destination starts with PROTO_PREFIX, skip it + if (strstr(dest, PROTO_PREFIX) == dest) { + dest += strlen(PROTO_PREFIX); + } const char *slash_cursor; for (slash_cursor = dest; *slash_cursor != '\0' && *slash_cursor != '/'; slash_cursor++); diff --git a/client/http_client.h b/client/http_client.h index 94eacd1..5bcc5a9 100644 --- a/client/http_client.h +++ b/client/http_client.h @@ -4,6 +4,7 @@ #define RTT_FLAG "-p" #define USAGE_STRING "Usage: ./http_client [-p] server_url port_number\n" #define PORT_ERROR "Port must be a number in the range 1-65535" +#define PROTO_PREFIX "http://" void get_parts(const char *dest, char *path_buffer, char *host_buffer);