Annotation of libwww/Library/src/HTBind.c, revision 2.31

2.22      frystyk     1: /*                                                                  Htbind.c
2.1       frystyk     2: **     FILE SUFFIX BIND MANAGER
                      3: **
                      4: **     (c) COPYRIGHT MIT 1995
                      5: **     Please first read the full copyright statement in the file COPYRIGH.
2.31    ! frystyk     6: **     @(#) $Id: HTBind.c,v 2.30 1998/10/20 13:11:59 frystyk Exp $
2.1       frystyk     7: **
                      8: **     This module sets up the binding between a file Bind and a media
                      9: **     type, language, encoding etc. In a client application the Binds
                     10: **     are used in protocols that does not support media types etc., like
                     11: **     FTP, and in server applications they are used to make the bindings
                     12: **     between the server and the local file store that the server can
                     13: **     serve to the rest of the world (well almost). The HTFormat module
                     14: **     holds this information against the accept headers received in a
                     15: **     request and uses if for format negotiation. All the binding management
                     16: **     can all be replace by a database interface. 
                     17: **
                     18: ** History:
                     19: **        Feb 91       Written Tim Berners-Lee CERN/CN
                     20: **        Apr 91       vms-vms access included using DECnet syntax
                     21: **     26 Jun 92 (JFG) When running over DECnet, suppressed FTP.
                     22: **                     Fixed access bug for relative names on VMS.
                     23: **        Sep 93 (MD)  Access to VMS files allows sharing.
                     24: **     15 Nov 93 (MD)  Moved HTVMSname to HTVMSUTILS.C
                     25: **     22 Feb 94 (MD)  Excluded two routines if we are not READING directories
                     26: **     18 May 94 (HF)  Directory stuff removed and stream handling updated,
                     27: **                     error messages introduced etc.
                     28: **     10 Maj 95 HF    Spawned off from HTFile in order to make it easier to
                     29: **                     override by a new module. It's now based on anchors
                     30: **                     and hash tables
                     31: ** Bugs:
                     32: */
                     33: 
                     34: /* Library Includes */
2.26      frystyk    35: #include "wwwsys.h"
2.21      frystyk    36: #include "WWWUtil.h"
2.24      frystyk    37: #include "HTAnchor.h"
                     38: #include "HTResponse.h"
2.1       frystyk    39: #include "HTParse.h"
                     40: #include "HTBind.h"                                     /* Implemented here */
                     41: 
                     42: typedef struct _HTBind {
                     43:     char *     suffix;
                     44:     HTFormat   type;                   /* Content-Type */
                     45:     HTEncoding encoding;               /* Content-Encoding */
2.22      frystyk    46:     HTEncoding transfer;               /* Content-Transfer-Encoding */
2.1       frystyk    47:     HTLanguage language;               /* Content-Language */
                     48:     double     quality;
                     49: } HTBind;
                     50: 
                     51: /* Suffix registration */
                     52: PRIVATE BOOL HTCaseSen = YES;                /* Are suffixes case sensitive */
                     53: PRIVATE char *HTDelimiters = NULL;                       /* Set of suffixes */
                     54: 
                     55: PRIVATE HTList **HTBindings = NULL;   /* Point to table of lists of bindings */
                     56: 
2.21      frystyk    57: PRIVATE HTBind no_suffix = { "*", NULL, NULL, NULL, NULL, 0.5 };
                     58: PRIVATE HTBind unknown_suffix = { "*.*", NULL, NULL, NULL, NULL, 0.5 };
2.1       frystyk    59: 
                     60: /* ------------------------------------------------------------------------- */
                     61: 
                     62: /*     
                     63: **     Set up the list of suffix bindings. Done by HTLibInit
                     64: */
2.11      frystyk    65: PUBLIC BOOL HTBind_init (void)
2.1       frystyk    66: {
2.8       frystyk    67:     if (!HTBindings) {
2.31    ! frystyk    68:        if (!(HTBindings = (HTList **) HT_CALLOC(HT_L_HASH_SIZE, sizeof(HTList *))))
2.17      frystyk    69:            HT_OUTOFMEM("HTBind_init");
2.8       frystyk    70:     }
2.1       frystyk    71:     StrAllocCopy(HTDelimiters, DEFAULT_SUFFIXES);
2.15      frystyk    72:     no_suffix.type = WWW_UNKNOWN;
2.25      frystyk    73:     no_suffix.encoding = WWW_CODING_BINARY;
2.15      frystyk    74:     unknown_suffix.type = WWW_UNKNOWN;
2.25      frystyk    75:     unknown_suffix.encoding = WWW_CODING_BINARY;
2.1       frystyk    76:     return YES;
                     77: }
                     78: 
                     79: 
                     80: /*
                     81: **     Cleans up the memory allocated by file bindings
                     82: **     Done by HTLibTerminate().
                     83: **     Written by Eric Sink, eric@spyglass.com, and Henrik
                     84: */
