/*--------------------------------------------------------------------
 * The very first request
 */
static int
cnt_first(struct sess *sp)
{

    /*
     * XXX: If we don't have acceptfilters we are somewhat subject
     * XXX: to DoS'ing here.  One remedy would be to set a shorter
     * XXX: SO_RCVTIMEO and once we have received something here
     * XXX: increase it to the normal value.
     */

    assert(sp->xid == 0);
    assert(sp->restarts == 0);
    VCA_Prep(sp);

    /* Record the session watermark */
    sp->ws_ses = WS_Snapshot(sp->ws);

    /* Receive a HTTP protocol request */
    HTC_Init(sp->htc, sp->ws, sp->fd);
    sp->wrk->lastused = sp->t_open;
    sp->acct_req.sess++;

    sp->step = STP_WAIT;
    return (0);
}
예제 #2
0
static int
cnt_first(struct sess *sp)
{
    struct worker *wrk;

    CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
    wrk = sp->wrk;
    CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);

    /*
     * XXX: If we don't have acceptfilters we are somewhat subject
     * XXX: to DoS'ing here.  One remedy would be to set a shorter
     * XXX: SO_RCVTIMEO and once we have received something here
     * XXX: increase it to the normal value.
     */

    assert(sp->xid == 0);
    assert(sp->restarts == 0);
    AZ(sp->esi_level);
    VCA_Prep(sp);

    /* Record the session watermark */
    sp->ws_ses = WS_Snapshot(sp->ws);

    /* Receive a HTTP protocol request */
    HTC_Init(sp->htc, sp->ws, sp->fd, sp->vsl_id,
             cache_param->http_req_size,
             cache_param->http_req_hdr_len);
    wrk->acct_tmp.sess++;

    sp->step = STP_WAIT;
    return (0);
}