--------------------- PatchSet 5262 Date: 2002/10/06 12:03:03 Author: rbcollins Branch: commloops Tag: (none) Log: tidyup some code Members: src/client_side.c:1.52.4.14->1.52.4.15 Index: squid/src/client_side.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/client_side.c,v retrieving revision 1.52.4.14 retrieving revision 1.52.4.15 diff -u -r1.52.4.14 -r1.52.4.15 --- squid/src/client_side.c 6 Oct 2002 11:42:20 -0000 1.52.4.14 +++ squid/src/client_side.c 6 Oct 2002 12:03:03 -0000 1.52.4.15 @@ -1,6 +1,6 @@ /* - * $Id: client_side.c,v 1.52.4.14 2002/10/06 11:42:20 rbcollins Exp $ + * $Id: client_side.c,v 1.52.4.15 2002/10/06 12:03:03 rbcollins Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -1463,32 +1463,38 @@ * whole, not individual read() calls. Plus, it breaks our * lame half-close detection */ - if (flag == COMM_OK && size > 0) { - kb_incr(&statCounter.client_http.kbytes_in, size); - conn->in.notYetUsed += size; - conn->in.buf[conn->in.notYetUsed] = '\0'; /* Terminate the string */ - } else if (flag == COMM_OK && size == 0) { - if (connFinishedWithConn(conn, size)) { - comm_close(fd); - return; - } - /* It might be half-closed, we can't tell */ - debug(33, 5) ("clientReadRequest: FD %d closed?\n", fd); - fd_table[fd].flags.socket_eof = 1; - connSetDefer (conn, 1); - fd_note(fd, "half-closed"); - /* There is one more close check at the end, to detect aborted - * (partial) requests. At this point we can't tell if the request - * is partial. - */ - /* Continue to process previously read data */ - } else if (connReadWasError(conn, flag, size)) { + if (connReadWasError(conn, flag, size)) { comm_close(fd); return; } + + if (flag == COMM_OK) { + if (size > 0) { + kb_incr(&statCounter.client_http.kbytes_in, size); + conn->in.notYetUsed += size; + conn->in.buf[conn->in.notYetUsed] = '\0'; /* Terminate the string */ + } else if (size == 0) { + debug(33, 5) ("clientReadRequest: FD %d closed?\n", fd); + if (connFinishedWithConn(conn, size)) { + comm_close(fd); + return; + } + /* It might be half-closed, we can't tell */ + fd_table[fd].flags.socket_eof = 1; + connSetDefer (conn, 1); + fd_note(fd, "half-closed"); + /* There is one more close check at the end, to detect aborted + * (partial) requests. At this point we can't tell if the request + * is partial. + */ + /* Continue to process previously read data */ + } + } + /* Process request body if any */ if (conn->in.notYetUsed > 0 && conn->body.callback != NULL) clientProcessBody(conn); + /* Process next request */ if (connGetConcurrentRequestCount(conn) == 0) fd_note(conn->fd, "Reading next request"); @@ -1508,7 +1514,8 @@ return; } /* Should not be needed anymore */ - conn->in.buf[conn->in.notYetUsed] = '\0'; /* Terminate the string */ + /* Terminate the string */ + conn->in.buf[conn->in.notYetUsed] = '\0'; /* Process request */ context = parseHttpRequest(conn, &method, &prefix, &req_line_sz);