--------------------- PatchSet 2724 Date: 2001/08/07 20:06:58 Author: adri Branch: newhttp Tag: (none) Log: write a skeleton new_http_client_read(). It doesn't seem to be called just yet. I'll have to figure this one out. Members: src/modules/new_http_client/client_side.c:1.1.2.5->1.1.2.6 Index: squid/src/modules/new_http_client/client_side.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/modules/new_http_client/Attic/client_side.c,v retrieving revision 1.1.2.5 retrieving revision 1.1.2.6 diff -u -r1.1.2.5 -r1.1.2.6 --- squid/src/modules/new_http_client/client_side.c 7 Aug 2001 19:57:46 -0000 1.1.2.5 +++ squid/src/modules/new_http_client/client_side.c 7 Aug 2001 20:06:58 -0000 1.1.2.6 @@ -14,6 +14,7 @@ static PF new_http_client_accept; static PF new_http_client_conn_free; static PF new_http_client_conn_timeout; +static PF new_http_client_read; void @@ -161,10 +162,43 @@ commSetTimeout(fd, Config.Timeout.request, new_http_client_conn_timeout, conn); /* Initiate the read */ + commSetSelect(fd, COMM_SELECT_READ, new_http_client_read, conn, 0); +} + + +/* + * http_client_read - read some data from a client + */ +static void +new_http_client_read(int fd, void *data) +{ + int retval; + http_client_conn_state_t *conn = data; + /* Attempt a read */ + retval = stmemRead(fd, conn->st); + + debug(1, 1) ("http_client_read: FD %d, returned %d\n", fd, retval); + /* If we got an EOF, close */ + if (retval == 0) { + comm_close(fd); + return; + } + + /* If we got an error - ignore errors, close on others */ + if (retval < 0) { + if (!ignoreErrno(errno)) { + comm_close(fd); + return; + } + } + + /* Finished - read some more data */ + commSetSelect(fd, COMM_SELECT_READ, new_http_client_read, conn, 0); } + /* * handle a connection that has timed out */