Annotation of libwww/Library/src/HTAnchor.c, revision 1.57

1.14      frystyk     1: /*                                                                  HTAnchor.c
                      2: **     HYPERTEXT "ANCHOR" OBJECT
1.1       timbl       3: **
1.22      frystyk     4: **     (c) COPYRIGHT MIT 1995.
1.14      frystyk     5: **     Please first read the full copyright statement in the file COPYRIGH.
1.57    ! frystyk     6: **     @(#) $Id: HTAnchor.c,v 1.56 1996/08/19 18:30:16 frystyk Exp $
1.14      frystyk     7: **
                      8: **     An anchor represents a region of a hypertext document which is
                      9: **     linked to another anchor in the same or a different document.
1.1       timbl      10: **
                     11: ** History
                     12: **         Nov 1990  Written in Objective-C for the NeXT browser (TBL)
                     13: **     24-Oct-1991 (JFG), written in C, browser-independant 
                     14: **     21-Nov-1991 (JFG), first complete version
1.41      frystyk    15: **      3-May-1995 (HF), Added a lot of methods and other stuff made an object
1.54      frystyk    16: **     July 1996       Patch for adding hash of children Michael Farrar
1.1       timbl      17: */
                     18: 
1.16      frystyk    19: /* Library include files */
1.46      frystyk    20: #include "sysdep.h"
1.50      frystyk    21: #include "WWWUtil.h"
1.7       luotonen   22: #include "HTFormat.h"
1.1       timbl      23: #include "HTParse.h"
1.24      frystyk    24: #include "HTMethod.h"
1.41      frystyk    25: #include "HTAncMan.h"                                   /* Implemented here */
1.11      frystyk    26: 
1.54      frystyk    27: #define HASH_SIZE      101        /* Arbitrary prime. Memory/speed tradeoff */
                     28: #define CHILD_HASH_SIZE         67            /* Often smaller than hash of parents */
1.1       timbl      29: 
                     30: PRIVATE HTList **adult_table=0;  /* Point to table of lists of all parents */
                     31: 
1.17      frystyk    32: /* ------------------------------------------------------------------------- */
                     33: /*                             Creation Methods                             */
                     34: /* ------------------------------------------------------------------------- */
                     35: 
                     36: /*
1.1       timbl      37: **     Do not use "new" by itself outside this module. In order to enforce
                     38: **     consistency, we insist that you furnish more information about the
                     39: **     anchor you are creating : use newWithParent or newWithAddress.
                     40: */
1.35      frystyk    41: PRIVATE HTParentAnchor * HTParentAnchor_new (void)
1.1       timbl      42: {
1.43      frystyk    43:     HTParentAnchor *newAnchor;
1.54      frystyk    44:     if ((newAnchor = (HTParentAnchor *) HT_CALLOC(1, sizeof (HTParentAnchor))) == NULL)
1.43      frystyk    45:        HT_OUTOFMEM("HTParentAnchor_new");
1.16      frystyk    46:     newAnchor->parent = newAnchor;
1.17      frystyk    47:     newAnchor->content_type = WWW_UNKNOWN;
1.24      frystyk    48:     newAnchor->mainLink.method = METHOD_INVALID;
1.41      frystyk    49:     newAnchor->content_length = -1;                     /* howcome 6 dec 95 */
1.28      frystyk    50:     newAnchor->date = (time_t) -1;
                     51:     newAnchor->expires = (time_t) -1;
                     52:     newAnchor->last_modified = (time_t) -1;
1.16      frystyk    53:     return newAnchor;
1.1       timbl      54: }
                     55: 
1.16      frystyk    56: 
1.35      frystyk    57: PRIVATE HTChildAnchor * HTChildAnchor_new (void)
1.1       timbl      58: {
1.43      frystyk    59:     HTChildAnchor *child;
                     60:     if ((child = (HTChildAnchor  *) HT_CALLOC(1, sizeof(HTChildAnchor))) == NULL)
                     61:         HT_OUTOFMEM("HTChildAnchor_new");
1.33      frystyk    62:     return child;
1.1       timbl      63: }
                     64: 
1.17      frystyk    65: /*     Create new or find old child anchor
                     66: **     -----------------------------------
1.1       timbl      67: **
1.3       timbl      68: **     Me one is for a new anchor being edited into an existing
1.17      frystyk    69: **     document. The parent anchor must already exist. All
                     70: **     children without tags (no NAME attribut) points to the same NULL
                     71: **     child.
1.54      frystyk    72: **     Children are now hashed for performance reasons. Thanks to
                     73: **     Michael Farrar
1.1       timbl      74: */
1.35      frystyk    75: PUBLIC HTChildAnchor * HTAnchor_findChild (HTParentAnchor *    parent,
1.46      frystyk    76:                                           const char *         tag)
1.1       timbl      77: {
1.54      frystyk    78:     HTChildAnchor * child = NULL;
                     79:     HTList * kids = NULL;
1.17      frystyk    80:     if (!parent) {
1.54      frystyk    81:        if (ANCH_TRACE) HTTrace("Child Anchor Bad argument\n");
1.17      frystyk    82:        return NULL;
                     83:     }
1.1       timbl      84: 
1.54      frystyk    85:     /* Find a hash for this tag (if any) */
                     86:     {
                     87:        int hash = 0;
                     88:        /*
                     89:        ** If tag is empty then use hash value 0
                     90:        */
                     91:        if (tag) {
                     92:            const char * ptr = tag;
                     93:            for(; *ptr; ptr++)
                     94:                hash = (int) ((hash*3 + (*(unsigned char*)ptr)) % CHILD_HASH_SIZE);
                     95:        }
1.55      frystyk    96:        if (!parent->children) {
                     97:            if (!(parent->children = (HTList **)        
1.54      frystyk    98:                  HT_CALLOC(CHILD_HASH_SIZE, sizeof(HTList *))))
                     99:                HT_OUTOFMEM("HTAnchor_findChild");
                    100:        }
1.55      frystyk   101:        if (!parent->children[hash]) parent->children[hash] = HTList_new();
                    102:        kids = parent->children[hash];
1.54      frystyk   103:     }
                    104: 
1.17      frystyk   105:     /* First search list of children to see if tag is already there */
1.54      frystyk   106:     if (tag && *tag) {
                    107:        HTList * cur = kids;
                    108:        while ((child = (HTChildAnchor *) HTList_nextObject(cur))) {
1.56      frystyk   109:            if (child->tag && !strcmp(child->tag, tag)) {
1.54      frystyk   110:                if (ANCH_TRACE)
                    111:                    HTTrace("Child Anchor %p of parent %p with name `%s' already exists.\n",
                    112:                            (void *) child, (void *) parent, tag);
                    113:                return child;
1.1       timbl     114:            }
                    115:        }
1.54      frystyk   116:     }
                    117: 
                    118:     /* If not found then create a new child anchor */
1.17      frystyk   119:     child = HTChildAnchor_new();
1.54      frystyk   120:     HTList_addObject(kids, (void *) child);
1.17      frystyk   121:     child->parent = parent;
1.54      frystyk   122:     if (tag) StrAllocCopy(child->tag, tag);
1.17      frystyk   123:     if (ANCH_TRACE)
1.54      frystyk   124:        HTTrace("Child Anchor New Anchor %p named `%s' is child of %p\n",
1.46      frystyk   125:                (void *) child, tag ? tag : (const char *) "", (void *)parent);
1.17      frystyk   126:     return child;
1.1       timbl     127: }
                    128: 
                    129: 
                    130: /*     Create new or find old named anchor
                    131: **     -----------------------------------
                    132: **
1.3       timbl     133: **     Me one is for a reference which is found in a document, and might
1.1       timbl     134: **     not be already loaded.
                    135: **     Note: You are not guaranteed a new anchor -- you might get an old one,
                    136: **     like with fonts.
                    137: */