2.11      frystyk    85: PUBLIC BOOL HTBind_deleteAll (void)
2.1       frystyk    86: {
                     87:     int cnt;
                     88:     HTList *cur;
                     89:     if (!HTBindings)
                     90:        return NO;
2.31    ! frystyk    91:     for (cnt=0; cnt<HT_L_HASH_SIZE; cnt++) {
2.1       frystyk    92:        if ((cur = HTBindings[cnt])) { 
                     93:            HTBind *pres;
                     94:            while ((pres = (HTBind *) HTList_nextObject(cur)) != NULL) {
2.17      frystyk    95:                HT_FREE(pres->suffix);
                     96:                HT_FREE(pres);
2.1       frystyk    97:            }
                     98:        }
                     99:        HTList_delete(HTBindings[cnt]);
                    100:        HTBindings[cnt] = NULL;
                    101:     }
2.19      frystyk   102:     HT_FREE(HTBindings);
2.17      frystyk   103:     HT_FREE(HTDelimiters);
2.1       frystyk   104:     return YES;
                    105: }
                    106: 
                    107: 
                    108: /*     Make suffix bindings case sensitive
                    109: **     -----------------------------------
                    110: */
2.11      frystyk   111: PUBLIC void HTBind_caseSensitive (BOOL sensitive)
2.1       frystyk   112: {
                    113:     HTCaseSen = sensitive;
                    114: }
                    115: 
                    116: 
                    117: /*     Get set of suffixes
                    118: **     -------------------
                    119: */
2.20      frystyk   120: PUBLIC const char *HTBind_delimiters (void)
2.1       frystyk   121: {
                    122:     return HTDelimiters;
                    123: }
                    124: 
                    125: 
                    126: /*     Change set of suffixes
                    127: **     ----------------------
                    128: */
2.20      frystyk   129: PUBLIC void HTBind_setDelimiters (const char * new_suffixes)
2.1       frystyk   130: {
                    131:     if (new_suffixes && *new_suffixes)
                    132:        StrAllocCopy(HTDelimiters, new_suffixes);
                    133: }
                    134: 
                    135: 
                    136: /*     Define the representation associated with a file suffix
                    137: **     -------------------------------------------------------
                    138: **
                    139: **     Calling this with suffix set to "*" will set the default
                    140: **     representation.
                    141: **     Calling this with suffix set to "*.*" will set the default
                    142: **     representation for unknown suffix files which contain a "."
                    143: **
                    144: **     If filename suffix is already defined its previous
                    145: **     definition is overridden (or modified)
                    146: */
2.20      frystyk   147: PUBLIC BOOL HTBind_addType (const char *       suffix,
                    148:                            const char *        representation,
2.12      frystyk   149:                            double              value)
2.1       frystyk   150: {
2.21      frystyk   151:     return HTBind_add(suffix, representation, NULL, NULL, NULL, value);
2.1       frystyk   152: }
                    153: 
2.20      frystyk   154: PUBLIC BOOL HTBind_addEncoding (const char *   suffix,
                    155:                                const char *    encoding,
2.11      frystyk   156:                                double          value)
2.1       frystyk   157: {
2.21      frystyk   158:     return HTBind_add(suffix, NULL, encoding, NULL, NULL, value);
2.1       frystyk   159: }
                    160: 
2.21      frystyk   161: PUBLIC BOOL HTBind_addTransfer (const char *   suffix,
                    162:                                const char *    transfer,
                    163:                                double          value)
                    164: {
                    165:     return HTBind_add(suffix, NULL, NULL, transfer, NULL, value);
                    166: }
                    167: 
2.20      frystyk   168: PUBLIC BOOL HTBind_addLanguage (const char *   suffix,
                    169:                                const char *    language,
2.11      frystyk   170:                                double          value)
2.1       frystyk   171: {
2.21      frystyk   172:     return HTBind_add(suffix, NULL, NULL, NULL, language, value);
2.1       frystyk   173: }
                    174: 
