From: Amos Jeffries Date: Fri, 17 Jun 2011 02:31:45 +0000 (+1200) Subject: Fix squidclient -V option and allow non-HTTP protocols to be tested X-Git-Tag: take08~55^2~128 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8d55d7ef16402d9634e011df1cf3795bc2438a99;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 005bd95f7d..f2fd99877a 100644 --- a/tools/squidclient.cc +++ b/tools/squidclient.cc @@ -438,11 +438,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);