1.46      frystyk   138: PUBLIC HTAnchor * HTAnchor_findAddress (const char * address)
1.1       timbl     139: {
1.16      frystyk   140:     char *tag = HTParse (address, "", PARSE_ANCHOR);           /* Any tags? */
1.1       timbl     141:     
1.16      frystyk   142:     /* If the address represents a sub-anchor, we recursively load its parent,
                    143:        then we create a child anchor within that document. */
                    144:     if (*tag) {
1.34      frystyk   145:        char *addr = HTParse(address, "", PARSE_ACCESS | PARSE_HOST |
                    146:                             PARSE_PATH | PARSE_PUNCTUATION);
                    147:        HTParentAnchor * parent = (HTParentAnchor*) HTAnchor_findAddress(addr);
                    148:        HTChildAnchor * child = HTAnchor_findChild(parent, tag);
1.43      frystyk   149:        HT_FREE(addr);
                    150:        HT_FREE(tag);
1.34      frystyk   151:        return (HTAnchor *) child;
1.16      frystyk   152:     } else {                        /* Else check whether we have this node */
                    153:        int hash;
1.46      frystyk   154:        const char *p;
1.16      frystyk   155:        HTList * adults;
                    156:        HTList *grownups;
                    157:        HTParentAnchor * foundAnchor;
1.34      frystyk   158:        char *newaddr = NULL;
                    159:        StrAllocCopy(newaddr, address);                  /* Get our own copy */
1.43      frystyk   160:        HT_FREE(tag);
1.38      frystyk   161:        newaddr = HTSimplify(&newaddr);
1.34      frystyk   162: 
1.16      frystyk   163:        /* Select list from hash table */
                    164:        for(p=newaddr, hash=0; *p; p++)
                    165:            hash = (int) ((hash * 3 + (*(unsigned char*)p)) % HASH_SIZE);
1.33      frystyk   166:        if (!adult_table) {
1.43      frystyk   167:            if ((adult_table = (HTList* *) HT_CALLOC(HASH_SIZE, sizeof(HTList*))) == NULL)
                    168:                HT_OUTOFMEM("HTAnchor_findAddress");
1.33      frystyk   169:        }
1.16      frystyk   170:        if (!adult_table[hash]) adult_table[hash] = HTList_new();
                    171:        adults = adult_table[hash];
                    172: 
                    173:        /* Search list for anchor */
                    174:        grownups = adults;
                    175:        while ((foundAnchor = (HTParentAnchor *) HTList_nextObject(grownups))){
1.33      frystyk   176:            if (!strcmp(foundAnchor->address, newaddr)) {
1.16      frystyk   177:                if (ANCH_TRACE)
1.44      eric      178:                    HTTrace("Find Parent. %p with address `%s' already exists.\n",
1.16      frystyk   179:                            (void*) foundAnchor, newaddr);
1.43      frystyk   180:                HT_FREE(newaddr);                      /* We already have it */
1.16      frystyk   181:                return (HTAnchor *) foundAnchor;
                    182:            }
                    183:        }
                    184:        
                    185:        /* Node not found : create new anchor. */
                    186:        foundAnchor = HTParentAnchor_new();
                    187:        foundAnchor->address = newaddr;                 /* Remember our copy */
                    188:        HTList_addObject (adults, foundAnchor);
1.44      eric      189:        if (ANCH_TRACE) HTTrace("Find Parent. %p with hash %d and address `%s' created\n", (void*)foundAnchor, hash, newaddr);
1.1       timbl     190:        return (HTAnchor *) foundAnchor;
                    191:     }
                    192: }
                    193: 
1.17      frystyk   194: /*     Create or find a child anchor with a possible link
                    195: **     --------------------------------------------------
                    196: **
                    197: **     Create new anchor with a given parent and possibly
                    198: **     a name, and possibly a link to a _relatively_ named anchor.
1.34      frystyk   199: **     All parameters EXCEPT parent can be NULL
1.17      frystyk   200: */
1.34      frystyk   201: PUBLIC HTChildAnchor * HTAnchor_findChildAndLink (HTParentAnchor *     parent,
1.46      frystyk   202:                                                  const char *          tag,
                    203:                                                  const char *          href,
1.41      frystyk   204:                                                  HTLinkType            ltype)
1.17      frystyk   205: {
1.34      frystyk   206:     HTChildAnchor * child = HTAnchor_findChild(parent, tag);
1.54      frystyk   207:     if (child && href && *href) {
1.53      frystyk   208:        char * relative_to = HTAnchor_expandedAddress((HTAnchor *) parent);
1.34      frystyk   209:        char * parsed_address = HTParse(href, relative_to, PARSE_ALL);
                    210:        HTAnchor * dest = HTAnchor_findAddress(parsed_address);
1.52      frystyk   211:        HTLink_add((HTAnchor *) child, dest, ltype, METHOD_INVALID);
1.43      frystyk   212:        HT_FREE(parsed_address);
                    213:        HT_FREE(relative_to);
1.34      frystyk   214:     }
                    215:     return child;
1.17      frystyk   216: }
                    217: 
