From: serassio <> Date: Sun, 28 May 2006 22:11:38 +0000 (+0000) Subject: Forward port of latest 2.6 changes X-Git-Tag: SQUID_3_0_PRE4~81 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=00f768c1043001a223b4975e5b1dd2ada154b685;p=thirdparty%2Fsquid.git Forward port of latest 2.6 changes --- diff --git a/tools/squidclient.cc b/tools/squidclient.cc index 03323a09de..690dbe79de 100644 --- a/tools/squidclient.cc +++ b/tools/squidclient.cc @@ -1,6 +1,6 @@ /* - * $Id: squidclient.cc,v 1.5 2006/05/28 16:04:59 serassio Exp $ + * $Id: squidclient.cc,v 1.6 2006/05/28 16:11:38 serassio Exp $ * * DEBUG: section 0 WWW Client * AUTHOR: Harvest Derived @@ -97,10 +97,8 @@ static int Now(struct timeval *); static SIGHDLR catchSignal; static SIGHDLR pipe_handler; static void set_our_signal(void); -#ifndef _SQUID_MSWIN_ static ssize_t myread(int fd, void *buf, size_t len); static ssize_t mywrite(int fd, void *buf, size_t len); -#endif static int put_fd; static char *put_file = NULL; @@ -474,15 +472,8 @@ main(int argc, char *argv[]) } /* Send the HTTP request */ -#ifdef _SQUID_MSWIN_ - bytesWritten = send(conn, (const void *) msg, strlen(msg), 0); - -#else - bytesWritten = mywrite(conn, msg, strlen(msg)); -#endif - if (bytesWritten < 0) { perror("client: ERROR: write"); exit(1); @@ -497,12 +488,11 @@ main(int argc, char *argv[]) #ifdef _SQUID_MSWIN_ while ((x = read(put_fd, buf, sizeof(buf))) > 0) { - x = write(conn, buf, x); #else while ((x = myread(put_fd, buf, sizeof(buf))) > 0) { - x = mywrite(conn, buf, x); #endif + x = mywrite(conn, buf, x); total_bytes += x; @@ -519,11 +509,9 @@ main(int argc, char *argv[]) #ifdef _SQUID_MSWIN_ setmode(1, O_BINARY); - while ((len = recv(conn, (void *) buf, sizeof(buf), 0)) > 0) { -#else +#endif while ((len = myread(conn, buf, sizeof(buf))) > 0) { -#endif fsize += len; if (to_stdout) @@ -684,17 +672,24 @@ set_our_signal(void) { } -#ifndef _SQUID_MSWIN_ static ssize_t myread(int fd, void *buf, size_t len) { +#ifndef _SQUID_MSWIN_ alarm(io_timeout); return read(fd, buf, len); +#else + + return recv(fd, buf, len, 0); +#endif } static ssize_t mywrite(int fd, void *buf, size_t len) { +#ifndef _SQUID_MSWIN_ alarm(io_timeout); return write(fd, buf, len); -} +#else + return send(fd, buf, len, 0); #endif +}