To support
httping http://google.com
httping https://google.com
httping google.com
--- main.c.orig 2009-08-01 22:28:44.000000000 +0200
+++ main.c 2009-08-01 22:49:02.000000000 +0200
@@ -325,13 +325,11 @@
return 1;
}
}
+ if (optind < argc)
+ get = argv[optind];
- last_error[0] = 0x00;
-#ifndef NO_SSL
- if (use_ssl && portnr == 80)
- portnr = 443;
-#endif
+ last_error[0] = 0x00;
if (!get_instead_of_head && show_Bps)
error_exit("-b/-B can only be used when also using -G\n");
@@ -340,17 +338,18 @@
{
char *slash, *colon;
char *getcopy = mystrdup(get, "get request");
- char *http_string = "http://";
- int http_string_len = 7;
-#ifndef NO_SSL
- if (use_ssl)
+ if (strncasecmp(getcopy, "http://", 7) == 0)
{
- http_string_len = 8;
- http_string = "https://";
+ getcopy += 7;
+ }
+ else if (strncasecmp(getcopy, "https://", 8) == 0)
+ {
+ getcopy += 8;
+ use_ssl = 1;
}
-#endif
+ /*
if (strncasecmp(getcopy, http_string, http_string_len) != 0)
{
fprintf(stderr, "'%s' is a strange URL\n", getcopy);
@@ -359,19 +358,20 @@
fprintf(stderr, "Did you forget to add
the '-l' switch to the httping commandline?\n");
return 2;
}
+ */
- slash = strchr(&getcopy[http_string_len], '/');
+ slash = strchr(getcopy, '/');
if (slash)
*slash = 0x00;
- colon = strchr(&getcopy[http_string_len], ':');
+ colon = strchr(getcopy, ':');
if (colon)
{
*colon = 0x00;
portnr = atoi(colon + 1);
}
- hostname = &getcopy[http_string_len];
+ hostname = getcopy;
}
if (hostname == NULL)
@@ -380,6 +380,11 @@
error_exit("No hostname/getrequest given\n");
}
+#ifndef NO_SSL
+ if (use_ssl && portnr == 80)
+ portnr = 443;
+#endif
+
if (get == NULL)
{
#ifndef NO_SSL
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]