1.52      frystyk   218: /* ------------------------------------------------------------------------- */
                    219: /*                                Link Methods                              */
                    220: /* ------------------------------------------------------------------------- */
1.28      frystyk   221: 
1.41      frystyk   222: /*
                    223: **  Upgrade the link to the main destination and and downgrade the
                    224: **  current main link to the list
                    225: */
                    226: PUBLIC HTLink * HTAnchor_mainLink (HTAnchor * me)
                    227: {
                    228:     return me ? &(me->mainLink) : NULL;
                    229: }
1.28      frystyk   230: 
1.41      frystyk   231: PUBLIC BOOL HTAnchor_setMainLink  (HTAnchor * me, HTLink * movingLink)
1.28      frystyk   232: {
1.41      frystyk   233:     if (!(me && me->links && movingLink &&
                    234:          HTList_removeObject(me->links, movingLink)))
                    235:        return NO;
                    236:     else {
                    237:        /* First push current main link onto top of links list */
1.52      frystyk   238:        HTLink * newLink = HTLink_new();
1.42      frystyk   239:        memcpy ((void *) newLink, & me->mainLink, sizeof (HTLink));
1.41      frystyk   240:        HTList_addObject (me->links, newLink);
                    241: 
1.52      frystyk   242:        /* Now make movingLink the new main link, and delete it */
1.42      frystyk   243:        memcpy ((void *) &me->mainLink, movingLink, sizeof (HTLink));
1.52      frystyk   244:        HTLink_delete(movingLink);
1.28      frystyk   245:        return YES;
                    246:     }
                    247: }
                    248: 
                    249: /*
1.41      frystyk   250: **     Handling sub links
1.24      frystyk   251: */
1.41      frystyk   252: PUBLIC HTList * HTAnchor_subLinks (HTAnchor * anchor)
1.24      frystyk   253: {
1.41      frystyk   254:     return anchor ? anchor->links : NULL;
1.24      frystyk   255: }
                    256: 
1.41      frystyk   257: PUBLIC BOOL HTAnchor_setSubLinks (HTAnchor * anchor, HTList * list)
                    258: {
                    259:     if (anchor) {
                    260:        anchor->links = list;
                    261:        return YES;
                    262:     }
                    263:     return NO;
                    264: }
1.24      frystyk   265: 
                    266: /*
1.41      frystyk   267: **  Returns the main destination of this anchor
                    268: */
                    269: PUBLIC HTAnchor * HTAnchor_followMainLink (HTAnchor * me)
                    270: {
1.52      frystyk   271:     return me ? HTLink_destination(&me->mainLink) : NULL;
1.17      frystyk   272: }
                    273: 
                    274: /* ------------------------------------------------------------------------- */
                    275: /*                             Deletion Methods                             */
                    276: /* ------------------------------------------------------------------------- */
1.1       timbl     277: 
                    278: /*     Delete an anchor and possibly related things (auto garbage collection)
                    279: **     --------------------------------------------
                    280: **
                    281: **     The anchor is only deleted if the corresponding document is not loaded.
1.10      frystyk   282: **     All outgoing links from parent and children are deleted, and this
                    283: **     anchor is removed from the sources list of all its targets.
1.1       timbl     284: **     We also try to delete the targets whose documents are not loaded.
                    285: **     If this anchor's source list is empty, we delete it and its children.
                    286: */
                    287: 
1.41      frystyk   288: /*     Deletes all the memory allocated in a parent anchor and returns any
                    289: **     hyperdoc object hanging of this anchor
1.19      frystyk   290: */
1.41      frystyk   291: PRIVATE void * delete_parent (HTParentAnchor * me)
1.19      frystyk   292: {
1.41      frystyk   293:     void * doc = me->document;
1.19      frystyk   294: 
                    295:     /* Remove link and address information */
1.26      frystyk   296:     if (me->links) {
                    297:        HTList *cur = me->links;
                    298:        HTLink *pres;
                    299:        while ((pres = (HTLink *) HTList_nextObject(cur)))
1.52      frystyk   300:            HTLink_delete(pres);
1.26      frystyk   301:        HTList_delete(me->links);
                    302:     }
1.54      frystyk   303: 
                    304:     /* Remove children */
                    305:     if (me->children) {
                    306:        int cnt = 0;
                    307:        for (; cnt<CHILD_HASH_SIZE; cnt++) {
                    308:            if (me->children[cnt]) HTList_delete(me->children[cnt]);
                    309:        }
                    310:        HT_FREE(me->children);
                    311:     }
                    312: 
1.19      frystyk   313:     HTList_delete (me->sources);
1.52      frystyk   314:     HTList_delete (me->variants);
1.43      frystyk   315:     HT_FREE(me->physical);
                    316:     HT_FREE(me->address);
1.19      frystyk   317: 
                    318:     /* Then remove entity header information (metainformation) */
1.43      frystyk   319:     HT_FREE(me->title);
1.47      frystyk   320:     if (me->content_encoding) HTList_delete(me->content_encoding);
                    321:     if (me->content_language) HTList_delete(me->content_language);
1.57    ! frystyk   322: 
        !           323:     /* Type parameter information */
        !           324:     if (me->type_parameters) HTAssocList_delete(me->type_parameters);
        !           325: 
1.43      frystyk   326:     HT_FREE(me->derived_from);
                    327:     HT_FREE(me->version);
1.19      frystyk   328:     if (me->extra_headers) {
                    329:        HTList *cur = me->extra_headers;
                    330:        char *pres;
                    331:        while ((pres = (char *) HTList_nextObject(cur)))
1.43      frystyk   332:            HT_FREE(pres);
1.19      frystyk   333:        HTList_delete(me->extra_headers);
                    334:     }
1.43      frystyk   335:     HT_FREE(me);
1.19      frystyk   336:     return doc;
                    337: }
                    338: 
                    339: 
