]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
gindent and formatting
authorwessels <>
Thu, 30 Oct 1997 10:31:17 +0000 (10:31 +0000)
committerwessels <>
Thu, 30 Oct 1997 10:31:17 +0000 (10:31 +0000)
13 files changed:
include/splay.h
lib/snprintf.c
lib/splay.c
src/client.cc
src/client_side.cc
src/errorpage.cc
src/ftp.cc
src/http.cc
src/pconn.cc
src/protos.h
src/ssl.cc
src/tunnel.cc
src/wais.cc

index d2ae8d58e887ab98215a07e6352df540bcefa55d..f1d22fa2d13c72ca5db1b7fdb49132971c8df90a 100644 (file)
@@ -5,10 +5,10 @@ typedef struct _splay_node {
     struct _splay_node *right;
 } splayNode;
 
-typedef int (*SPCMP)(const void *, splayNode *);
+typedef int SPCMP (const void *, splayNode *);
 
 extern int splayLastResult;
 
-splayNode *splay_insert(void *, splayNode *, SPCMP);
-splayNode *splay_splay(const void *, splayNode *, SPCMP);
+splayNode *splay_insert(void *, splayNode *, SPCMP *);
+splayNode *splay_splay(const void *, splayNode *, SPCMP);
 void splay_destroy(splayNode *, void (*)(void *));