2.20      frystyk   175: PUBLIC BOOL HTBind_add (const char *   suffix,
                    176:                        const char *    representation,
                    177:                        const char *    encoding,
2.21      frystyk   178:                        const char *    transfer,
2.20      frystyk   179:                        const char *    language,
2.11      frystyk   180:                        double          value)
2.1       frystyk   181: {
                    182:     HTBind * suff;
                    183:     if (!suffix)
                    184:        return NO;
                    185:     if (!strcmp(suffix, "*"))
                    186:        suff = &no_suffix;
                    187:     else if (!strcmp(suffix, "*.*"))
                    188:        suff = &unknown_suffix;
                    189:     else {
2.31    ! frystyk   190:        HTList * suflist;
        !           191:        int hash;
        !           192:        const unsigned char * p;
2.1       frystyk   193: 
                    194:        /* Select list from hash table */
2.31    ! frystyk   195:        for (p=suffix, hash=0; *p; p++) {
        !           196:            hash = (hash * 3 + TOLOWER(*p)) % HT_L_HASH_SIZE;
        !           197:        }
2.1       frystyk   198: 
                    199:        if (!HTBindings[hash]) HTBindings[hash] = HTList_new();
                    200:        suflist = HTBindings[hash];
                    201: 
                    202:        /* Look for existing binding */
                    203:        {
                    204:            HTList *cur = suflist;
                    205:            while ((suff = (HTBind *) HTList_nextObject(cur)) != NULL) {
                    206:                if (!strcmp(suff->suffix, suffix))
                    207:                    break;
                    208:            }
                    209:        }
                    210: 
                    211:        /* If not found -- create a new node */
                    212:        if (!suff) {
2.17      frystyk   213:            if ((suff = (HTBind *) HT_CALLOC(1, sizeof(HTBind))) == NULL)
                    214:                HT_OUTOFMEM("HTBind_add");
2.1       frystyk   215:            HTList_addObject(suflist, (void *) suff);
                    216:            StrAllocCopy(suff->suffix, suffix);
                    217:        }
                    218:     }
                    219: 
                    220:     /* Set the appropriate values */
                    221:     {
2.21      frystyk   222:        HTChunk * chunk = HTChunk_new(32);
2.1       frystyk   223:        char *ptr;
                    224:        if (representation) {
2.21      frystyk   225:            HTChunk_puts(chunk, representation);
                    226:            ptr = HTChunk_data(chunk);
                    227:            for (; *ptr; ptr++)
2.1       frystyk   228:                *ptr = TOLOWER(*ptr);
2.21      frystyk   229:            suff->type = HTAtom_for(HTChunk_data(chunk));
                    230:            HTChunk_clear(chunk);
2.1       frystyk   231:        }
2.21      frystyk   232:        if (encoding) {
                    233:            HTChunk_puts(chunk, encoding);
                    234:            ptr = HTChunk_data(chunk);
                    235:            for (; *ptr; ptr++)
2.1       frystyk   236:                *ptr = TOLOWER(*ptr);
2.21      frystyk   237:            suff->encoding = HTAtom_for(HTChunk_data(chunk));
                    238:            HTChunk_clear(chunk);
2.1       frystyk   239:        }
2.21      frystyk   240:        if (transfer) {
                    241:            HTChunk_puts(chunk, transfer);
                    242:            ptr = HTChunk_data(chunk);
                    243:            for (; *ptr; ptr++)
2.1       frystyk   244:                *ptr = TOLOWER(*ptr);
2.21      frystyk   245:            suff->transfer = HTAtom_for(HTChunk_data(chunk));
                    246:            HTChunk_clear(chunk);
2.1       frystyk   247:        }
2.21      frystyk   248:        if (language) {
                    249:            HTChunk_puts(chunk, language);
                    250:            ptr = HTChunk_data(chunk);
                    251:            for (; *ptr; ptr++)
                    252:                *ptr = TOLOWER(*ptr);
                    253:            suff->language = HTAtom_for(HTChunk_data(chunk));
                    254:            HTChunk_clear(chunk);
                    255:        }
                    256:        HTChunk_delete(chunk);
2.1       frystyk   257:        suff->quality = value;
                    258:     }
                    259:     return YES;
                    260: }
                    261: 
                    262: 
                    263: /*     Determine a suitable suffix
                    264: **     ---------------------------
                    265: **  Use the set of bindings to find a suitable suffix (or index)
                    266: **  for a certain combination of language, media type and encoding
                    267: **  given in the anchor.
                    268: **
2.21      frystyk   269: **  Returns a pointer to a suitable suffix string that must be freed 
2.1       frystyk   270: **  by the caller. If more than one suffix is found they are all
                    271: **  concatenated using the first delimiter in HTDelimiters.
                    272: **  If no suffix is found, NULL is returned.
                    273: */