1.41      frystyk   340: /*     Delete a parent anchor and all its children. If a hyperdoc object
                    341: **     is found hanging off the parent anchor then this is returned
1.19      frystyk   342: */
1.41      frystyk   343: PRIVATE void * delete_family (HTAnchor * me)
1.19      frystyk   344: {
                    345:     HTParentAnchor *parent = me->parent;
                    346:     if (ANCH_TRACE)
1.44      eric      347:        HTTrace("AnchorDelete Remove parent %p and children\n", parent);
1.19      frystyk   348:     if (!me) {
                    349:        if (ANCH_TRACE)
1.44      eric      350:            HTTrace("AnchorDelete No anchor found\n");
1.19      frystyk   351:        return NULL;
                    352:     }
                    353: 
                    354:     /* Delete children */
                    355:     if (parent->children) {
1.54      frystyk   356:        int cnt = 0;
                    357:        for (; cnt<CHILD_HASH_SIZE; cnt++) {
                    358:            HTList * kids = parent->children[cnt];
                    359:            if (kids) {
                    360:                HTChildAnchor * child;
                    361:                while ((child=(HTChildAnchor*)HTList_removeLastObject(kids))) {
                    362:                    HT_FREE(child->tag);
                    363:                    if (child->links) {
                    364:                        HTList * cur = child->links;
                    365:                        HTLink * pres;
                    366:                        while ((pres = (HTLink *) HTList_nextObject(cur)))
                    367:                            HTLink_delete(pres);
                    368:                        HTList_delete(child->links);
                    369:                    }
                    370:                    HT_FREE(child);
                    371:                }
                    372:                HTList_delete(kids);
                    373:                parent->children[cnt] = NULL;
1.26      frystyk   374:            }
1.19      frystyk   375:        }
                    376:     }
                    377:     return delete_parent(parent);
                    378: }
                    379: 
                    380: 
                    381: /*     DELETE ALL ANCHORS
                    382: **     ------------------
                    383: **     Deletes all anchors and return a list of all the HyperDocs found.
                    384: **     It is for the application to delete any HyperDocs.
1.39      frystyk   385: **     If NULL then no hyperdocs are returned
1.19      frystyk   386: **     Return YES if OK, else NO
                    387: */
1.35      frystyk   388: PUBLIC BOOL HTAnchor_deleteAll (HTList * documents)
1.19      frystyk   389: {
                    390:     int cnt;
                    391:     HTList *cur;
1.39      frystyk   392:     if (!adult_table)
1.19      frystyk   393:        return NO;
                    394:     for (cnt=0; cnt<HASH_SIZE; cnt++) {
                    395:        if ((cur = adult_table[cnt])) { 
                    396:            HTParentAnchor *pres;
                    397:            while ((pres = (HTParentAnchor *) HTList_nextObject(cur)) != NULL){
1.41      frystyk   398:                void * doc = delete_family((HTAnchor *) pres);
                    399:                if (doc && documents) HTList_addObject(documents, doc);
1.19      frystyk   400:            }
                    401:        }
                    402:        HTList_delete(adult_table[cnt]);
                    403:     }
1.43      frystyk   404:     HT_FREE(adult_table);
1.19      frystyk   405:     return YES;
                    406: }
                    407: 
                    408: 
1.54      frystyk   409: PRIVATE void delete_links (HTAnchor * me)
1.1       timbl     410: {
1.3       timbl     411:   if (! me)
1.1       timbl     412:     return;
                    413: 
                    414:   /* Recursively try to delete target anchors */
1.3       timbl     415:   if (me->mainLink.dest) {
                    416:     HTParentAnchor *parent = me->mainLink.dest->parent;
                    417:     HTList_removeObject (parent->sources, me);
1.1       timbl     418:     if (! parent->document)  /* Test here to avoid calling overhead */
                    419:       HTAnchor_delete (parent);
                    420:   }
1.3       timbl     421:   if (me->links) {  /* Extra destinations */
1.1       timbl     422:     HTLink *target;
1.12      frystyk   423:     while ((target = (HTLink *) HTList_removeLastObject (me->links))) {
1.1       timbl     424:       HTParentAnchor *parent = target->dest->parent;
1.3       timbl     425:       HTList_removeObject (parent->sources, me);
1.1       timbl     426:       if (! parent->document)  /* Test here to avoid calling overhead */
                    427:        HTAnchor_delete (parent);
                    428:     }
                    429:   }
                    430: }
                    431: 
1.35      frystyk   432: PUBLIC BOOL HTAnchor_delete (HTParentAnchor * me)
1.1       timbl     433: {
1.54      frystyk   434:     /* Don't delete if document is loaded */
                    435:     if (!me || me->document) {
                    436:        if (ANCH_TRACE) HTTrace("Anchor...... Not deleted\n");
                    437:        return NO;
                    438:     }
                    439: 
                    440:     /* Recursively try to delete target anchors */
                    441:     delete_links ((HTAnchor *) me);
1.1       timbl     442: 
1.54      frystyk   443:     if (!HTList_isEmpty(me->sources)) {    /* There are still incoming links */
                    444: 
                    445:        /*
                    446:        ** Delete all outgoing links from children, if any
                    447:        */
                    448:        if (me->children) {
                    449:            int cnt = 0;
                    450:            for (; cnt<CHILD_HASH_SIZE; cnt++) {
                    451:                HTList * kids = me->children[cnt];
                    452:                if (kids) {
                    453:                    HTChildAnchor * child;
                    454:                    while ((child = (HTChildAnchor *) HTList_nextObject(kids)))
                    455:                        delete_links((HTAnchor *) child);
                    456:                    return NO;  /* Parent not deleted */
                    457:                }
                    458:            }
                    459:        }
1.1       timbl     460: 
1.54      frystyk   461:        /*
                    462:        ** No more incoming links : kill everything
                    463:        ** First, recursively delete children
                    464:        */
                    465:        if (me->children) {
                    466:            int cnt = 0;
                    467:            for (; cnt<CHILD_HASH_SIZE; cnt++) {
                    468:                HTList * kids = me->children[cnt];
                    469:                if (kids) {
                    470:                    HTChildAnchor * child;
                    471:                    while ((child=(HTChildAnchor *) HTList_removeLastObject(kids)))
                    472:                        delete_links((HTAnchor *) child);
                    473:                    HT_FREE(child->tag);
                    474:                    HT_FREE(child);
                    475:                }
                    476:            }
                    477:        }
                    478:     }
1.1       timbl     479: 
1.54      frystyk   480:     /* Now kill myself */
                    481:     delete_parent(me);
                    482:     return YES;  /* Parent deleted */
                    483: #if 0
1.3       timbl     484:   if (! HTList_isEmpty (me->sources)) {  /* There are still incoming links */
1.1       timbl     485:     /* Delete all outgoing links from children, if any */
1.3       timbl     486:     HTList *kids = me->children;
1.12      frystyk   487:     while ((child = (HTChildAnchor *) HTList_nextObject (kids)))
1.54      frystyk   488:       delete_links ((HTAnchor *) child);
1.1       timbl     489:     return NO;  /* Parent not deleted */
                    490:   }
                    491: 
                    492:   /* No more incoming links : kill everything */
                    493:   /* First, recursively delete children */
1.12      frystyk   494:   while ((child = (HTChildAnchor *) HTList_removeLastObject (me->children))) {
1.54      frystyk   495:     delete_links ((HTAnchor *) child);
1.43      frystyk   496:     HT_FREE(child->tag);
                    497:     HT_FREE(child);
1.1       timbl     498:   }
1.54      frystyk   499: #endif
1.1       timbl     500: }
                    501: 