index 48d8953ecb23d17e87cbd417e634a0321d3340e0..75bbbd1629e52619ed54b5b6f60a45f0b16bbc21 100644 (file)
@@ -512,7 +512,7 @@ conv_p2(register u_wide_int num, register int nbits,
 /*
  * Do format conversion placing the output in buffer
  */
-static int 
+static int
 format_converter(register buffy * odp, const char *fmt,
     va_list ap)
 {
@@ -879,7 +879,7 @@ format_converter(register buffy * odp, const char *fmt,
 /*
  * This is the general purpose conversion function.
  */
-static void 
+static void
 strx_printv(int *ccp, char *buf, size_t len, const char *format,
     va_list ap)
 {
@@ -906,7 +906,7 @@ strx_printv(int *ccp, char *buf, size_t len, const char *format,
 #endif
 
 #if !HAVE_SNPRINTF
-int 
+int
 snprintf(char *buf, size_t len, const char *format,...)
 {
     int cc;
@@ -919,7 +919,7 @@ snprintf(char *buf, size_t len, const char *format,...)
 #endif
 
 #if !HAVE_VSNPRINTF
-int 
+int
 vsnprintf(char *buf, size_t len, const char *format,
     va_list ap)
 {
index 400925010d0a99a6cec64c7a8cd1ae33fd153285..72b439950a3f9ef915fe5ea314c0e6952969797a 100644 (file)
@@ -17,7 +17,7 @@
 int splayLastResult = 0;
 
 splayNode *
-splay_insert(void *data, splayNode * top, SPCMP compare)
+splay_insert(void *data, splayNode * top, SPCMP *compare)
 {
     splayNode *new = xcalloc(sizeof(splayNode), 1);
     new->data = data;
@@ -44,7 +44,7 @@ splay_insert(void *data, splayNode * top, SPCMP compare)
 }
 
 splayNode *
-splay_splay(const void *data, splayNode * top, SPCMP compare)
+splay_splay(const void *data, splayNode * top, SPCMP *compare)
 {
     splayNode N;
     splayNode *l;
index d5d98d7dfc7bbef79f6f729933b18e274490373c..0d3f09fde530bc6ec84cef22a87d17ef6094f820 100644 (file)
@@ -1,7 +1,8 @@
 
 
+
 /*
- * $Id: client.cc,v 1.38 1997/10/30 00:51:03 wessels Exp $
+ * $Id: client.cc,v 1.39 1997/10/30 03:31:19 wessels Exp $
  *
  * DEBUG: section 0     WWW Client
  * AUTHOR: Harvest Derived
index c9f142660eb882204292f39dee3cce97a15a9fdc..ebefcb099b1c9e8adbf575dd8f767271b62dc9f9 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: client_side.cc,v 1.136 1997/10/30 02:40:57 wessels Exp $
+ * $Id: client_side.cc,v 1.137 1997/10/30 03:31:19 wessels Exp $
  *
  * DEBUG: section 33    Client-side Routines
  * AUTHOR: Duane Wessels
@@ -100,7 +100,6 @@ clientAccessCheckDone(int answer, void *data)
            err->src_addr = http->conn->peer.sin_addr;
            err->redirect_url = xstrdup(redirectUrl);
            errorSend(fd, err);
-
        } else {
            /* NOTE: don't use HTTP_UNAUTHORIZED because then the
             * stupid browser wants us to authenticate */
index e0135532f1446d7bc11696942e94f4d61907d4ee..3df4a9ef02e26875c0e5e9f0ed456fb1797a538c 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: errorpage.cc,v 1.95 1997/10/30 02:40:58 wessels Exp $
+ * $Id: errorpage.cc,v 1.96 1997/10/30 03:31:20 wessels Exp $
  *
  * DEBUG: section 4     Error Generation
  * AUTHOR: Duane Wessels
  */
 
 /*
- * Abstract:   These routines are used to generate error messages to be
- *             sent to clients.  The error type is used to select between
- *             the various message formats. (formats are stored in the
- *             Config.errorDirectory)
+ * Abstract:  These routines are used to generate error messages to be
+ *              sent to clients.  The error type is used to select between
+ *              the various message formats. (formats are stored in the
+ *              Config.errorDirectory)
  */
 
 #include "squid.h"
@@ -123,9 +123,10 @@ errorCon(err_type type, http_status status)
  * Arguments: err - This object is destroyed after use in this function.
  *
  * Abstract:  This function generates a error page from the info contained
- *            by 'err' and then attaches it to the specified 'entry'
- *
- * Note:      The above abstract is should be check for correctness!!!!
+ *            by 'err' and then stores the text in the specified store
+ *            entry.  This function should only be called by ``server
+ *            side routines'' which need to communicate errors to the
+ *            client side.  The client side should call errorSend().
  */
 void
 errorAppendEntry(StoreEntry * entry, ErrorState * err)
@@ -134,6 +135,9 @@ errorAppendEntry(StoreEntry * entry, ErrorState * err)
     MemObject *mem = entry->mem_obj;
     int len;
     assert(entry->store_status == STORE_PENDING);
+#if WE_SHOULD_PROBABLY_REQUIRE_THIS
+    assert(mem->inmem_hi == 0);
+#endif
     buf = errorBuildBuf(err, &len);
     storeAppend(entry, buf, len);
     if (mem)
@@ -149,11 +153,11 @@ errorAppendEntry(StoreEntry * entry, ErrorState * err)
  *
  * Abstract:  This function generates a error page from the info contained
  *            by 'err' and then sends it to the client.
- *
- * Note:      The callback function errorSendComplete() cleans up 'err'
- *
- * Note:      I don't think we need to add 'err' to the callback table
- *            since the only path ends up a errorSendComplete().
+ *            The callback function errorSendComplete() is called after
+ *            the page has been written to the client socket (fd).
+ *            errorSendComplete() deallocates 'err'.  We need to add
+ *            'err' to the cbdata because comm_write() requires it
+ *            for all callback data pointers.
  */
 void
 errorSend(int fd, ErrorState * err)
@@ -170,7 +174,8 @@ errorSend(int fd, ErrorState * err)
 /*
  * Function:  errorSendComplete
  *
- * Abstract:  This function 
+ * Abstract:  Called by commHandleWrite() after data has been written
+ *            to the client socket.
  *
  * Note:      If there is a callback, the callback is responsible for
  *            closeing the FD, otherwise we do it ourseves.
index f188af1f0521dcc722ad264c217eb099bf581e67..623308a97331825a938bee633a96ae61fdea4012 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ftp.cc,v 1.159 1997/10/30 02:49:00 wessels Exp $
+ * $Id: ftp.cc,v 1.160 1997/10/30 03:31:21 wessels Exp $
  *
  * DEBUG: section 9     File Transfer Protocol (FTP)
  * AUTHOR: Harvest Derived
@@ -662,7 +662,6 @@ ftpReadData(int fd, void *data)
        err->xerrno = errno;
        err->request = requestLink(ftpState->request);
        errorAppendEntry(entry, err);
-
        storeAbort(entry, 0);
        ftpDataTransferDone(ftpState);
     } else if (len == 0) {
@@ -795,7 +794,6 @@ ftpCleanupUrlpath(FtpStateData * ftpState)
     } while (again);
 }
 
-
 static void
 ftpBuildTitleUrl(FtpStateData * ftpState)
 {
@@ -821,7 +819,6 @@ ftpBuildTitleUrl(FtpStateData * ftpState)
        strcat(t, request->urlpath);
 }
 
-
 void
 ftpStart(request_t * request, StoreEntry * entry)
 {
@@ -868,12 +865,10 @@ ftpStart(request_t * request, StoreEntry * entry)
        url);
     if (fd == COMM_ERROR) {
        debug(9, 4) ("ftpStart: Failed to open a socket.\n");
-
        err = errorCon(ERR_SOCKET_FAILURE, HTTP_INTERNAL_SERVER_ERROR);
        err->xerrno = errno;
        err->request = requestLink(ftpState->request);
        errorAppendEntry(entry, err);
-
        storeAbort(entry, 0);
        return;
     }
@@ -897,23 +892,19 @@ ftpConnectDone(int fd, int status, void *data)
     debug(9, 3) ("ftpConnectDone, status = %d\n", status);
     if (status == COMM_ERR_DNS) {
        debug(9, 4) ("ftpConnectDone: Unknown host: %s\n", request->host);
-
        err = errorCon(ERR_DNS_FAIL, HTTP_SERVICE_UNAVAILABLE);
        err->dnsserver_msg = xstrdup(dns_error_message);
        err->request = requestLink(request);
        errorAppendEntry(ftpState->entry, err);
-
        storeAbort(ftpState->entry, 0);
        comm_close(fd);
     } else if (status != COMM_OK) {
-
        err = errorCon(ERR_CONNECT_FAIL, HTTP_SERVICE_UNAVAILABLE);
        err->xerrno = errno;
        err->host = xstrdup(request->host);
        err->port = request->port;
        err->request = requestLink(request);
        errorAppendEntry(ftpState->entry, err);
-
        storeAbort(ftpState->entry, 0);
        comm_close(fd);
     } else {
@@ -931,7 +922,6 @@ ftpConnectDone(int fd, int status, void *data)
 
 /* ====================================================================== */
 
-
 static void
 ftpWriteCommand(const char *buf, FtpStateData * ftpState)
 {
@@ -1357,7 +1347,6 @@ ftpPasvCallback(int fd, int status, void *data)
        err->port = ftpState->data.port;
        err->request = requestLink(request);
        errorAppendEntry(ftpState->entry, err);
-
        storeAbort(ftpState->entry, 0);
        comm_close(fd);
        return;
@@ -1584,7 +1573,6 @@ const char *ftpAuthText =
 "<P>from this cache.  Please check with the\n"
 "<A HREF=\"mailto:%s\">cache administrator</A>\n"
 "if you believe this is incorrect.\n"
-
 "<P>\n"
 "%s\n"
 "<HR>\n"
@@ -1593,7 +1581,6 @@ const char *ftpAuthText =
 "</ADDRESS></BODY></HTML>\n"
 "\n";
 
-
 static char *
 ftpAuthRequired(const request_t * request, const char *realm)
 {
index 0a18403bac07e46d3f41c187ced1605e96b12e13..787b77bc0fb58df82a06d47ace942bd5c760fd03 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: http.cc,v 1.207 1997/10/30 02:41:02 wessels Exp $
+ * $Id: http.cc,v 1.208 1997/10/30 03:31:22 wessels Exp $
  *
  * DEBUG: section 11    Hypertext Transfer Protocol (HTTP)
  * AUTHOR: Harvest Derived
@@ -632,12 +632,10 @@ httpReadReply(int fd, void *data)
            httpRestart(httpState);
        } else {
            httpState->eof = 1;
-
            err = errorCon(ERR_ZERO_SIZE_OBJECT, HTTP_SERVICE_UNAVAILABLE);
            err->xerrno = errno;
            err->request = requestLink(httpState->request);
            errorAppendEntry(entry, err);
-
            storeAbort(entry, 0);
            comm_close(fd);
        }
@@ -685,7 +683,6 @@ httpSendComplete(int fd, char *buf, int size, int errflag, void *data)
        err->xerrno = errno;
        err->request = requestLink(httpState->request);
        errorAppendEntry(entry, err);
-
        storeAbort(entry, 0);
        comm_close(fd);
        return;
@@ -930,13 +927,11 @@ httpSocketOpen(StoreEntry * entry, request_t * request)
        entry->url);
     if (fd < 0) {
        debug(11, 4) ("httpSocketOpen: Failed because we're out of sockets.\n");
-
        err = errorCon(ERR_SOCKET_FAILURE, HTTP_INTERNAL_SERVER_ERROR);
        err->xerrno = errno;
        if (request)
            err->request = requestLink(request);
        errorAppendEntry(entry, err);
-
        storeAbort(entry, 0);
     }
     return fd;
@@ -1050,23 +1045,19 @@ httpConnectDone(int fd, int status, void *data)
     ErrorState *err;
     if (status == COMM_ERR_DNS) {
        debug(11, 4) ("httpConnectDone: Unknown host: %s\n", request->host);
-
        err = errorCon(ERR_DNS_FAIL, HTTP_SERVICE_UNAVAILABLE);
        err->dnsserver_msg = xstrdup(dns_error_message);
        err->request = requestLink(request);
        errorAppendEntry(entry, err);
-
        storeAbort(entry, 0);
        comm_close(fd);
     } else if (status != COMM_OK) {
-
        err = errorCon(ERR_CONNECT_FAIL, HTTP_SERVICE_UNAVAILABLE);
        err->xerrno = errno;
        err->host = xstrdup(request->host);
        err->port = request->port;
        err->request = requestLink(request);
        errorAppendEntry(entry, err);
-
        storeAbort(entry, 0);
        if (httpState->neighbor)
            peerCheckConnectStart(httpState->neighbor);
index 4e1a5de55d5e7dec8be42d63451fa78ffc83dee6..ef42627c20fcf1e248cddb913886df72f7324e96 100644 (file)
@@ -1,5 +1,6 @@
+
 /*
- * $Id: pconn.cc,v 1.8 1997/10/30 02:41:06 wessels Exp $
+ * $Id: pconn.cc,v 1.9 1997/10/30 03:31:24 wessels Exp $
  *
  * DEBUG: section 48    Persistent Connections
  * AUTHOR: Duane Wessels
@@ -130,7 +131,7 @@ void
 pconnPush(int fd, const char *host, u_short port)
 {
     struct _pconn *p;
-    LOCAL_ARRAY(char, key, SQUIDHOSTNAMELEN + 10); /* MO why static array? */
+    LOCAL_ARRAY(char, key, SQUIDHOSTNAMELEN + 10);
     assert(table != NULL);
     strcpy(key, pconnKey(host, port));
     p = (struct _pconn *) hash_lookup(table, key);
@@ -155,7 +156,7 @@ pconnPop(const char *host, u_short port)
     struct _pconn *p;
     hash_link *hptr;
     int fd = -1;
-    LOCAL_ARRAY(char, key, SQUIDHOSTNAMELEN + 10); /* MO why static array? */
+    LOCAL_ARRAY(char, key, SQUIDHOSTNAMELEN + 10);
     assert(table != NULL);
     strcpy(key, pconnKey(host, port));
     hptr = hash_lookup(table, key);
index 94933c6bbfd30e6dfe4f690004c5b8c6deb90b0b..96bbf7458aca3d936de14cb51038c69d370d9f87 100644 (file)
@@ -561,4 +561,3 @@ extern void dump_peers(StoreEntry *, peer *);
 extern void pconnPush(int, const char *host, u_short port);
 extern int pconnPop(const char *host, u_short port);
 extern void pconnInit(void);
-
index 522cecd4d23a7d906aefcd6f638bd785d598c8ee..ee9046f21619cac25d56705183494ad2127e5a3f 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ssl.cc,v 1.66 1997/10/30 02:41:08 wessels Exp $
+ * $Id: ssl.cc,v 1.67 1997/10/30 03:31:26 wessels Exp $
  *
  * DEBUG: section 26    Secure Sockets Layer Proxy
  * AUTHOR: Duane Wessels
@@ -321,14 +321,12 @@ sslConnectDone(int fd, int status, void *data)
     ErrorState *err = NULL;
     if (status == COMM_ERR_DNS) {
        debug(26, 4) ("sslConnect: Unknown host: %s\n", sslState->host);
-
        err = errorCon(ERR_DNS_FAIL, HTTP_NOT_FOUND);
        err->request = requestLink(request);
        err->dnsserver_msg = xstrdup(dns_error_message);
        err->callback = sslErrorComplete;
        err->callback_data = sslState;
        errorSend(sslState->client.fd, err);
-
     } else if (status != COMM_OK) {
        err = errorCon(ERR_CONNECT_FAIL, HTTP_SERVICE_UNAVAILABLE);
        err->xerrno = errno;
@@ -338,11 +336,10 @@ sslConnectDone(int fd, int status, void *data)
        err->callback = sslErrorComplete;
        err->callback_data = sslState;
        errorSend(sslState->client.fd, err);
-
     } else {
        if (sslState->proxying)
            sslProxyConnected(sslState->server.fd, sslState);
-        else
+       else
            sslConnected(sslState->server.fd, sslState);
     }
 }
@@ -365,7 +362,6 @@ sslStart(int fd, const char *url, request_t * request, size_t * size_ptr)
        url);
     if (sock == COMM_ERROR) {
        debug(26, 4) ("sslStart: Failed because we're out of sockets.\n");
-
        err = errorCon(ERR_SOCKET_FAILURE, HTTP_INTERNAL_SERVER_ERROR);
        err->xerrno = errno;
        err->request = requestLink(request);
@@ -455,7 +451,6 @@ sslPeerSelectFail(peer * p, void *data)
 {
     SslStateData *sslState = data;
     ErrorState *err;
-
     err = errorCon(ERR_CANNOT_FORWARD, HTTP_SERVICE_UNAVAILABLE);
     err->request = requestLink(sslState->request);
     err->callback = sslErrorComplete;
index c2d667a84afbbfa29086aafc613bca8b9f545783..1a796c578ef49c30623a717ee87a6988745710dc 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: tunnel.cc,v 1.66 1997/10/30 02:41:08 wessels Exp $
+ * $Id: tunnel.cc,v 1.67 1997/10/30 03:31:26 wessels Exp $
  *
  * DEBUG: section 26    Secure Sockets Layer Proxy
  * AUTHOR: Duane Wessels
@@ -321,14 +321,12 @@ sslConnectDone(int fd, int status, void *data)
     ErrorState *err = NULL;
     if (status == COMM_ERR_DNS) {
        debug(26, 4) ("sslConnect: Unknown host: %s\n", sslState->host);
-
        err = errorCon(ERR_DNS_FAIL, HTTP_NOT_FOUND);
        err->request = requestLink(request);
        err->dnsserver_msg = xstrdup(dns_error_message);
        err->callback = sslErrorComplete;
        err->callback_data = sslState;
        errorSend(sslState->client.fd, err);
-
     } else if (status != COMM_OK) {
        err = errorCon(ERR_CONNECT_FAIL, HTTP_SERVICE_UNAVAILABLE);
        err->xerrno = errno;
@@ -338,11 +336,10 @@ sslConnectDone(int fd, int status, void *data)
        err->callback = sslErrorComplete;
        err->callback_data = sslState;
        errorSend(sslState->client.fd, err);
-
     } else {
        if (sslState->proxying)
            sslProxyConnected(sslState->server.fd, sslState);
-        else
+       else
            sslConnected(sslState->server.fd, sslState);
     }
 }
@@ -365,7 +362,6 @@ sslStart(int fd, const char *url, request_t * request, size_t * size_ptr)
        url);
     if (sock == COMM_ERROR) {
        debug(26, 4) ("sslStart: Failed because we're out of sockets.\n");
-
        err = errorCon(ERR_SOCKET_FAILURE, HTTP_INTERNAL_SERVER_ERROR);
        err->xerrno = errno;
        err->request = requestLink(request);
@@ -455,7 +451,6 @@ sslPeerSelectFail(peer * p, void *data)
 {
     SslStateData *sslState = data;
     ErrorState *err;
-
     err = errorCon(ERR_CANNOT_FORWARD, HTTP_SERVICE_UNAVAILABLE);
     err->request = requestLink(sslState->request);
     err->callback = sslErrorComplete;
index 0b9cd903b6e355baf46865a58bdb350a61059e4f..51351a9e067953b16ac27411d3975d5af8a27550 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: wais.cc,v 1.93 1997/10/30 02:41:09 wessels Exp $
+ * $Id: wais.cc,v 1.94 1997/10/30 03:31:26 wessels Exp $
  *
  * DEBUG: section 24    WAIS Relay
  * AUTHOR: Harvest Derived
@@ -150,8 +150,6 @@ waisTimeout(int fd, void *data)
     comm_close(fd);
 }
 
-
-
 /* This will be called when data is ready to be read from fd.  Read until
  * error or connection closed. */
 static void
@@ -166,11 +164,9 @@ waisReadReply(int fd, void *data)
     int bin;
     if (protoAbortFetch(entry)) {
        ErrorState *err;
-
        err = errorCon(ERR_CLIENT_ABORT, HTTP_INTERNAL_SERVER_ERROR);
        err->request = urlParse(METHOD_CONNECT, waisState->request);
        errorAppendEntry(entry, err);
-
        storeAbort(entry, 0);
        comm_close(fd);
        return;
@@ -203,7 +199,6 @@ waisReadReply(int fd, void *data)
            err->xerrno = errno;
            err->request = urlParse(METHOD_CONNECT, waisState->request);
            errorAppendEntry(entry, err);
-
            storeAbort(entry, 0);
            comm_close(fd);
        }
@@ -213,7 +208,6 @@ waisReadReply(int fd, void *data)
        err->xerrno = errno;
        err->request = urlParse(METHOD_CONNECT, waisState->request);
        errorAppendEntry(entry, err);
-
        storeAbort(entry, 0);
        comm_close(fd);
     } else if (len == 0) {
@@ -269,28 +263,19 @@ waisSendRequest(int fd, void *data)
     int len = strlen(waisState->request) + 4;
     char *buf = NULL;
     const char *Method = RequestMethodStr[waisState->method];
-
     debug(24, 5) ("waisSendRequest: FD %d\n", fd);
-
     if (Method)
        len += strlen(Method);
     if (waisState->request_hdr)
        len += strlen(waisState->request_hdr);
-
     buf = xcalloc(1, len + 1);
-
     if (waisState->request_hdr)
        snprintf(buf, len + 1, "%s %s %s\r\n", Method, waisState->request,
            waisState->request_hdr);
     else
        snprintf(buf, len + 1, "%s %s\r\n", Method, waisState->request);
     debug(24, 6) ("waisSendRequest: buf: %s\n", buf);
-    comm_write(fd,
-       buf,
-       len,
-       waisSendComplete,
-       (void *) waisState,
-       xfree);
+    comm_write(fd, buf, len, waisSendComplete, waisState, xfree);
     if (BIT_TEST(waisState->entry->flag, ENTRY_CACHABLE))
        storeSetPublicKey(waisState->entry);    /* Make it public */
 }