Changeset 6eaba0


Ignore:
Timestamp:
2008-06-26 22:07:07 (6 years ago)
Author:
Poul-Henning Kamp <phk@…>
Branches:
master, 3.0, 4.0, experimental-ims
Children:
588bfa
Parents:
b84e80
git-author:
Poul-Henning Kamp <phk@…> (2008-06-26 22:07:07)
git-committer:
Poul-Henning Kamp <phk@…> (2008-06-26 22:07:07)
Message:

Add an undocumented debug facility that allows us to force a received
object to be fragmented into smaller bits are out command.

This is necessary to be able to write sensible testcases for the
abilities of the ESI parsing code to navigate storage boundaries.

git-svn-id:  http://www.varnish-cache.org/svn/trunk/varnish-cache@2836 d4fa192b-c00b-0410-8231-f00ffab90ce4

Location:
bin/varnishd
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • bin/varnishd/cache.h

    r50180b r6eaba0  
    455455int Fetch(struct sess *sp); 
    456456int FetchReqBody(struct sess *sp); 
     457void Fetch_Init(void); 
    457458 
    458459/* cache_hash.c */ 
  • bin/varnishd/cache_fetch.c

    rddb407 r6eaba0  
    4141#include "cache.h" 
    4242#include "stevedore.h" 
     43#include "cli.h" 
     44#include "cli_priv.h" 
     45 
     46static unsigned fetchfrag; 
    4347 
    4448/*--------------------------------------------------------------------*/ 
     
    200204/*--------------------------------------------------------------------*/ 
    201205 
     206static void 
     207dump_st(struct sess *sp, struct storage *st) 
     208{ 
     209        txt t; 
     210 
     211        t.b = (void*)st->ptr; 
     212        t.e = (void*)(st->ptr + st->len); 
     213        WSLR(sp->wrk, SLT_Debug, sp->fd, t); 
     214} 
     215 
    202216static int 
    203217fetch_eof(struct sess *sp, struct http_conn *htc) 
     
    213227        while (1) { 
    214228                if (v == 0) { 
     229                        if (st != NULL && fetchfrag > 0) 
     230                                dump_st(sp, st); 
    215231                        st = STV_alloc(sp, params->fetch_chunksize * 1024); 
    216232                        VTAILQ_INSERT_TAIL(&sp->obj->store, st, list); 
    217233                        p = st->ptr + st->len; 
    218234                        v = st->space - st->len; 
     235                        if (v > fetchfrag) 
     236                                v = fetchfrag; 
    219237                } 
    220238                AN(p); 
     
    230248                sp->obj->len += i; 
    231249        } 
     250        if (st != NULL && fetchfrag > 0) 
     251                dump_st(sp, st); 
    232252 
    233253        if (st->len == 0) { 
     
    443463        return (0); 
    444464} 
     465 
     466/*-------------------------------------------------------------------- 
     467 * Debugging aids 
     468 */ 
     469 
     470static void 
     471debug_fragfetch(struct cli *cli, const char * const *av, void *priv) 
     472{ 
     473        (void)priv; 
     474        (void)cli; 
     475        fetchfrag = strtoul(av[2], NULL, 0); 
     476} 
     477 
     478static struct cli_proto debug_cmds[] = { 
     479        { "debug.fragfetch", "debug.fragfetch", 
     480                "\tEnable fetch fragmentation\n", 1, 1, debug_fragfetch }, 
     481        { NULL } 
     482}; 
     483 
     484/*-------------------------------------------------------------------- 
     485 * 
     486 */ 
     487 
     488void 
     489Fetch_Init(void) 
     490{ 
     491 
     492        CLI_AddFuncs(DEBUG_CLI, debug_cmds); 
     493} 
     494 
     495 
  • bin/varnishd/cache_main.c

    r3b82f4 r6eaba0  
    7373 
    7474        CLI_Init(); 
     75        Fetch_Init(); 
    7576 
    7677        CNT_Init(); 
Note: See TracChangeset for help on using the changeset viewer.