1.17      frystyk   502: /* ------------------------------------------------------------------------- */
                    503: /*                             Data Access Methods                          */
                    504: /* ------------------------------------------------------------------------- */
1.1       timbl     505: 
1.35      frystyk   506: PUBLIC HTParentAnchor * HTAnchor_parent  (HTAnchor * me)
1.1       timbl     507: {
1.17      frystyk   508:     return me ? me->parent : NULL;
1.1       timbl     509: }
                    510: 
1.41      frystyk   511: PUBLIC void HTAnchor_setDocument  (HTParentAnchor * me, void * doc)
1.1       timbl     512: {
1.41      frystyk   513:     if (me) me->document = doc;
1.1       timbl     514: }
                    515: 
1.41      frystyk   516: PUBLIC void * HTAnchor_document  (HTParentAnchor * me)
1.1       timbl     517: {
1.17      frystyk   518:     return me ? me->document : NULL;
1.1       timbl     519: }
                    520: 
1.53      frystyk   521: PUBLIC char * HTAnchor_address  (HTAnchor * me) 
                    522: { 
                    523:     char *addr = NULL;
                    524:     if (me) {
                    525:         if (((HTParentAnchor *) me == me->parent) ||
                    526:             !((HTChildAnchor *) me)->tag) { /* it's an adult or no tag */
                    527:             StrAllocCopy (addr, me->parent->address);
                    528:         }
                    529:         else {                  /* it's a named child */
                    530:             if ((addr = (char  *) HT_MALLOC(2 + strlen (me->parent->address) + \
                    531: strlen (((HTChildAnchor *) me)->tag))) == NULL)
                    532:                 HT_OUTOFMEM("HTAnchor_address");
                    533:             sprintf (addr, "%s#%s", me->parent->address,
                    534:                      ((HTChildAnchor *) me)->tag);
                    535:         }
                    536:     }
                    537:     return addr;
                    538: }
                    539: 
1.51      frystyk   540: /*
1.53      frystyk   541: **     We resolve the child address with respect to either a base URL,
                    542: **     a content-location, or to the request-URI
1.51      frystyk   543: */
1.53      frystyk   544: PUBLIC char * HTAnchor_expandedAddress  (HTAnchor * me)
1.1       timbl     545: {
1.17      frystyk   546:     char *addr = NULL;
                    547:     if (me) {
1.53      frystyk   548:        HTParentAnchor * parent = me->parent;
                    549:        char * base = parent->content_location ? parent->content_location :
                    550:            parent->content_base ? parent->content_base : parent->address;
1.17      frystyk   551:        if (((HTParentAnchor *) me == me->parent) ||
                    552:            !((HTChildAnchor *) me)->tag) { /* it's an adult or no tag */
1.52      frystyk   553:            StrAllocCopy(addr, base);
1.51      frystyk   554:        } else {                        /* it's a named child */
1.52      frystyk   555:            if ((addr = (char *) HT_MALLOC(2 + strlen(base) + strlen(((HTChildAnchor *) me)->tag))) == NULL)
1.43      frystyk   556:                HT_OUTOFMEM("HTAnchor_address");
1.52      frystyk   557:            sprintf (addr, "%s#%s", base, ((HTChildAnchor *) me)->tag);
1.17      frystyk   558:        }
1.1       timbl     559:     }
1.17      frystyk   560:     return addr;
1.1       timbl     561: }
                    562: 
1.52      frystyk   563: /*     Physical Address
                    564: **     ----------------
                    565: */
                    566: PUBLIC char * HTAnchor_physical (HTParentAnchor * me)
                    567: {
1.53      frystyk   568:     return me ? me->physical ? me->physical : me->address : NULL;
1.52      frystyk   569: }
                    570: 
1.53      frystyk   571: PUBLIC void HTAnchor_setPhysical (HTParentAnchor * me, char * physical)
1.52      frystyk   572: {
                    573:     if (!me || !physical) {
                    574:        if (ANCH_TRACE)
                    575:            HTTrace("HTAnchor.... setPhysical, called with null argument\n");
                    576:        return;
                    577:     }
                    578:     StrAllocCopy(me->physical, physical);
                    579: }
                    580: 
1.53      frystyk   581: PUBLIC void HTAnchor_clearPhysical(HTParentAnchor * me)
                    582: {
                    583:     if (me) HT_FREE(me->physical);
                    584: }
                    585: 
                    586: /*
                    587: **     Children information
                    588: */
1.35      frystyk   589: PUBLIC BOOL HTAnchor_hasChildren  (HTParentAnchor * me)
1.17      frystyk   590: {
1.54      frystyk   591:     return (me && me->children);
1.17      frystyk   592: }
1.1       timbl     593: 
1.52      frystyk   594: /*     Cache Information
                    595: **     -----------------
                    596: */
                    597: PUBLIC BOOL HTAnchor_cacheHit (HTParentAnchor * me)
                    598: {
                    599:     return me ? me->cacheHit : NO;
                    600: }
                    601: 
                    602: PUBLIC void HTAnchor_setCacheHit (HTParentAnchor * me, BOOL cacheHit)
                    603: {
                    604:     if (me) me->cacheHit = cacheHit;
                    605: }
                    606: 
                    607: /* ------------------------------------------------------------------------- */
                    608: /*                           Entity Header Information                      */
                    609: /* ------------------------------------------------------------------------- */
                    610: 
                    611: /*
                    612: **     Variants. If this anchor has any variants then keep them in a list
                    613: **     so that we can find them later. The list is simply a list of 
                    614: **     parent anchors.
                    615: */
                    616: PUBLIC HTList * HTAnchor_variants (HTParentAnchor * me)