2.11      frystyk   274: PUBLIC char * HTBind_getSuffix (HTParentAnchor * anchor)
2.1       frystyk   275: {
                    276:     int cnt;
2.23      frystyk   277:     HTList * cur;
                    278:     HTChunk * suffix = HTChunk_new(48);
                    279:     char delimiter = *HTDelimiters;
2.30      frystyk   280:     char * ct=NULL, * ce=NULL, * cl=NULL;
2.24      frystyk   281:     HTFormat format = HTAnchor_format(anchor);
                    282:     HTList * encoding = HTAnchor_encoding(anchor);
                    283:     HTList * language = HTAnchor_language(anchor);
2.1       frystyk   284:     if (anchor) {
2.31    ! frystyk   285:        for (cnt=0; cnt<HT_L_HASH_SIZE; cnt++) {
2.1       frystyk   286:            if ((cur = HTBindings[cnt])) { 
                    287:                HTBind *pres;
2.21      frystyk   288:                while ((pres = (HTBind *) HTList_nextObject(cur))) {
2.24      frystyk   289:                    if (!ct && (pres->type && pres->type == format)){
2.30      frystyk   290:                        ct = pres->suffix;
2.24      frystyk   291:                    } else if (!ce && pres->encoding && encoding) {
2.30      frystyk   292:                        HTList * cur_enc = encoding;
                    293:                        HTEncoding pres_enc;
                    294:                        while ((pres_enc = (HTEncoding) HTList_nextObject(cur_enc))) {
                    295:                            if (pres_enc == pres->encoding) {
                    296:                                ce = pres->suffix;
                    297:                                break;
                    298:                            }
                    299:                        }
2.24      frystyk   300:                    } else if (!cl && pres->language && language) {
2.30      frystyk   301:                        HTList * cur_lang = language;
                    302:                        HTLanguage pres_lang;
                    303:                        while ((pres_lang = (HTLanguage) HTList_nextObject(cur_lang))) {
                    304:                            if (pres_lang == pres->language) {
                    305:                                cl = pres->suffix;
                    306:                                break;
                    307:                            }
                    308:                        }
2.1       frystyk   309:                    }
                    310:                }
                    311:            }
2.30      frystyk   312:        }
                    313: 
                    314:        /* Put the found suffixes together */
                    315:        if (ct) {
                    316:            HTChunk_putc(suffix, delimiter);
                    317:            HTChunk_puts(suffix, ct);
                    318:        }
                    319:        if (ce) {
                    320:            HTChunk_putc(suffix, delimiter);
                    321:            HTChunk_puts(suffix, ce);
                    322:        }
                    323:        if (cl) {
                    324:            HTChunk_putc(suffix, delimiter);
                    325:            HTChunk_puts(suffix, cl);
2.1       frystyk   326:        }
                    327:     }
2.23      frystyk   328:     return HTChunk_toCString(suffix);
2.1       frystyk   329: }
                    330: 
2.24      frystyk   331: /*
2.1       frystyk   332: **  Use the set of bindings to find the combination of language,
2.24      frystyk   333: **  media type and encoding of a given object. This information can either be
                    334: **  stored in the anchor obejct or in the response object depending on which
                    335: **  function is called.
2.1       frystyk   336: **
2.21      frystyk   337: **  We comprise here as bindings only can have one language and one encoding.
2.1       frystyk   338: **  If more than one suffix is found they are all searched. The last suffix
                    339: **  has highest priority, the first one lowest. See also HTBind_getFormat()
                    340: */
