Support for disabling the proxy/cache (Bug #232324)

Initial
Stephane Bortzmeyer 24 years ago
parent 9c00bcccb9
commit 05b2f51705

@ -1,7 +1,8 @@
* New -a and -A options to control the proxy/cache (disable caching)
* Support for microsecond wait (uses usleep)
* New option (-p) to set socket priority (Linux only)
* New option (-P) to set IP Type of Service octet (Linux only)
* New option (-P) to set IP Type of Service octet
4.1.0 (2001-02-14)

@ -18,6 +18,9 @@
/* Define if you can safely include both <sys/time.h> and <time.h>. */
#undef TIME_WITH_SYS_TIME
/* Define if you have the getaddrinfo function. */
#undef HAVE_GETADDRINFO
/* Define if you have the gethostbyname function. */
#undef HAVE_GETHOSTBYNAME

2
SRC/configure vendored

@ -1922,7 +1922,7 @@ else
fi
done
for ac_func in usleep
for ac_func in usleep getaddrinfo
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:1929: checking for $ac_func" >&5

@ -21,6 +21,8 @@ echoping \- tests a remote host with TCP or UDP
.RI [-P tos]
.RI [-C]
.RI [-S]
.RI [-A]
.RI [-a]
.B hostname
[:port]
@ -74,6 +76,10 @@ servers will not understand a request for an absolute URL.
.IP -i\ url
Use the ICP protocol (instead of echo) for the given URL. The URL has to
be an absolute one. This is mostly for testing Squid Web proxy/caches.
.IP -A
Force the proxy (if you use one) to ignore the cache
.IP -a
Force the proxy (if you use one) to revalidate data with the original server
.IP -C
Use the SSL (cryptography) protocol. For HTTP tests only.
.IP -S

@ -101,6 +101,9 @@ main (argc, argv)
unsigned short smtp = 0;
unsigned short udp = 0;
unsigned short icp = 0;
unsigned short nocache = 0;
#ifdef ICP
icp_opcode opcode = ICP_OP_QUERY;
#endif
@ -140,7 +143,7 @@ main (argc, argv)
results[i].valid = 0;
}
progname = argv[0];
while ((ch = getopt (argc, argv, "vs:n:w:dch:i:rut:f:SCp:P:")) != EOF)
while ((ch = getopt (argc, argv, "vs:n:w:dch:i:rut:f:SCp:P:aA")) != EOF)
{
switch (ch)
{
@ -178,6 +181,12 @@ main (argc, argv)
http = 1;
url = optarg;
break;
case 'a':
nocache = 1;
break;
case 'A':
nocache = 2;
break;
case 'f':
fill = *optarg;
fill_requested = 1;
@ -478,14 +487,17 @@ main (argc, argv)
#ifdef HTTP
if (http)
{
sendline = make_http_sendline (url, server, (int) ntohs (port));
sendline =
make_http_sendline (url, server, (int) ntohs (port), nocache);
}
else
#endif
#ifdef SMTP
if (smtp)
{
sendline = "QUIT\r\n";
sendline = "QUIT\r\n"; /* Surprises some SMTP servers which log
a frightening NOQUEUE. Anyone knows
better? */
}
else
#endif

@ -112,6 +112,11 @@ struct timeval max_timeval;
#define DEFAULT_HTTPS_TCP_PORT "HTTPS"
#define DEFAULT_ICP_UDP_PORT "ICP"
#ifdef HTTP
/* Use the old HTTP 1.0 protocol? If yes, set HTTP10 to 1*/
#undef HTTP10
#endif
#define USE_ECHO 1
#define USE_DISCARD 2
#define USE_CHARGEN 3

@ -9,22 +9,41 @@
char big_recvline[MAXTOREAD];
char *
make_http_sendline (char *url, char *host, int port)
make_http_sendline (char *url, char *host, int port, int nocache)
{
short sport = (short) port;
int size = 200; /* Enough? */
char *sendline = (char *) malloc (size);
char *hostname = (char *) malloc (size);
char *cache_directive = "";
#ifdef HTTP10
sprintf (sendline, "GET %s HTTP/1.0\r\nUser-Agent: Echoping/%s\r\n\r\n",
url, VERSION);
if (nocache)
cache_directive = "Pragma: no-cache\r\n"; /* RFC 1945, "Hypertext
Transfer Protocol --
HTTP/1.0" */
sprintf (sendline,
"GET %s HTTP/1.0\r\nUser-Agent: Echoping/%s\r\n%s\r\n",
url, VERSION, cache_directive);
#else
if (nocache)
{
if (nocache == 1)
cache_directive = "Cache-control: max-age=0\r\n"; /* Simply force a
recheck with the
server */
else
cache_directive = "Cache-control: no-cache\r\n"; /* RFC 2616
"Hypertext
Transfer
Protocol --
HTTP/1.1" */
}
strcpy (hostname, HTParse (url, "", PARSE_HOST));
if (!strcmp (hostname, ""))
sprintf (hostname, "%s:%d", host, sport);
sprintf (sendline,
"GET %s HTTP/1.1\r\nUser-Agent: Echoping/%s\r\nHost: %s\r\nConnection: close\r\n\r\n",
url, VERSION, hostname);
"GET %s HTTP/1.1\r\nUser-Agent: Echoping/%s\r\nHost: %s\r\nConnection: close\r\n%s\r\n",
url, VERSION, hostname, cache_directive);
free (hostname);
#endif
return sendline;

Loading…
Cancel
Save