1.17      frystyk   617: {
1.52      frystyk   618:     return me ? me->variants : NULL;
1.17      frystyk   619: }
1.1       timbl     620: 
1.52      frystyk   621: PUBLIC BOOL HTAnchor_addVariant (HTParentAnchor * me,
                    622:                                 HTParentAnchor * variant)
1.1       timbl     623: {
1.52      frystyk   624:     if (me && variant) {
                    625:        if (!me->variants) me->variants = HTList_new();
                    626:        return HTList_addObject(me->variants, variant);
                    627:     }
                    628:     return NO;
1.17      frystyk   629: }
                    630: 
1.52      frystyk   631: PUBLIC BOOL HTAnchor_deleteVariant (HTParentAnchor * me,
                    632:                                    HTParentAnchor * variant)
1.17      frystyk   633: {
1.52      frystyk   634:     return (me && variant) ? HTList_removeObject(me->variants, variant) : NO;
1.9       frystyk   635: }
1.1       timbl     636: 
1.52      frystyk   637: /*
                    638: **     Is this resource an index?
1.17      frystyk   639: */
1.52      frystyk   640: PUBLIC void HTAnchor_clearIndex  (HTParentAnchor * me)
                    641: {
                    642:     if (me) me->isIndex = NO;
                    643: }
1.17      frystyk   644: 
1.52      frystyk   645: PUBLIC void HTAnchor_setIndex  (HTParentAnchor * me)
1.1       timbl     646: {
1.52      frystyk   647:   if (me) me->isIndex = YES;
1.1       timbl     648: }
                    649: 
1.52      frystyk   650: PUBLIC BOOL HTAnchor_isIndex  (HTParentAnchor * me)
1.1       timbl     651: {
1.52      frystyk   652:     return me ? me->isIndex : NO;
1.27      frystyk   653: }
                    654: 
1.52      frystyk   655: /*     Content Base
1.51      frystyk   656: **     ------------
                    657: */
                    658: PUBLIC char * HTAnchor_base (HTParentAnchor * me)
                    659: {
                    660:     return me ? me->content_base : NULL;
                    661: }
                    662: 
                    663: PUBLIC BOOL HTAnchor_setBase (HTParentAnchor * me, char * base)
                    664: {
                    665:     if (!me || !base) {
                    666:        if (ANCH_TRACE)
                    667:            HTTrace("HTAnchor.... set base called with null argument\n");
                    668:        return NO;
                    669:     }
                    670:     StrAllocCopy(me->content_base, base);
                    671:     return YES;
                    672: }
                    673: 
1.52      frystyk   674: /*     Content Location
                    675: **     ----------------
1.27      frystyk   676: */
1.52      frystyk   677: PUBLIC char * HTAnchor_location (HTParentAnchor * me)
1.27      frystyk   678: {
1.52      frystyk   679:     return me ? me->content_location : NULL;
1.27      frystyk   680: }
                    681: 
1.53      frystyk   682: /*
                    683: **     Expand the location relative to the base URL if any, otherwise the 
                    684: **     anchor address it self
                    685: */
1.52      frystyk   686: PUBLIC BOOL HTAnchor_setLocation (HTParentAnchor * me, char * location)
1.27      frystyk   687: {
1.53      frystyk   688:     if (me && location) {
                    689:        char * base = me->content_base ? me->content_base : me->address;
                    690:        me->content_location = HTParse(location, base, PARSE_ALL);
                    691:        return YES;
1.52      frystyk   692:     }
1.53      frystyk   693:     return NO;
1.1       timbl     694: }
                    695: 
1.52      frystyk   696: /*     Content-Type
                    697: **     ------------
1.17      frystyk   698: */
1.35      frystyk   699: PUBLIC HTFormat HTAnchor_format (HTParentAnchor * me)
1.17      frystyk   700: {
                    701:     return me ? me->content_type : NULL;
                    702: }
1.1       timbl     703: 
1.35      frystyk   704: PUBLIC void HTAnchor_setFormat (HTParentAnchor * me, HTFormat form)
1.1       timbl     705: {
1.17      frystyk   706:     if (me) me->content_type = form;
1.1       timbl     707: }
                    708: 
1.52      frystyk   709: PUBLIC HTAssocList * HTAnchor_formatParam (HTParentAnchor * me)
                    710: {
                    711:     return me ? me->type_parameters : NULL;
                    712: }
                    713: 
                    714: PUBLIC BOOL HTAnchor_addFormatParam (HTParentAnchor * me,
                    715:                                     const char * name, const char * value)
                    716: {
                    717:     if (me) {
                    718:        if (!me->type_parameters) me->type_parameters = HTAssocList_new();
                    719:        return HTAssocList_replaceObject(me->type_parameters, name, value);
                    720:     }
                    721:     return NO;
                    722: }
                    723: 
1.17      frystyk   724: /*
                    725: **     Charset parameter to Content-Type
1.1       timbl     726: */
1.35      frystyk   727: PUBLIC HTCharset HTAnchor_charset (HTParentAnchor * me)
1.1       timbl     728: {
1.52      frystyk   729:     if (me && me->type_parameters) {
                    730:        char * charset = HTAssocList_findObject(me->type_parameters,"charset");
                    731:        return HTAtom_for(charset);
                    732:     }
                    733:     return NULL;
1.1       timbl     734: }
                    735: 
1.52      frystyk   736: PUBLIC BOOL HTAnchor_setCharset (HTParentAnchor * me, HTCharset charset)
1.1       timbl     737: {
1.52      frystyk   738:     return HTAnchor_addFormatParam(me, "charset", HTAtom_name(charset));
1.1       timbl     739: }
                    740: 
1.17      frystyk   741: /*
1.20      frystyk   742: **     Level parameter to Content-Type
                    743: */
1.35      frystyk   744: PUBLIC HTLevel HTAnchor_level (HTParentAnchor * me)
1.20      frystyk   745: {
1.52      frystyk   746:     if (me && me->type_parameters) {
                    747:        char * level = HTAssocList_findObject(me->type_parameters, "level");
                    748:        return HTAtom_for(level);
                    749:     }
                    750:     return NULL;
1.20      frystyk   751: }
                    752: 
1.52      frystyk   753: PUBLIC BOOL HTAnchor_setLevel (HTParentAnchor * me, HTLevel level)
1.20      frystyk   754: {
1.52      frystyk   755:     return HTAnchor_addFormatParam(me, "level", HTAtom_name(level));
1.20      frystyk   756: }
                    757: 
                    758: /*
1.17      frystyk   759: **     Content Encoding
                    760: */