2.24      frystyk   341: PUBLIC BOOL HTBind_getAnchorBindings (HTParentAnchor * anchor)
2.1       frystyk   342: {
                    343:     BOOL status = NO;
                    344:     double quality=1.0;                  /* @@@ Should we add this into the anchor? */
                    345:     if (anchor) {
2.28      frystyk   346:        char *addr = HTAnchor_address((HTAnchor *) anchor);
2.1       frystyk   347:        char *path = HTParse(addr, "", PARSE_PATH+PARSE_PUNCTUATION);
2.9       frystyk   348:        char *file;
                    349:        char *end;
                    350:        if ((end = strchr(path, ';')) || (end = strchr(path, '?')) ||
                    351:            (end = strchr(path, '#')))
                    352:            *end = '\0';
                    353:        if ((file = strrchr(path, '/'))) {
2.21      frystyk   354:            HTFormat format = NULL;
                    355:            HTEncoding encoding = NULL;
2.22      frystyk   356:            HTEncoding transfer = NULL;
2.21      frystyk   357:            HTLanguage language = NULL;
2.24      frystyk   358:            if (BIND_TRACE) HTTrace("Anchor...... Get bindings for `%s\'\n", path);
2.22      frystyk   359:            status = HTBind_getFormat(file, &format, &encoding, &transfer,
2.21      frystyk   360:                                      &language, &quality);
                    361:            if (status) {
                    362:                HTAnchor_setFormat(anchor, format);
2.25      frystyk   363:                HTAnchor_setContentTransferEncoding(anchor, transfer);
2.29      frystyk   364: 
                    365:                 HTAnchor_deleteEncodingAll(anchor);
                    366:                 HTAnchor_addEncoding(anchor, encoding);
                    367: 
                    368:                 HTAnchor_deleteLanguageAll(anchor);
                    369:                 HTAnchor_addLanguage(anchor, language);
2.21      frystyk   370:            }
2.1       frystyk   371:        }
2.27      frystyk   372:         HT_FREE(addr);
                    373:         HT_FREE(path);
2.1       frystyk   374:     }
                    375:     return status;
                    376: }
                    377: 
2.24      frystyk   378: PUBLIC BOOL HTBind_getResponseBindings (HTResponse * response, const char * url)
                    379: {
                    380:     BOOL status = NO;
                    381:     double quality = 1.0;
                    382:     if (response) {
                    383:        char * path = HTParse(url, "", PARSE_PATH + PARSE_PUNCTUATION);
                    384:        char * file;
                    385:        char * end;
                    386:        if ((end = strchr(path, ';')) || (end = strchr(path, '?')) ||
                    387:            (end = strchr(path, '#')))
                    388:            *end = '\0';
                    389:        if ((file = strrchr(path, '/'))) {
                    390:            HTFormat format = NULL;
                    391:            HTEncoding encoding = NULL;
                    392:            HTEncoding transfer = NULL;
                    393:            HTLanguage language = NULL;
                    394:            if (BIND_TRACE) HTTrace("Response.... Get Bindings for `%s\'\n", path);
                    395:            status = HTBind_getFormat(file, &format, &encoding, &transfer,
                    396:                                      &language, &quality);
                    397:            if (status) {
                    398:                HTResponse_setFormat(response, format);
2.25      frystyk   399:                HTResponse_setContentTransferEncoding(response, transfer);
2.24      frystyk   400:                HTResponse_addEncoding(response, encoding);
                    401: #if 0
                    402:                HTResponse_addLanguage(response, language);
                    403: #endif
                    404:            }
                    405:        }
                    406:        HT_FREE(path);
                    407:     }
                    408:     return status;
                    409: }
2.1       frystyk   410: 
                    411: /*     Determine the content of an file name
                    412: **     -------------------------------------
                    413: **  Use the set of bindings to find the combination of language,
2.21      frystyk   414: **  media type, encoding, and transfer encoding  of a given anchor.
2.1       frystyk   415: **  If more than one suffix is found they are all searched. The last suffix
                    416: **  has highest priority, the first one lowest. See also HTBind_getBindings()
2.10      frystyk   417: **  Either of format, encoding, or language can be NULL
2.1       frystyk   418: **  Returns the format, encoding, and language found
                    419: */
2.21      frystyk   420: PUBLIC BOOL HTBind_getFormat (const char *     filename,
                    421:                              HTFormat *        format,
                    422:                              HTEncoding *      enc,
2.22      frystyk   423:                              HTEncoding *      cte,
2.21      frystyk   424:                              HTLanguage *      lang,
                    425:                              double *          quality)
