From: Amos Jeffries Date: Fri, 17 Jun 2011 13:26:58 +0000 (-0600) Subject: Fix squidclient -V option and allow non-HTTP protocols to be tested X-Git-Tag: SQUID_3_1_12_3~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5b410c0d003731ff1547f07937fb8c40c6135212;p=thirdparty%2Fsquid.git Fix squidclient -V option and allow non-HTTP protocols to be tested The "-" case is for old style HTTP (called 0.9) where there is no version string. The "-V 0.9" is for testing servers with broken version number tag "HTTP/0.9". Do not mix these up! This also adds the ability to send non-HTTP version tags for testing. ie "-V ICAP/1.0" or "-V ICY/1.0" --- diff --git a/tools/squidclient.cc b/tools/squidclient.cc index 77e9a83e6a..b298732e74 100644 --- a/tools/squidclient.cc +++ b/tools/squidclient.cc @@ -387,11 +387,14 @@ main(int argc, char *argv[]) } } - if (version[0] == '-' || !version[0] || version[0] == '0') { + if (version[0] == '-' || !version[0]) { /* HTTP/0.9, no headers, no version */ snprintf(msg, BUFSIZ, "%s %s\r\n", method, url); } else { - snprintf(msg, BUFSIZ, "%s %s HTTP/%s\r\n", method, url, version); + if (!xisdigit(version[0])) // not HTTP/n.n + snprintf(msg, BUFSIZ, "%s %s %s\r\n", method, url, version); + else + snprintf(msg, BUFSIZ, "%s %s HTTP/%s\r\n", method, url, version); if (host) { snprintf(buf, BUFSIZ, "Host: %s\r\n", host);