1.47      frystyk   761: PUBLIC HTList * HTAnchor_encoding (HTParentAnchor * me)
1.1       timbl     762: {
1.17      frystyk   763:     return me ? me->content_encoding : NULL;
1.1       timbl     764: }
                    765: 
1.47      frystyk   766: PUBLIC BOOL HTAnchor_addEncoding (HTParentAnchor * me, HTEncoding  encoding)
1.17      frystyk   767: {
1.47      frystyk   768:     if (me && encoding) {
                    769:        if (!me->content_encoding) me->content_encoding = HTList_new();
                    770:        return HTList_addObject(me->content_encoding, encoding);
                    771:     }
                    772:     return NO;
1.17      frystyk   773: }
                    774: 
                    775: /*
1.21      frystyk   776: **     Content Language
                    777: */
1.47      frystyk   778: PUBLIC HTList * HTAnchor_language (HTParentAnchor * me)
1.21      frystyk   779: {
                    780:     return me ? me->content_language : NULL;
                    781: }
                    782: 
1.47      frystyk   783: PUBLIC BOOL HTAnchor_addLanguage (HTParentAnchor * me, HTLanguage  language)
1.21      frystyk   784: {
1.47      frystyk   785:     if (me && language) {
                    786:        if (!me->content_language) me->content_language = HTList_new();
                    787:        return HTList_addObject(me->content_language, language);
                    788:     }
                    789:     return NO;
1.21      frystyk   790: }
                    791: 
                    792: /*
1.17      frystyk   793: **     Content Transfer Encoding
1.1       timbl     794: */
1.48      frystyk   795: PUBLIC HTEncoding HTAnchor_transfer (HTParentAnchor * me)
1.17      frystyk   796: {
1.48      frystyk   797:     return me ? me->transfer : NULL;
1.17      frystyk   798: }
1.1       timbl     799: 
1.48      frystyk   800: PUBLIC void HTAnchor_setTransfer (HTParentAnchor * me, HTEncoding transfer)
1.17      frystyk   801: {
1.48      frystyk   802:     if (me) me->transfer = transfer;
1.17      frystyk   803: }
                    804: 
                    805: /*
                    806: **     Content Length
                    807: */
1.35      frystyk   808: PUBLIC long int HTAnchor_length (HTParentAnchor * me)
1.1       timbl     809: {
1.17      frystyk   810:     return me ? me->content_length : -1;
1.1       timbl     811: }
                    812: 
1.35      frystyk   813: PUBLIC void HTAnchor_setLength (HTParentAnchor * me, long int length)
1.17      frystyk   814: {
                    815:     if (me) me->content_length = length;
                    816: }
1.1       timbl     817: 
1.49      frystyk   818: PUBLIC void HTAnchor_addLength (HTParentAnchor * me, long int deltalength)
                    819: {
                    820:     if (me) {
                    821:        if (me->content_length < 0)
                    822:            me->content_length = deltalength;
                    823:        else
                    824:            me->content_length += deltalength;
                    825:     }
                    826: }
                    827: 
1.17      frystyk   828: /*
                    829: **     Allowed methods (Allow)
1.1       timbl     830: */
1.45      frystyk   831: PUBLIC HTMethod HTAnchor_methods (HTParentAnchor * me)
1.17      frystyk   832: {
1.32      frystyk   833:     return me ? me->methods : METHOD_INVALID;
1.17      frystyk   834: }
1.1       timbl     835: 
1.45      frystyk   836: PUBLIC void HTAnchor_setMethods (HTParentAnchor * me, HTMethod methodset)
1.1       timbl     837: {
1.17      frystyk   838:     if (me) me->methods = methodset;
1.1       timbl     839: }
                    840: 
1.45      frystyk   841: PUBLIC void HTAnchor_appendMethods (HTParentAnchor * me, HTMethod methodset)
1.1       timbl     842: {
1.32      frystyk   843:     if (me) me->methods |= methodset;
1.1       timbl     844: }
                    845: 
1.17      frystyk   846: /*
                    847: **     Title
1.2       timbl     848: */
1.46      frystyk   849: PUBLIC const char * HTAnchor_title  (HTParentAnchor * me)
1.1       timbl     850: {
1.17      frystyk   851:     return me ? me->title : NULL;
                    852: }
1.1       timbl     853: 
1.46      frystyk   854: PUBLIC void HTAnchor_setTitle (HTParentAnchor * me, const char * title)
1.17      frystyk   855: {
                    856:     if (me && title) StrAllocCopy(me->title, title);
1.2       timbl     857: }
                    858: 
1.46      frystyk   859: PUBLIC void HTAnchor_appendTitle (HTParentAnchor * me, const char * title)
1.17      frystyk   860: {
                    861:     if (me && title) StrAllocCat(me->title, title);
                    862: }
1.2       timbl     863: 
1.17      frystyk   864: /*
                    865: **     Version
1.2       timbl     866: */
1.41      frystyk   867: PUBLIC char * HTAnchor_version (HTParentAnchor * me)
1.17      frystyk   868: {
                    869:     return me ? me->version : NULL;
                    870: }
1.2       timbl     871: 
1.46      frystyk   872: PUBLIC void HTAnchor_setVersion (HTParentAnchor * me, const char * version)
1.2       timbl     873: {
1.17      frystyk   874:     if (me && version) StrAllocCopy(me->version, version);
1.2       timbl     875: }
                    876: 
1.17      frystyk   877: /*
                    878: **     Derived from
1.2       timbl     879: */
1.41      frystyk   880: PUBLIC char * HTAnchor_derived (HTParentAnchor * me)
1.17      frystyk   881: {
                    882:     return me ? me->derived_from : NULL;
                    883: }
                    884: 
1.46      frystyk   885: PUBLIC void HTAnchor_setDerived (HTParentAnchor * me, const char *derived_from)
1.17      frystyk   886: {
                    887:     if (me && derived_from) StrAllocCopy(me->derived_from, derived_from);
                    888: }