2.1       frystyk   426: {
                    427:     int sufcnt=0;
                    428:     char *file=NULL;
2.6       frystyk   429: #ifdef HT_REENTRANT
                    430:     char *lasts;                                            /* For strtok_r */
                    431: #endif
2.1       frystyk   432:     if (*quality < HT_EPSILON)
                    433:        *quality = 1.0;                            /* Set to a neutral value */
                    434:     StrAllocCopy(file, filename);
                    435:     HTUnEscape(file);                             /* Unescape the file name */
2.6       frystyk   436: #ifdef HT_REENTRANT
                    437:     if (strtok_r(file, HTDelimiters, &lasts)) {         /* Do we have any suffixes? */
                    438: #else
2.1       frystyk   439:     if (strtok(file, HTDelimiters)) {           /* Do we have any suffixes? */
2.6       frystyk   440: #endif /* HT_REENTRANT */
2.1       frystyk   441:        char *suffix;
2.6       frystyk   442: #ifdef HT_REENTRANT
                    443:        while ((suffix=(char*)strtok_r(NULL, HTDelimiters, &lasts)) != NULL) {
                    444: #else
                    445:        while ((suffix=strtok(NULL, HTDelimiters)) != NULL) {
                    446: #endif /* HT_REENTRANT */
2.1       frystyk   447:            HTBind *suff=NULL;
2.31    ! frystyk   448:            int hash;
        !           449:            unsigned char * p;
        !           450:            if (BIND_TRACE) HTTrace("Get Binding. Look for '%s\' ", suffix);
2.1       frystyk   451:            sufcnt++;
                    452: 
                    453:            /* Select list from hash table */
2.31    ! frystyk   454:            for (p=suffix, hash=0; *p; p++) {
        !           455:                hash = (hash * 3 + TOLOWER(*p)) % HT_L_HASH_SIZE;
        !           456:            }
2.1       frystyk   457: 
                    458:            /* Now search list for entries (case or non case sensitive) */
                    459:            if (HTBindings[hash]) {
                    460:                HTList *cur = HTBindings[hash];
                    461:                while ((suff = (HTBind *) HTList_nextObject(cur))) {
                    462:                    if ((HTCaseSen && !strcmp(suff->suffix, suffix)) ||
                    463:                        !strcasecomp(suff->suffix, suffix)) {
2.18      eric      464:                        if (BIND_TRACE) HTTrace("Found!\n");
2.10      frystyk   465:                        if (suff->type && format) *format = suff->type;
                    466:                        if (suff->encoding && enc) *enc = suff->encoding;
2.22      frystyk   467:                        if (suff->transfer && cte) *cte = suff->transfer;
2.10      frystyk   468:                        if (suff->language && lang) *lang = suff->language;
2.1       frystyk   469:                        if (suff->quality > HT_EPSILON)
                    470:                            *quality *= suff->quality;
                    471:                        break;
                    472:                    }
                    473:                }
                    474:            }
                    475:            if (!suff) {        /* We don't have this suffix - use default */
                    476:                if (BIND_TRACE)
2.18      eric      477:                    HTTrace("Not found - use default for \'*.*\'\n");
2.10      frystyk   478:                if (format) *format = unknown_suffix.type;
                    479:                if (enc) *enc = unknown_suffix.encoding;
2.21      frystyk   480:                if (cte) *cte = unknown_suffix.transfer;
2.10      frystyk   481:                if (lang) *lang = unknown_suffix.language;
2.1       frystyk   482:                *quality = unknown_suffix.quality;
                    483:            }
                    484:        } /* while we still have suffixes */
                    485:     }
                    486:     if (!sufcnt) {             /* No suffix so use default value */
                    487:        if (BIND_TRACE)
2.18      eric      488:            HTTrace("Get Binding. No suffix found - using default '%s\'\n", filename);
2.10      frystyk   489:        if (format) *format = no_suffix.type;
                    490:        if (enc) *enc = no_suffix.encoding;
2.21      frystyk   491:        if (cte) *cte = no_suffix.transfer;
2.10      frystyk   492:        if (lang) *lang = no_suffix.language;
2.1       frystyk   493:        *quality = no_suffix.quality;
                    494:     }
                    495:     if (BIND_TRACE)
2.21      frystyk   496:        HTTrace("Get Binding. Result for '%s\' is: type='%s\', encoding='%s\', cte='%s\', language='%s\' with quality %.2f\n",
2.1       frystyk   497:                filename,
2.10      frystyk   498:                (format && *format) ? HTAtom_name(*format) : "unknown",
                    499:                (enc && *enc) ? HTAtom_name(*enc) : "unknown",
2.21      frystyk   500:                (cte && *cte) ? HTAtom_name(*cte) : "unknown",
2.10      frystyk   501:                (lang && *lang) ? HTAtom_name(*lang) : "unknown",
2.1       frystyk   502:                *quality);
2.17      frystyk   503:     HT_FREE(file);
2.1       frystyk   504:     return YES;
                    505: }
                    506: 

Webmaster