no reply from server

From: Yee Man Chan <ymc@dont-contact.us>
Date: Thu, 14 Oct 1999 02:17:47 -0400

Hi,

        I was trying to stall clientSendMoreData, so that I can process HTML after I
download the whole thing. I am messing with 2.2S5. I changed storeClientCopy2
to the following, so it won't return anything of an HTML doc until Squid
receives the whole thing. Mysteriously, it is fine for www.microsoft.com and
www.yahoo.com but when I request sports.yahoo.com, the client stalls. When I
look at gdb, I find that Squid never receives len == 0 in httpReadReply. Why
is that?

Thanks
Yee Man

static void
storeClientCopy2(StoreEntry * e, store_client * sc)
{
    STCB *callback = sc->callback;
    MemObject *mem = e->mem_obj;
    size_t sz;
    if (sc->flags.copy_event_pending)
        return;
    if (EBIT_TEST(e->flags, ENTRY_FWD_HDR_WAIT)) {
        debug(20, 5) ("storeClientCopy2: returning because ENTRY_FWD_HDR_WAIT set\n");
        return;
    }
    if (sc->flags.store_copying) {
        sc->flags.copy_event_pending = 1;
        debug(20, 3) ("storeClientCopy2: Queueing storeClientCopyEvent()\n");
        eventAdd("storeClientCopyEvent", storeClientCopyEvent, sc, 0.0, 0);
        return;
    }
    cbdataLock(sc); /* ick, prevent sc from getting freed */
    sc->flags.store_copying = 1;
    debug(20, 3) ("storeClientCopy2: %s\n", storeKeyText(e->key));
    assert(callback != NULL);
    /*
     * We used to check for ENTRY_ABORTED here. But there were some
     * problems. For example, we might have a slow client (or two) and
     * the server-side is reading far ahead and swapping to disk. Even
     * if the server-side aborts, we want to give the client(s)
     * everything we got before the abort condition occurred.
     */
    if (storeClientNoMoreToSend(e, sc)) {
        /* There is no more to send! */
#if USE_ASYNC_IO
        if (sc->flags.disk_io_pending) {
            if (sc->swapin_fd >= 0)
                aioCancel(sc->swapin_fd, NULL);
            else
                aioCancel(-1, sc);
        }
#endif
        sc->flags.disk_io_pending = 0;
        sc->callback = NULL;
        callback(sc->callback_data, sc->copy_buf, 0);
    } else if (e->store_status == STORE_PENDING && sc->seen_offset >= mem->
inmem_hi) {
        /* client has already seen this, wait for more */
        debug(20, 3) ("storeClientCopy2: Waiting for more\n");
    } else if (sc->copy_offset >= mem->inmem_lo && sc->copy_offset < mem->
inmem_hi) {
        int isHTML = mem->reply->content_type.buf && !strCmp(mem->reply->
content_type, "text/html");
        int isDone = e->store_status == STORE_OK && mem->object_sz == mem->
inmem_hi;
        if (sc->callback != clientSendMoreData || !isHTML || isDone) {
        /* What the client wants is in memory */
        debug(20, 3) ("storeClientCopy2: Copying from memory\n");
        sz = stmemCopy(&mem->data_hdr, sc->copy_offset, sc->copy_buf, sc->copy_size);
#if USE_ASYNC_IO
        if (sc->flags.disk_io_pending) {
            if (sc->swapin_fd >= 0)
                aioCancel(sc->swapin_fd, NULL);
            else
                aioCancel(-1, sc);
        }
#endif
        sc->flags.disk_io_pending = 0;
        sc->callback = NULL;
        callback(sc->callback_data, sc->copy_buf, sz);
        }
        else {
                dlinkDelete(&((clientHttpRequest *) sc->callback_data)->active,
&ClientActiveRequests);
                dlinkAdd((clientHttpRequest *) sc->callback_data, &((clientHttpRequest *)
sc->callback_data)->active, &ClientActiveRequests);
        }
    } else if (sc->swapin_fd < 0) {
        debug(20, 3) ("storeClientCopy2: Need to open swap in file\n");
        assert(sc->type == STORE_DISK_CLIENT);
        /* gotta open the swapin file */
        if (storeTooManyDiskFilesOpen()) {
            /* yuck -- this causes a TCP_SWAPFAIL_MISS on the client side */
            sc->callback = NULL;
            callback(sc->callback_data, sc->copy_buf, -1);
        } else if (!sc->flags.disk_io_pending) {
            sc->flags.disk_io_pending = 1;
            storeSwapInStart(e, storeClientFileOpened, sc);
        } else {
            debug(20, 2) ("storeClientCopy2: Averted multiple fd operation\n"); }
    } else {
        debug(20, 3) ("storeClientCopy: reading from disk FD %d\n",
            sc->swapin_fd);
        assert(sc->type == STORE_DISK_CLIENT);
        if (!sc->flags.disk_io_pending) {
            storeClientFileRead(sc);
        } else {
            debug(20, 2) ("storeClientCopy2: Averted multiple fd operation\n"); }
    }
    sc->flags.store_copying = 0;
    cbdataUnlock(sc); /* ick, allow sc to be freed */
}
Received on Thu Oct 14 1999 - 02:21:44 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:12:18 MST