1.2       timbl     889: 
1.17      frystyk   890: /*
1.52      frystyk   891: **     Content MD5
                    892: */
                    893: PUBLIC char * HTAnchor_md5 (HTParentAnchor * me)
                    894: {
                    895:     return me ? me->content_md5 : NULL;
                    896: }
                    897: 
                    898: PUBLIC void HTAnchor_setMd5 (HTParentAnchor * me, const char * hash)
                    899: {
                    900:     if (me && hash) StrAllocCopy(me->content_md5, hash);
                    901: }
                    902: 
                    903: /*
1.28      frystyk   904: **     Date
                    905: */
1.41      frystyk   906: PUBLIC time_t HTAnchor_date (HTParentAnchor * me)
                    907: {
                    908:     return me ? me->date : -1;
                    909: }
                    910: 
1.46      frystyk   911: PUBLIC void HTAnchor_setDate (HTParentAnchor * me, const time_t date)
1.28      frystyk   912: {
1.41      frystyk   913:     if (me) me->date = date;
1.28      frystyk   914: }
                    915: 
                    916: /*
                    917: **     Expires
                    918: */
1.41      frystyk   919: PUBLIC time_t HTAnchor_expires (HTParentAnchor * me)
                    920: {
                    921:     return me ? me->expires : -1;
                    922: }
                    923: 
1.46      frystyk   924: PUBLIC void HTAnchor_setExpires (HTParentAnchor * me, const time_t expires)
1.28      frystyk   925: {
1.41      frystyk   926:     if (me) me->expires = expires;
1.28      frystyk   927: }
                    928: 
                    929: /*
                    930: **     Last Modified
                    931: */
1.41      frystyk   932: PUBLIC time_t HTAnchor_lastModified (HTParentAnchor * me)
                    933: {
                    934:     return me ? me->last_modified : -1;
                    935: }
                    936: 
1.46      frystyk   937: PUBLIC void HTAnchor_setLastModified (HTParentAnchor * me, const time_t lm)
1.28      frystyk   938: {
1.41      frystyk   939:     if (me) me->last_modified = lm;
1.28      frystyk   940: }
                    941: 
                    942: /*
1.52      frystyk   943: **     Entity Tag
                    944: */
                    945: PUBLIC char * HTAnchor_etag (HTParentAnchor * me)
                    946: {
                    947:     return me ? me->etag : NULL;
                    948: }
                    949: 
                    950: PUBLIC void HTAnchor_setEtag (HTParentAnchor * me, const char * etag)
                    951: {
                    952:     if (me && etag) StrAllocCopy(me->etag, etag);
                    953: }
                    954: 
                    955: PUBLIC BOOL HTAnchor_isEtagWeak (HTParentAnchor * me)
                    956: {
                    957:     return (me && me->etag && !strncasecomp(me->etag, "W/", 2));
                    958: }
                    959: 
                    960: /*
1.17      frystyk   961: **     Extra Header List of unknown headers
                    962: */
1.35      frystyk   963: PUBLIC HTList * HTAnchor_Extra  (HTParentAnchor * me)
1.2       timbl     964: {
1.17      frystyk   965:     return me ? me->extra_headers : NULL;
1.2       timbl     966: }
                    967: 
1.46      frystyk   968: PUBLIC void HTAnchor_addExtra (HTParentAnchor * me, const char * header)
1.2       timbl     969: {
1.17      frystyk   970:     if (me) {
1.18      frystyk   971:        char *newhead = NULL;
                    972:        StrAllocCopy(newhead, header);
1.17      frystyk   973:        if (!me->extra_headers)
                    974:            me->extra_headers = HTList_new();
1.18      frystyk   975:        HTList_addObject(me->extra_headers, (void *) newhead);
1.17      frystyk   976:     }
1.2       timbl     977: }
                    978: 
1.23      frystyk   979: /*
                    980: **     Has header been parsed?
1.2       timbl     981: */
1.35      frystyk   982: PUBLIC BOOL HTAnchor_headerParsed (HTParentAnchor * me)
1.2       timbl     983: {
1.17      frystyk   984:     return (me ? me->header_parsed : NO);
1.23      frystyk   985: }
                    986: 
1.35      frystyk   987: PUBLIC void HTAnchor_setHeaderParsed (HTParentAnchor * me)
1.23      frystyk   988: {
                    989:     if (me) me->header_parsed = YES;
1.2       timbl     990: }
                    991: 
1.17      frystyk   992: /*     Clear Header Information
                    993: **     ------------------------
                    994: */
1.35      frystyk   995: PUBLIC void HTAnchor_clearHeader (HTParentAnchor * me)
1.2       timbl     996: {
1.17      frystyk   997:     me->methods = METHOD_INVALID;
1.48      frystyk   998:     if (me->content_encoding) {
                    999:        HTList_delete(me->content_encoding);
                   1000:        me->content_encoding = HTList_new();
                   1001:     }
1.17      frystyk  1002:     if (me->content_language) {
                   1003:        HTList_delete(me->content_language);
                   1004:        me->content_language = HTList_new();
1.9       frystyk  1005:     }
1.51      frystyk  1006:     HT_FREE(me->content_base);
                   1007:     HT_FREE(me->content_location);
1.17      frystyk  1008:     me->content_length = -1;                                     /* Invalid */
1.48      frystyk  1009:     me->transfer = NULL;
1.57    ! frystyk  1010: 
        !          1011:     /* Clear the content type */
1.17      frystyk  1012:     me->content_type = WWW_UNKNOWN;
1.52      frystyk  1013:     if (me->type_parameters) {
                   1014:        HTAssocList_delete(me->type_parameters);
                   1015:        me->type_parameters = NULL;
                   1016:     }    
1.57    ! frystyk  1017: 
        !          1018:     /* Dates etc. */
1.28      frystyk  1019:     me->date = (time_t) -1;
                   1020:     me->expires = (time_t) -1;
                   1021:     me->last_modified = (time_t) -1;
1.17      frystyk  1022:     
1.43      frystyk  1023:     HT_FREE(me->derived_from);
                   1024:     HT_FREE(me->version);
1.18      frystyk  1025: 
                   1026:     if (me->extra_headers) {
                   1027:        HTList *cur = me->extra_headers;
                   1028:        char *pres;
                   1029:        while ((pres = (char *) HTList_nextObject(cur)))
1.43      frystyk  1030:            HT_FREE(pres);
1.18      frystyk  1031:        HTList_delete(me->extra_headers);
                   1032:        me->extra_headers = NULL;
                   1033:     }
1.17      frystyk  1034:     me->header_parsed = NO;                                  /* All cleared */
1.1       timbl    1035: }

Webmaster