httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William A. Rowe, Jr." <wr...@rowe-clan.net>
Subject proxy/Apache-1.3 ap_proxy_connect_handler()
Date Sun, 20 Jan 2002 21:30:20 GMT
Proxy Folk,

  who last hacked this bit?  I suspect we have to cover the same bug as
was fixed in buff.c.  recv/send can produce some very cryptic results, 
this is buff.c's workaround (recv, there is a similar patch for send);

    rv = recv(sock, buf, len, flags);
    if (rv == SOCKET_ERROR) {
        err = WSAGetLastError();
        if (err == WSAEWOULDBLOCK) {
            do {
                retry = 0;
                FD_ZERO(&fdset);
                FD_SET(sock, &fdset);
                tv.tv_usec = 0;
                rv = select(FD_SETSIZE, &fdset, NULL, NULL, &tv);
                if (rv == SOCKET_ERROR)
                    err = WSAGetLastError();
                else if (rv == 0) {
                    ioctlsocket(sock, FIONBIO, (u_long*)&iostate);
                    ap_check_alarm();
                    WSASetLastError(WSAEWOULDBLOCK);
                    return (SOCKET_ERROR);
                }
                else {
                    rv = recv(sock, buf, len, flags);
                    if (rv == SOCKET_ERROR) {
                        err = WSAGetLastError();
                        if (err == WSAEWOULDBLOCK) {
                            ap_log_error(APLOG_MARK, APLOG_DEBUG, NULL,
                                         "select claimed we could read, but in fact we couldn't.");
                            retry = 1;
#ifdef NETWARE
                            ThreadSwitchWithDelay();
#else
                            Sleep(100);
#endif
                        }
                    }
                }
            } while (retry);
        }
    }


Anyone care to tackle before we throw this upon the world as 1.3.23?

Bill


Mime
View raw message