home *** CD-ROM | disk | FTP | other *** search
/ Collection of Internet / Collection of Internet.iso / infosrvr / src / diffs / wwwlibr0.dif next >
Encoding:
Text File  |  1993-11-04  |  83.0 KB  |  2,891 lines

  1. *** ../../../../2.12/WWW/Library/Implementation/CommonMakefile    Tue Oct  5 10:47:23 1993
  2. --- CommonMakefile    Mon Oct 11 14:46:29 1993
  3. ***************
  4. *** 172,177 ****
  5. --- 172,179 ----
  6.       (cd $(WWW)/..; WWW=WWW ABS=`pwd`/ make $(MFLAGS) \
  7.           -f WWW/Library/Implementation/CommonMakefile \
  8.           /pub/www/src/WWWLibrary_$(VC).tar.Z)
  9. +     (cd ../Implementation; cvs tag \
  10. +         `sed -e 's/VC = /v/' Version.make | sed -e 's?\.?/?'` )
  11.       echo Distribution of Library version $(VC) up to date.
  12.   
  13.   /pub/www/src/WWWLibrary_$(VC).tar.Z : $(SOURCES)
  14. *** ../../../../2.12/WWW/Library/Implementation/HTAABrow.c    Thu Oct  7 14:42:12 1993
  15. --- HTAABrow.c    Wed Nov  3 16:20:18 1993
  16. ***************
  17. *** 35,42 ****
  18.   **    AL    Ari Luotonen    luotonen@dxcern.cern.ch
  19.   **
  20.   ** HISTORY:
  21. ! **
  22. ! **
  23.   ** BUGS:
  24.   **
  25.   **
  26. --- 35,47 ----
  27.   **    AL    Ari Luotonen    luotonen@dxcern.cern.ch
  28.   **
  29.   ** HISTORY:
  30. ! **    Oct 17    AL    Made corrections suggested by marca:
  31. ! **            Added  if (!realm->username) return NULL;
  32. ! **            Changed some ""s to NULLs.
  33. ! **            Now doing calloc() to init uuencode source;
  34. ! **            otherwise HTUU_encode() reads uninitialized memory
  35. ! **            every now and then (not a real bug but not pretty).
  36. ! **            Corrected the formula for uuencode destination size.
  37.   ** BUGS:
  38.   **
  39.   **
  40. ***************
  41. *** 113,123 ****
  42. --- 118,156 ----
  43.                                           /* connect.                 */
  44.   PRIVATE char *current_docname    = NULL;    /* The document's name we are        */
  45.                                           /* trying to access.             */
  46. + PRIVATE char *HTAAForwardAuth    = NULL;    /* Authorization: line to forward    */
  47. +                                         /* (used by gateway httpds)         */
  48.   
  49.   
  50. + /*** HTAAForwardAuth for enabling gateway-httpds to forward Authorization ***/
  51.   
  52. + PUBLIC void HTAAForwardAuth_set ARGS2(CONST char *, scheme_name,
  53. +                       CONST char *, scheme_specifics)
  54. + {
  55. +     int len = 20 + (scheme_name      ? strlen(scheme_name)      : 0) 
  56. +              + (scheme_specifics ? strlen(scheme_specifics) : 0);
  57.   
  58. +     FREE(HTAAForwardAuth);
  59. +     if (!(HTAAForwardAuth = (char*)malloc(len)))
  60. +     outofmem(__FILE__, "HTAAForwardAuth_set");
  61.   
  62. +     strcpy(HTAAForwardAuth, "Authorization: ");
  63. +     if (scheme_name) {
  64. +     strcat(HTAAForwardAuth, scheme_name);
  65. +     strcat(HTAAForwardAuth, " ");
  66. +     if (scheme_specifics) {
  67. +         strcat(HTAAForwardAuth, scheme_specifics);
  68. +     }
  69. +     }
  70. + }
  71. + PUBLIC void HTAAForwardAuth_reset NOARGS
  72. + {
  73. +     FREE(HTAAForwardAuth);
  74. + }
  75.   /**************************** HTAAServer ***********************************/
  76.   
  77.   
  78. ***************
  79. *** 489,494 ****
  80. --- 522,528 ----
  81.   **            (with, of course, a newly generated secret
  82.   **            key and fresh timestamp, if Pubkey-scheme
  83.   **            is being used).
  84. + **            NULL, if something fails.
  85.   ** NOTE:
  86.   **    Like throughout the entire AA package, no string or structure
  87.   **    returned by AA package needs to (or should) be freed.
  88. ***************
  89. *** 514,523 ****
  90.       if ((scheme != HTAA_BASIC && scheme != HTAA_PUBKEY) || !setup ||
  91.       !setup->scheme_specifics || !setup->scheme_specifics[scheme] ||
  92.       !setup->server  ||  !setup->server->realms)
  93. !     return "";
  94.   
  95.       realmname = HTAssocList_lookup(setup->scheme_specifics[scheme], "realm");
  96. !     if (!realmname) return "";
  97.   
  98.       realm = HTAARealm_lookup(setup->server->realms, realmname);
  99.       if (!realm || setup->retry) {
  100. --- 548,557 ----
  101.       if ((scheme != HTAA_BASIC && scheme != HTAA_PUBKEY) || !setup ||
  102.       !setup->scheme_specifics || !setup->scheme_specifics[scheme] ||
  103.       !setup->server  ||  !setup->server->realms)
  104. !     return NULL;
  105.   
  106.       realmname = HTAssocList_lookup(setup->scheme_specifics[scheme], "realm");
  107. !     if (!realmname) return NULL;
  108.   
  109.       realm = HTAARealm_lookup(setup->server->realms, realmname);
  110.       if (!realm || setup->retry) {
  111. ***************
  112. *** 529,550 ****
  113.                      "not found -- creating");
  114.           realm = HTAARealm_new(setup->server->realms, realmname, NULL,NULL);
  115.           sprintf(msg,
  116. !             "Document is protected. Enter username for %s at %s: ",
  117.               realm->realmname,
  118.               setup->server->hostname ? setup->server->hostname : "??");
  119. -         realm->username =
  120. -         HTPrompt(msg, realm->username);
  121.       }
  122.       else {
  123. !         sprintf(msg,"Enter username for %s at %s: ", realm->realmname,
  124.               setup->server->hostname ? setup->server->hostname : "??");
  125. -         username = HTPrompt(msg, realm->username);
  126. -         FREE(realm->username);
  127. -         realm->username = username;
  128.       }
  129. !     password = HTPromptPassword("Enter password: ");
  130.       FREE(realm->password);
  131.       realm->password = password;
  132.       }
  133.       
  134.       len = strlen(realm->username ? realm->username : "") +
  135. --- 563,588 ----
  136.                      "not found -- creating");
  137.           realm = HTAARealm_new(setup->server->realms, realmname, NULL,NULL);
  138.           sprintf(msg,
  139. !             "Document is protected. Enter username for %s at %s",
  140.               realm->realmname,
  141.               setup->server->hostname ? setup->server->hostname : "??");
  142.       }
  143.       else {
  144. !         sprintf(msg,"Enter username for %s at %s", realm->realmname,
  145.               setup->server->hostname ? setup->server->hostname : "??");
  146.       }
  147. !     username = realm->username;
  148. !     password = NULL;
  149. !     HTPromptUsernameAndPassword(msg, &username, &password);
  150. !     FREE(realm->username);
  151.       FREE(realm->password);
  152. +     realm->username = username;
  153.       realm->password = password;
  154. +     if (!realm->username)
  155. +         return NULL;        /* Suggested by marca; thanks! */
  156.       }
  157.       
  158.       len = strlen(realm->username ? realm->username : "") +
  159. ***************
  160. *** 561,567 ****
  161.       else
  162.       FREE(secret_key);
  163.   
  164. !     if (!(cleartext  = (char*)malloc(len)))
  165.       outofmem(__FILE__, "compose_auth_string");
  166.   
  167.       if (realm->username) strcpy(cleartext, realm->username);
  168. --- 599,605 ----
  169.       else
  170.       FREE(secret_key);
  171.   
  172. !     if (!(cleartext  = (char*)calloc(len, 1)))
  173.       outofmem(__FILE__, "compose_auth_string");
  174.   
  175.       if (realm->username) strcpy(cleartext, realm->username);
  176. ***************
  177. *** 590,596 ****
  178.       free(ciphertext);
  179.       }
  180.       else { /* scheme == HTAA_BASIC */
  181. !     if (!(result = (char*)malloc(len + len/2)))
  182.           outofmem(__FILE__, "compose_auth_string");
  183.       HTUU_encode(cleartext, strlen(cleartext), result);
  184.       free(cleartext);
  185. --- 628,634 ----
  186.       free(ciphertext);
  187.       }
  188.       else { /* scheme == HTAA_BASIC */
  189. !     if (!(result = (char*)malloc(4 * ((len+2)/3) + 1)))
  190.           outofmem(__FILE__, "compose_auth_string");
  191.       HTUU_encode(cleartext, strlen(cleartext), result);
  192.       free(cleartext);
  193. ***************
  194. *** 661,666 ****
  195. --- 699,721 ----
  196.       BOOL retry;
  197.       HTAAScheme scheme;
  198.   
  199. +     /*
  200. +     ** Make gateway httpds pass authorization field as it was received.
  201. +     ** (This still doesn't really work because Authenticate: headers
  202. +     **  from remote server are not forwarded to client yet so it cannot
  203. +     **  really know that it should send authorization;  I will not
  204. +     **  implement it yet because I feel we will soon change radically
  205. +     **  the way requests are represented to allow multithreading
  206. +     **  on server-side.  Life is hard.)
  207. +     */
  208. +     if (HTAAForwardAuth) {
  209. +     if (TRACE) fprintf(stderr, "HTAA_composeAuth: %s\n",
  210. +                "Forwarding received authorization");
  211. +     StrAllocCopy(result, HTAAForwardAuth);
  212. +     HTAAForwardAuth_reset();    /* Just a precaution */
  213. +     return result;
  214. +     }
  215.       FREE(result);            /* From previous call */
  216.   
  217.       if (TRACE)
  218. ***************
  219. *** 707,718 ****
  220.               "This client doesn't know how to compose authentication",
  221.               "information for scheme", HTAAScheme_name(scheme));
  222.           HTAlert(msg);
  223. !         auth_string = "";
  224.       }
  225.       } /* switch scheme */
  226.   
  227.       current_setup->retry = NO;
  228.   
  229.       if (!(result = (char*)malloc(sizeof(char) * (strlen(auth_string)+40))))
  230.       outofmem(__FILE__, "HTAA_composeAuth");
  231.       strcpy(result, "Authorization: ");
  232. --- 762,777 ----
  233.               "This client doesn't know how to compose authentication",
  234.               "information for scheme", HTAAScheme_name(scheme));
  235.           HTAlert(msg);
  236. !         auth_string = NULL;
  237.       }
  238.       } /* switch scheme */
  239.   
  240.       current_setup->retry = NO;
  241.   
  242. +     /* Added by marca. */
  243. +     if (!auth_string)
  244. +     return NULL;
  245. +     
  246.       if (!(result = (char*)malloc(sizeof(char) * (strlen(auth_string)+40))))
  247.       outofmem(__FILE__, "HTAA_composeAuth");
  248.       strcpy(result, "Authorization: ");
  249. ***************
  250. *** 724,730 ****
  251.   
  252.   
  253.   
  254. !         
  255.   /* BROWSER PUBLIC                HTAA_shouldRetryWithAuth()
  256.   **
  257.   **        DETERMINES IF WE SHOULD RETRY THE SERVER
  258. --- 783,789 ----
  259.   
  260.   
  261.   
  262.   /* BROWSER PUBLIC                HTAA_shouldRetryWithAuth()
  263.   **
  264.   **        DETERMINES IF WE SHOULD RETRY THE SERVER
  265. *** ../../../../2.12/WWW/Library/Implementation/HTAABrow.h    Tue Oct  5 10:48:54 1993
  266. --- HTAABrow.h    Wed Nov  3 16:28:43 1993
  267. ***************
  268. *** 113,118 ****
  269. --- 113,132 ----
  270.                                                int        soc));
  271.   /*
  272.   
  273. + Enabling Gateway httpds to Forward Authorization
  274. +    These functions should only be called from daemon code, and HTAAForwardAuth_reset()
  275. +    must be called before the next request is handled to make sure that authorization
  276. +    string isn't cached in daemon so that other people can access private files using
  277. +    somebody elses previous authorization information.
  278. +    
  279. +  */
  280. + PUBLIC void HTAAForwardAuth_set PARAMS((CONST char * scheme_name,
  281. +                                         CONST char * scheme_specifics));
  282. + PUBLIC void HTAAForwardAuth_reset NOPARAMS;
  283. + /*
  284.    */
  285.   
  286.   #endif  /* NOT HTAABROW_H */
  287. *** ../../../../2.12/WWW/Library/Implementation/HTAAFile.c    Mon Oct  4 20:36:30 1993
  288. --- HTAAFile.c    Wed Oct 13 16:53:40 1993
  289. ***************
  290. *** 28,55 ****
  291.   
  292.   
  293.   /* PUBLIC                        HTAAFile_nextRec()
  294. ! **            GO TO THE BEGINNING OF THE NEXT RECORD
  295.   ** ON ENTRY:
  296.   **    fp    is the file from which records are read from.
  297.   **
  298.   ** ON EXIT:
  299.   **    returns    nothing. File read pointer is located at the beginning
  300. ! **        of the next record.
  301.   **
  302.   */
  303.   PUBLIC void HTAAFile_nextRec ARGS1(FILE *, fp)
  304.   {
  305.       int ch = getc(fp);
  306.   
  307. !     while (ch != EOF  &&  ch != CR  &&  ch != LF)
  308. !     ch = getc(fp);            /* Skip until end-of-line */
  309. !     while (ch != EOF &&
  310. !        (ch == CR  ||  ch == LF))    /*Skip carriage returns and linefeeds*/
  311. !     ch = getc(fp);
  312. !     if (ch != EOF)
  313. !     ungetc(ch, fp);
  314.   }
  315.   
  316.   
  317. --- 28,61 ----
  318.   
  319.   
  320.   /* PUBLIC                        HTAAFile_nextRec()
  321. ! **        GO TO THE BEGINNING OF THE NEXT RECORD
  322.   ** ON ENTRY:
  323.   **    fp    is the file from which records are read from.
  324.   **
  325.   ** ON EXIT:
  326.   **    returns    nothing. File read pointer is located at the beginning
  327. ! **        of the next record. Handles continuation lines
  328. ! **        (lines ending in comma indicate a following
  329. ! **        continuation line).
  330.   **
  331.   */
  332.   PUBLIC void HTAAFile_nextRec ARGS1(FILE *, fp)
  333.   {
  334.       int ch = getc(fp);
  335. +     int last = (char)0;
  336.   
  337. !     do {
  338. !     while (ch != EOF  &&  ch != CR  &&  ch != LF) {
  339. !         if (ch != ' '  && ch != '\t')
  340. !         last = ch;        /* Last non-whitespace */
  341. !         ch = getc(fp);        /* Skip until end-of-line */
  342. !     }
  343. !     while (ch != EOF &&
  344. !            (ch == CR  ||  ch == LF))/*Skip carriage returns and linefeeds*/
  345. !         ch = getc(fp);
  346. !     if (ch != EOF)
  347. !         ungetc(ch, fp);
  348. !     } while (last == ',' && ch != EOF);    /* Skip also continuation lines */
  349.   }
  350.   
  351.   
  352. ***************
  353. *** 102,114 ****
  354.       ch = getc(fp);
  355.       } /* while not eol or eof or too many read */
  356.   
  357. -     /* Terminate the string, truncating trailing whitespace off.
  358. -     ** Otherwise (if whitespace would be included), here would
  359. -     ** be *dest='\0'; and  cnt -= ... would be left out.
  360. -     */
  361. -     *end = '\0';
  362. -     cnt -= dest-end;
  363.       if (cnt == max_len)    {
  364.       /* If the field was too long (or exactly maximum) ignore the rest */
  365.       while (ch != FIELD_SEPARATOR &&
  366. --- 108,113 ----
  367. ***************
  368. *** 119,124 ****
  369. --- 118,130 ----
  370.   
  371.       if (ch == CR || ch == LF)
  372.       ungetc(ch, fp);    /* Push back the record separator (NL or LF) */
  373. +     /* Terminate the string, truncating trailing whitespace off.
  374. +     ** Otherwise (if whitespace would be included), here would
  375. +     ** be *dest='\0'; and  cnt -= ... would be left out.
  376. +     */
  377. +     *end = '\0';
  378. +     cnt -= dest-end;
  379.   
  380.       return ch;        /* Return the terminating character */
  381.   }
  382. *** ../../../../2.12/WWW/Library/Implementation/HTAAProt.c    Thu Oct  7 14:42:16 1993
  383. --- HTAAProt.c    Wed Nov  3 16:20:19 1993
  384. ***************
  385. *** 6,13 ****
  386.   **    AL    Ari Luotonen    luotonen@dxcern.cern.ch
  387.   **
  388.   ** HISTORY:
  389. ! **
  390. ! **
  391.   ** BUGS:
  392.   **
  393.   **
  394. --- 6,14 ----
  395.   **    AL    Ari Luotonen    luotonen@dxcern.cern.ch
  396.   **
  397.   ** HISTORY:
  398. ! **    20 Oct 93  AL    Now finds uid/gid for nobody/nogroup by name
  399. ! **            (doesn't use default 65534 right away).
  400. ! **            Also understands negative uids/gids.
  401.   ** BUGS:
  402.   **
  403.   **
  404. ***************
  405. *** 51,56 ****
  406. --- 52,60 ----
  407.   
  408.       if (!s || !*s) return NO;
  409.   
  410. +     if (*cur == '-')
  411. +     cur++;        /* Allow initial minus sign in a number */
  412.       while (*cur) {
  413.       if (*cur < '0' || *cur > '9')
  414.           return NO;
  415. ***************
  416. *** 96,101 ****
  417. --- 100,116 ----
  418.           }
  419.       }
  420.       }
  421. +     /*
  422. +     ** Ok, then let's get uid for nobody.
  423. +     */
  424. +     if (NULL != (pw = getpwnam("nobody"))) {
  425. +     if (TRACE) fprintf(stderr, "HTAA_getUid: Uid for `nobody' is %d\n",
  426. +                pw->pw_uid);
  427. +     return pw->pw_uid;
  428. +     }
  429. +     /*
  430. +     ** Ok, then use default.
  431. +     */
  432.       return 65534;    /* nobody */
  433.   }
  434.   
  435. ***************
  436. *** 135,140 ****
  437. --- 150,166 ----
  438.           }
  439.       }
  440.       }
  441. +     /*
  442. +     ** Ok, then let's get gid for nogroup.
  443. +     */
  444. +     if (NULL != (gr = getgrnam("nogroup"))) {
  445. +     if (TRACE) fprintf(stderr, "HTAA_getGid: Gid for `nogroup' is %d\n",
  446. +                gr->gr_gid);
  447. +     return gr->gr_gid;
  448. +     }
  449. +     /*
  450. +     ** Ok, then use default.
  451. +     */
  452.       return 65534;    /* nogroup */
  453.   }
  454.   
  455. *** ../../../../2.12/WWW/Library/Implementation/HTAAServ.c    Thu Oct  7 14:42:17 1993
  456. --- HTAAServ.c    Wed Nov  3 16:20:20 1993
  457. ***************
  458. *** 111,116 ****
  459. --- 111,123 ----
  460.         case HTAA_SETUP_ERROR:
  461.       return "Forbidden -- server protection setup error";
  462.       break;
  463. +       case HTAA_DOTDOT:
  464. +     return "Forbidden -- URL containing /../ disallowed";
  465. +     break;
  466. +     /*
  467. +     ** It ought to, using an executable script (TBL)
  468. +     ** What do you mean, Tim?? (AL)
  469. +     */
  470.   
  471.       /* 404 cases */
  472.         case HTAA_NOT_FOUND:
  473. ***************
  474. *** 122,127 ****
  475. --- 129,138 ----
  476.       return "AA: Access should be ok but something went wrong"; 
  477.       break;
  478.   
  479. +       case HTAA_OK_GATEWAY:
  480. +     return "AA check bypassed (gatewaying) but something went wrong";
  481. +     break;
  482.       /* Others */
  483.         default:
  484.       return "Access denied -- unable to specify reason (bug)";
  485. ***************
  486. *** 159,164 ****
  487. --- 170,178 ----
  488.         case HTAA_SETUP_ERROR:
  489.       return "SETUP-ERROR";
  490.       break;
  491. +       case HTAA_DOTDOT:
  492. +     return "SLASH-DOT-DOT";
  493. +     break;
  494.   
  495.       /* 404 cases */
  496.         case HTAA_NOT_FOUND:
  497. ***************
  498. *** 169,174 ****
  499. --- 183,191 ----
  500.         case HTAA_OK:
  501.       return "OK";
  502.       break;
  503. +       case HTAA_OK_GATEWAY:
  504. +     return "OK-GATEWAY";
  505. +     break;
  506.   
  507.       /* Others */
  508.         default:
  509. ***************
  510. *** 427,443 ****
  511.       if (keywords) *keywords = (char)0;    /* Chop off keywords */
  512.       }
  513.       HTSimplify(local_copy);    /* Remove ".." etc. */
  514. -     pathname = HTTranslate(local_copy);
  515. -     if (!HTSecure) {
  516. -     char *localname = HTLocalName(pathname);
  517. -     free(pathname);
  518. -     pathname = localname;
  519. -     }        
  520. -     FREE(local_copy);
  521.   
  522. !     HTAAFailReason = check_authorization(pathname, method,
  523. !                      scheme, scheme_specifics);
  524.   
  525.       if (htaa_logfile) {
  526.       time(&theTime);
  527.       fprintf(htaa_logfile, "%24.24s %s %s %s %s %s\n",
  528. --- 444,500 ----
  529.       if (keywords) *keywords = (char)0;    /* Chop off keywords */
  530.       }
  531.       HTSimplify(local_copy);    /* Remove ".." etc. */
  532.   
  533. !     /* HTSimplify will leave in a "/../" at the top, which can
  534. !     ** be a security hole.
  535. !     */
  536. !     if (strstr(local_copy, "/../")) {
  537. !     if (TRACE) fprintf(stderr, "HTAA_checkAuthorization: %s (`%s')\n",
  538. !                "Illegal attempt to use /../", url);
  539. !     HTAAFailReason = HTAA_DOTDOT;
  540. !     }
  541. !     else {
  542. !     pathname = HTTranslate(local_copy); /* Translate rules even if */
  543. !                                         /* a /htbin call to set up */
  544. !                                         /* protections.           */
  545. !     if (0 == strncmp(local_copy, "/htbin/", 7)) {
  546. !         char *end = strchr(local_copy+7, '/');
  547. !         if (end)
  548. !         *end = (char)0;
  549. !         if (!HTBinDir)
  550. !         StrAllocCopy(HTBinDir, HTBINDIR);
  551. !         FREE(pathname);
  552. !         pathname = (char*)malloc(strlen(HTBinDir)+strlen(local_copy)-4);
  553. !         strcpy(pathname, HTBinDir);
  554. !         strcat(pathname, local_copy+6);
  555. !     }
  556.   
  557. +     if (!pathname) {        /* Forbidden by rule */
  558. +         if (TRACE) fprintf(stderr,
  559. +                    "HTAA_checkAuthorization: Forbidden by rule\n");
  560. +         HTAAFailReason = HTAA_BY_RULE;
  561. +     }
  562. +     else {    /* pathname != NULL */
  563. +         char *access = HTParse(pathname, "", PARSE_ACCESS);
  564. +         if (!*access  ||  0 == strcmp(access, "file")) { /*Local file, do AA*/
  565. +         if (!HTSecure && 0 != strncmp(local_copy, "/htbin/", 7)) {
  566. +             char *localname = HTLocalName(pathname);
  567. +             free(pathname);
  568. +             pathname = localname;
  569. +         }
  570. +         HTAAFailReason = check_authorization(pathname, method,
  571. +                              scheme, scheme_specifics);
  572. +         }
  573. +         else {  /* Not local access */
  574. +         HTAAFailReason = HTAA_OK_GATEWAY;
  575. +         fprintf(stderr, "HTAA_checkAuthorization: %s (%s access)\n",
  576. +             "Gatewaying -- skipping authorization check",
  577. +             access);
  578. +         }
  579. +     } /* pathname */
  580. +     }
  581. +     FREE(local_copy);
  582.       if (htaa_logfile) {
  583.       time(&theTime);
  584.       fprintf(htaa_logfile, "%24.24s %s %s %s %s %s\n",
  585. ***************
  586. *** 471,476 ****
  587. --- 528,534 ----
  588.         case HTAA_NO_ACL:
  589.         case HTAA_NO_ENTRY:
  590.         case HTAA_SETUP_ERROR:
  591. +       case HTAA_DOTDOT:
  592.       return 403;
  593.       break;
  594.   
  595. ***************
  596. *** 479,484 ****
  597. --- 537,543 ----
  598.       break;
  599.   
  600.         case HTAA_OK:
  601. +       case HTAA_OK_GATEWAY:
  602.       return 200;
  603.       break;
  604.   
  605. *** ../../../../2.12/WWW/Library/Implementation/HTACL.c    Tue Oct  5 10:02:37 1993
  606. --- HTACL.c    Wed Oct 13 16:53:41 1993
  607. ***************
  608. *** 182,187 ****
  609. --- 182,191 ----
  610.           HTList_delete(methods);
  611.           free(buf);
  612.           group_def = HTAA_parseGroupDef(acl_file);
  613. +         /*
  614. +         ** HTAA_parseGroupDef() already reads the record
  615. +         ** separator so we don't call HTAAFile_nextRec().
  616. +         */
  617.           return group_def;
  618.           }
  619.           else if (TRACE) fprintf(stderr, " METHOD NOT FOUND\n");
  620. ***************
  621. *** 188,194 ****
  622.           HTList_delete(methods);
  623.       }    /* if template match */
  624.       else {
  625. -         HTAAFile_nextRec(acl_file);
  626.           if (TRACE) {
  627.           fprintf(stderr,
  628.               "Filename '%s' didn't match template '%s'\n",
  629. --- 192,197 ----
  630. *** ../../../../2.12/WWW/Library/Implementation/HTAlert.c    Thu Oct  7 14:42:20 1993
  631. --- HTAlert.c    Thu Nov  4 10:54:13 1993
  632. ***************
  633. *** 80,87 ****
  634.   PUBLIC char * HTPromptPassword ARGS1(CONST char *, Msg)
  635.   {
  636.       char *result = NULL;
  637. !     char *pw = getpass(Msg ? Msg : "Password: ");
  638.       StrAllocCopy(result, pw);
  639.       return result;
  640.   }
  641.   
  642. --- 80,118 ----
  643.   PUBLIC char * HTPromptPassword ARGS1(CONST char *, Msg)
  644.   {
  645.       char *result = NULL;
  646. !     char *pw = (char*)getpass(Msg ? Msg : "Password: ");
  647.       StrAllocCopy(result, pw);
  648.       return result;
  649. + }
  650. + /*    Prompt both username and password    HTPromptUsernameAndPassword()
  651. + **    ---------------------------------
  652. + ** On entry,
  653. + **    Msg        is the prompting message.
  654. + **    *username and
  655. + **    *password    are char pointers; they are changed
  656. + **            to point to result strings.
  657. + **
  658. + **            If *username is not NULL, it is taken
  659. + **            to point to  a default value.
  660. + **            Initial value of *password is
  661. + **            completely discarded.
  662. + **
  663. + ** On exit,
  664. + **    *username and *password point to newly allocated
  665. + **    strings -- original strings pointed to by them
  666. + **    are NOT freed.
  667. + **    
  668. + */
  669. + PUBLIC void HTPromptUsernameAndPassword ARGS3(CONST char *,    Msg,
  670. +                           char **,        username,
  671. +                           char **,        password)
  672. + {
  673. +     if (Msg)
  674. +     fprintf(stderr, "WWW: %s\n", Msg);
  675. +     *username = HTPrompt("Username: ", *username);
  676. +     *password = HTPromptPassword("Password: ");
  677.   }
  678.   
  679. *** ../../../../2.12/WWW/Library/Implementation/HTAlert.h    Tue Oct  5 11:04:23 1993
  680. --- HTAlert.h    Thu Nov  4 10:07:13 1993
  681. ***************
  682. *** 1,4 ****
  683. ! /*                  /Net/dxcern/userd/timbl/hypertext/WWW/Library/Implementation/HTAlert.html
  684.                     DISPLAYING MESSAGES AND GETTING INPUT FOR WWW LIBRARY
  685.                                                
  686.      This module may be overridden for GUI clients.    It allows progress indications and
  687. --- 1,4 ----
  688. ! /*                                                  HTAlert: Handling user messages in libwww
  689.                     DISPLAYING MESSAGES AND GETTING INPUT FOR WWW LIBRARY
  690.                                                
  691.      This module may be overridden for GUI clients.    It allows progress indications and
  692. ***************
  693. *** 13,18 ****
  694. --- 13,23 ----
  695.   #include "HTUtils.h"
  696.   #include "tcp.h"
  697.   
  698. + #ifdef SHORT_NAMES
  699. + #define HTPrPass        HTPromptPassword
  700. + #define HTPUnAPw        HTPromptUsernameAndPassword
  701. + #endif /*SHORT_NAMES*/
  702.   /*
  703.   
  704.   HTPrompt and HTPromptPassword: Display a message and get the input
  705. ***************
  706. *** 34,40 ****
  707. --- 39,72 ----
  708.   extern char * HTPrompt PARAMS((CONST char * Msg, CONST char * deflt));
  709.   extern char * HTPromptPassword PARAMS((CONST char * Msg));
  710.   
  711. + /*
  712.   
  713. + HTPromptUsernameAndPassword: Get both username and password
  714. +   ON ENTRY,
  715. +   
  716. +   Msg                    String to be displayed.
  717. +                          
  718. +   username                Pointer to char pointer, i.e. *usernamepoints to a string.  If
  719. +                          non-NULL it is taken to be a default value.
  720. +                          
  721. +   password                Pointer to char pointer, i.e. *passwordpoints to a string.
  722. +                          Initial value discarded.
  723. +                          
  724. +   ON EXIT,
  725. +   
  726. +   *username               and
  727. +                          
  728. +   *password               point to newly allocated strings representing the typed-in
  729. +                          username and password.  Initial strings pointed to by them are
  730. +                          NOT freed!
  731. +                          
  732. +  */
  733. + extern void HTPromptUsernameAndPassword PARAMS((CONST char *    Msg,
  734. +                                                 char **         username,
  735. +                                                 char **         password));
  736.   /*
  737.   
  738.   Display a message, don't wait for input
  739. ***************
  740. *** 76,81 ****
  741. --- 108,114 ----
  742.    */
  743.   
  744.   extern BOOL HTConfirm PARAMS ((CONST char * Msg));
  745.   
  746.   
  747.   
  748. *** ../../../../2.12/WWW/Library/Implementation/HTAuth.c    Thu Oct  7 14:42:20 1993
  749. --- HTAuth.c    Wed Nov  3 16:20:27 1993
  750. ***************
  751. *** 6,13 ****
  752.   **    AL    Ari Luotonen    luotonen@dxcern.cern.ch
  753.   **
  754.   ** HISTORY:
  755.   **
  756. - **
  757.   ** BUGS:
  758.   **
  759.   **
  760. --- 6,13 ----
  761.   **    AL    Ari Luotonen    luotonen@dxcern.cern.ch
  762.   **
  763.   ** HISTORY:
  764. + **    AL 14.10.93 Fixed the colon-not-allowed-in-password-bug.
  765.   **
  766.   ** BUGS:
  767.   **
  768.   **
  769. ***************
  770. *** 44,50 ****
  771.       char *inet_addr = NULL;
  772.       char *timestamp = NULL;
  773.       char *browsers_key = NULL;
  774. -     char *extras = NULL;
  775.   
  776.       if (!user && !(user = (HTAAUser*)malloc(sizeof(HTAAUser))))    /* Allocated */
  777.       outofmem(__FILE__, "decompose_auth_string");        /* only once */
  778. --- 44,49 ----
  779. ***************
  780. *** 120,135 ****
  781.                      "fields missing in authentication string");
  782.           return NULL;
  783.       }
  784. -     extras = strchr(browsers_key, ':');
  785. -     }
  786. -     else extras = strchr(password, ':');
  787. -     if (extras) {
  788. -     *(extras++) = '\0';
  789. -     if (TRACE) fprintf(stderr, "%s `%s' %s `%s'\n",
  790. -                "decompose_auth_string: extra field(s) in",
  791. -                (scheme==HTAA_BASIC ? "Basic" : "Pubkey"),
  792. -                "authorization string ignored:", extras);
  793.       }
  794.   
  795.   /*
  796. --- 119,124 ----
  797. *** ../../../../2.12/WWW/Library/Implementation/HTChunk.h    Thu Jun 10 11:55:20 1993
  798. --- HTChunk.h    Thu Nov  4 10:07:11 1993
  799. ***************
  800. *** 1,4 ****
  801. ! /*                  /Net/dxcern/userd/timbl/hypertext/WWW/Library/Implementation/HTChunk.html
  802.                                        CHUNK HANDLING:
  803.                                        FLEXIBLE ARRAYS
  804.                                                
  805. --- 1,4 ----
  806. ! /*                                                HTChunk: Flexible array handling for libwww
  807.                                        CHUNK HANDLING:
  808.                                        FLEXIBLE ARRAYS
  809.                                                
  810. ***************
  811. *** 105,115 ****
  812.     
  813.     ch                      A valid chunk pointer made by HTChunkCreate()
  814.                            
  815. !   c                      The character to be appended
  816.                            
  817.     ON EXIT,
  818.     
  819. !   *ch                    Is one character bigger
  820.                            
  821.    */
  822.   extern void HTChunkPutc PARAMS((HTChunk * ch, char c));
  823. --- 105,115 ----
  824.     
  825.     ch                      A valid chunk pointer made by HTChunkCreate()
  826.                            
  827. !   c                       The character to be appended
  828.                            
  829.     ON EXIT,
  830.     
  831. !   *ch                     Is one character bigger
  832.                            
  833.    */
  834.   extern void HTChunkPutc PARAMS((HTChunk * ch, char c));
  835. ***************
  836. *** 157,160 ****
  837.   
  838.   /*
  839.   
  840. !    end  */
  841. --- 157,160 ----
  842.   
  843.   /*
  844.   
  845. !    end */
  846. *** ../../../../2.12/WWW/Library/Implementation/HTFTP.c    Thu Sep  2 17:52:47 1993
  847. --- HTFTP.c    Wed Nov  3 16:21:29 1993
  848. ***************
  849. *** 275,281 ****
  850.           break;        
  851.           } /* if end of line */
  852.           
  853. !         if (*(p-1) < 0) {
  854.           if(TRACE) fprintf(stderr, "Error on rx: closing socket %d\n",
  855.               control->socket);
  856.           strcpy(response_text, "000 *** TCP read error on response\n");
  857. --- 275,281 ----
  858.           break;        
  859.           } /* if end of line */
  860.           
  861. !         if (*(p-1) == (char) EOF) {
  862.           if(TRACE) fprintf(stderr, "Error on rx: closing socket %d\n",
  863.               control->socket);
  864.           strcpy(response_text, "000 *** TCP read error on response\n");
  865. *** ../../../../2.12/WWW/Library/Implementation/HTFWriter.c    Tue Oct  5 11:20:30 1993
  866. --- HTFWriter.c    Wed Nov  3 16:21:32 1993
  867. ***************
  868. *** 126,134 ****
  869.   */
  870.   PRIVATE void HTFWriter_free ARGS1(HTStream *, me)
  871.   {
  872. !     fflush(me->fp);
  873.       if (me->end_command) {        /* Temp file */
  874. -         fclose(me->fp);
  875.           HTProgress(me->end_command);    /* Tell user what's happening */
  876.       system(me->end_command);
  877.       free (me->end_command);
  878. --- 126,133 ----
  879.   */
  880.   PRIVATE void HTFWriter_free ARGS1(HTStream *, me)
  881.   {
  882. !     fclose(me->fp);
  883.       if (me->end_command) {        /* Temp file */
  884.           HTProgress(me->end_command);    /* Tell user what's happening */
  885.       system(me->end_command);
  886.       free (me->end_command);
  887. ***************
  888. *** 146,154 ****
  889.   
  890.   PRIVATE void HTFWriter_abort ARGS2(HTStream *, me, HTError, e)
  891.   {
  892. !     fflush(me->fp);
  893.       if (me->end_command) {        /* Temp file */
  894. -         fclose(me->fp);
  895.       if (TRACE) fprintf(stderr,
  896.           "HTFWriter: Aborting: file not executed.\n");
  897.       free (me->end_command);
  898. --- 145,152 ----
  899.   
  900.   PRIVATE void HTFWriter_abort ARGS2(HTStream *, me, HTError, e)
  901.   {
  902. !     fclose(me->fp);
  903.       if (me->end_command) {        /* Temp file */
  904.       if (TRACE) fprintf(stderr,
  905.           "HTFWriter: Aborting: file not executed.\n");
  906.       free (me->end_command);
  907. *** ../../../../2.12/WWW/Library/Implementation/HTFile.c    Tue Oct  5 10:47:44 1993
  908. --- HTFile.c    Thu Nov  4 10:54:15 1993
  909. ***************
  910. *** 97,102 ****
  911. --- 97,105 ----
  912.   **    representation.
  913.   **    Calling this with suffix set to "*.*" will set the default
  914.   **    representation for unknown suffix files which contain a ".".
  915. + **
  916. + **    If filename suffix is already defined its previous
  917. + **    definition is overridden.
  918.   */
  919.   PUBLIC void HTSetSuffix ARGS4(
  920.       CONST char *,    suffix,
  921. ***************
  922. *** 106,122 ****
  923.   {
  924.       
  925.       HTSuffix * suff;
  926. !     
  927.       if (strcmp(suffix, "*")==0) suff = &no_suffix;
  928.       else if (strcmp(suffix, "*.*")==0) suff = &unknown_suffix;
  929.       else {
  930. !     suff = (HTSuffix*) calloc(1, sizeof(HTSuffix));
  931. !     if (suff == NULL) outofmem(__FILE__, "HTSetSuffix");
  932.       
  933. !     if (!HTSuffixes) HTSuffixes = HTList_new();
  934. !     HTList_addObject(HTSuffixes, suff);
  935.       
  936. !     StrAllocCopy(suff->suffix, suffix);
  937.       }
  938.   
  939.       suff->rep = HTAtom_for(representation);
  940. --- 109,133 ----
  941.   {
  942.       
  943.       HTSuffix * suff;
  944.       if (strcmp(suffix, "*")==0) suff = &no_suffix;
  945.       else if (strcmp(suffix, "*.*")==0) suff = &unknown_suffix;
  946.       else {
  947. !     HTList *cur = HTSuffixes;
  948. !     while (NULL != (suff = (HTSuffix*)HTList_nextObject(cur))) {
  949. !         if (suff->suffix && 0==strcmp(suff->suffix, suffix))
  950. !         break;
  951. !     }
  952. !     if (!suff) { /* Not found -- create a new node */
  953. !         suff = (HTSuffix*) calloc(1, sizeof(HTSuffix));
  954. !         if (suff == NULL) outofmem(__FILE__, "HTSetSuffix");
  955.       
  956. !         if (!HTSuffixes) HTSuffixes = HTList_new();
  957. !         HTList_addObject(HTSuffixes, suff);
  958.       
  959. !         StrAllocCopy(suff->suffix, suffix);
  960. !     }
  961.       }
  962.   
  963.       suff->rep = HTAtom_for(representation);
  964. *** ../../../../2.12/WWW/Library/Implementation/HTGroup.c    Thu Oct  7 14:42:22 1993
  965. --- HTGroup.c    Wed Oct 13 16:53:42 1993
  966. ***************
  967. *** 639,644 ****
  968. --- 639,646 ----
  969.       FILE *fp;
  970.       GroupCache *group_cache;
  971.   
  972. +     if (!filename || !*filename) return NULL;
  973.       if (!group_cache_list)
  974.       group_cache_list = HTList_new();
  975.       else {
  976. ***************
  977. *** 739,745 ****
  978.           } /* search for username */
  979.           } /* IP address ok */
  980.           else {
  981. !         return HTAA_IP_MASK;
  982.           }
  983.       } /* while items in group */
  984.       } /* valid parameters */
  985. --- 741,747 ----
  986.           } /* search for username */
  987.           } /* IP address ok */
  988.           else {
  989. !         reason = HTAA_IP_MASK;
  990.           }
  991.       } /* while items in group */
  992.       } /* valid parameters */
  993. *** ../../../../2.12/WWW/Library/Implementation/HTGroup.h    Tue Oct  5 11:04:36 1993
  994. --- HTGroup.h    Thu Nov  4 10:07:16 1993
  995. ***************
  996. *** 30,35 ****
  997. --- 30,36 ----
  998.   */
  999.   typedef enum {
  1000.       HTAA_OK,            /* 200 OK                               */
  1001. +     HTAA_OK_GATEWAY,    /* 200 OK, acting as a gateway          */
  1002.       HTAA_NO_AUTH,       /* 401 Unauthorized, not authenticated  */
  1003.       HTAA_NOT_MEMBER,    /* 401 Unauthorized, not authorized     */
  1004.       HTAA_IP_MASK,       /* 403 Forbidden by IP mask             */
  1005. ***************
  1006. *** 37,42 ****
  1007. --- 38,44 ----
  1008.       HTAA_NO_ACL,        /* 403 Forbidden, ACL non-existent      */
  1009.       HTAA_NO_ENTRY,      /* 403 Forbidden, no ACL entry          */
  1010.       HTAA_SETUP_ERROR,   /* 403 Forbidden, server setup error    */
  1011. +     HTAA_DOTDOT,        /* 403 Forbidden, URL with /../ illegal */
  1012.       HTAA_NOT_FOUND      /* 404 Not found, or read protected     */
  1013.   } HTAAFailReasonType;
  1014.   
  1015. *** ../../../../2.12/WWW/Library/Implementation/HTInit.c    Mon Sep 27 15:15:12 1993
  1016. --- HTInit.c    Wed Nov  3 16:20:30 1993
  1017. ***************
  1018. *** 23,56 ****
  1019.   PUBLIC void HTFormatInit NOARGS
  1020.   {
  1021.   #ifdef NeXT
  1022. !   HTSetPresentation("application/postscript", "open %s",    1.0, 2.0, 0.0);
  1023. !   /* The following needs the GIF previewer -- you might not have it. */
  1024. !   HTSetPresentation("image/gif",         "open %s",     0.3, 2.0, 0.0);
  1025. !   HTSetPresentation("image/x-tiff",         "open %s",     1.0, 2.0, 0.0);
  1026. !   HTSetPresentation("audio/basic",         "open %s",     1.0, 2.0, 0.0);
  1027. !   HTSetPresentation("*",             "open %s",     1.0, 0.0, 0.0);
  1028.   #else
  1029. !  if (getenv("DISPLAY")) {    /* Must have X11 */
  1030. !   HTSetPresentation("application/postscript", "ghostview %s",    1.0, 3.0, 0.0);
  1031. !   HTSetPresentation("image/gif",         "xv %s",     1.0, 3.0, 0.0);
  1032. !   HTSetPresentation("image/x-tiff",         "xv %s",     1.0, 3.0, 0.0);
  1033. !   HTSetPresentation("image/jpeg",         "xv %s",     1.0, 3.0, 0.0);
  1034. !  }
  1035.   #endif
  1036. !  HTSetConversion("www/mime",  "*",           HTMIMEConvert,     1.0, 0.0, 0.0);
  1037. !  HTSetConversion("application/x-wais-source",
  1038. !                "*",           HTWSRCConvert,     1.0, 0.0, 0.0);
  1039. !  HTSetConversion("text/html", "text/x-c",    HTMLToC,             0.5, 0.0, 0.0);
  1040. !  HTSetConversion("text/html", "text/plain",  HTMLToPlain,     0.5, 0.0, 0.0);
  1041. !  HTSetConversion("text/html", "www/present", HTMLPresent,     1.0, 0.0, 0.0);
  1042. !  HTSetConversion("text/plain", "text/html",  HTPlainToHTML,    1.0, 0.0, 0.0);
  1043. !  HTSetConversion("text/plain", "www/present", HTPlainPresent,    1.0, 0.0, 0.0);
  1044. !  HTSetConversion("application/octet-stream", "www/present",
  1045. !                            HTSaveLocally,    0.1, 0.0, 0.0);
  1046. !  HTSetConversion("www/unknown", "www/present",
  1047. !                            HTSaveLocally,    0.3, 0.0, 0.0);
  1048. !  HTSetConversion("www/source", "www/present",
  1049. !                            HTSaveLocally,    0.3, 0.0, 0.0);
  1050.   }
  1051.   
  1052.   
  1053. --- 23,52 ----
  1054.   PUBLIC void HTFormatInit NOARGS
  1055.   {
  1056.   #ifdef NeXT
  1057. !     HTSetPresentation("application/postscript", "open %s",    1.0, 2.0, 0.0);
  1058. !     /* The following needs the GIF previewer -- you might not have it. */
  1059. !     HTSetPresentation("image/gif",         "open %s",     0.3, 2.0, 0.0);
  1060. !     HTSetPresentation("image/x-tiff",         "open %s",     1.0, 2.0, 0.0);
  1061. !     HTSetPresentation("audio/basic",         "open %s",     1.0, 2.0, 0.0);
  1062. !     HTSetPresentation("*",             "open %s",     1.0, 0.0, 0.0);
  1063.   #else
  1064. !     if (getenv("DISPLAY")) {    /* Must have X11 */
  1065. !     HTSetPresentation("application/postscript", "ghostview %s",    1.0, 3.0, 0.0);
  1066. !     HTSetPresentation("image/gif",         "xv %s",    1.0, 3.0, 0.0);
  1067. !     HTSetPresentation("image/x-tiff",     "xv %s",    1.0, 3.0, 0.0);
  1068. !     HTSetPresentation("image/jpeg",     "xv %s",    1.0, 3.0, 0.0);
  1069. !     }
  1070.   #endif
  1071. !     HTSetConversion("www/mime",            "*",        HTMIMEConvert,    1.0, 0.0, 0.0);
  1072. !     HTSetConversion("application/x-wais-source","*",        HTWSRCConvert,     1.0, 0.0, 0.0);
  1073. !     HTSetConversion("text/html",        "text/x-c",    HTMLToC,    0.5, 0.0, 0.0);
  1074. !     HTSetConversion("text/html",        "text/plain",    HTMLToPlain,    0.5, 0.0, 0.0);
  1075. !     HTSetConversion("text/html",        "www/present",    HTMLPresent,    1.0, 0.0, 0.0);
  1076. !     HTSetConversion("text/plain",        "text/html",    HTPlainToHTML,    1.0, 0.0, 0.0);
  1077. !     HTSetConversion("text/plain",        "www/present",    HTPlainPresent,    1.0, 0.0, 0.0);
  1078. !     HTSetConversion("application/octet-stream",    "www/present",    HTSaveLocally,    0.1, 0.0, 0.0);
  1079. !     HTSetConversion("www/unknown",        "www/present",    HTSaveLocally,    0.3, 0.0, 0.0);
  1080. !     HTSetConversion("www/source",        "www/present",    HTSaveLocally,    0.3, 0.0, 0.0);
  1081.   }
  1082.   
  1083.   
  1084. ***************
  1085. *** 68,116 ****
  1086.   
  1087.   #ifndef NO_INIT
  1088.   PUBLIC void HTFileInit NOARGS
  1089. ! {    /*     Suffix     Contenet-Type   Content-Encoding    Quality  */
  1090. !     
  1091. !     HTSetSuffix(".ai",    "application/postscript", "8bit", 0.5);    /* Adobe illustator */
  1092. !     HTSetSuffix(".au",  "audio/basic", "binary", 1.0);
  1093. !     HTSetSuffix(".mime","www/mime", "8bit", 1.0); /* Internal -- MIME is not recursive? */
  1094. !     
  1095. !     HTSetSuffix(".PS",    "application/postscript", "8bit", 0.8);
  1096. !     HTSetSuffix(".eps",    "application/postscript", "8bit", 0.8);
  1097. !     HTSetSuffix(".ps",    "application/postscript", "8bit", 0.8);
  1098.   
  1099. !     HTSetSuffix(".execme.csh", "application/x-csh", "7bit", 0.5);
  1100.       
  1101. !     HTSetSuffix(".html","text/html", "8bit", 1.0);
  1102. !     
  1103. !     HTSetSuffix(".c",    "text/plain", "7bit", 0.5);
  1104. !     HTSetSuffix(".h",    "text/plain", "7bit", 0.5);    /* html better */
  1105. !     HTSetSuffix(".m",    "text/plain", "7bit", 0.5);    /* Objective-C code */
  1106. !     HTSetSuffix(".f90",    "text/plain", "7bit", 0.5);    /* Fortran 90 */
  1107. !     HTSetSuffix(".txt", "text/plain", "7bit", 0.5);
  1108. !     HTSetSuffix(".rtf",    "application/x-rtf", "8bit", 1.0);
  1109. !     HTSetSuffix(".src",    "application/x-wais-source", "7bit", 1.0);
  1110. !     
  1111. !     HTSetSuffix(".snd", "audio/basic", "binary", 1.0);
  1112. !     
  1113. !     HTSetSuffix(".bin",    "application/octet-stream", "binary", 1.0);
  1114. !     HTSetSuffix(".Z",    "application/x-compressed", "binary", 1.0);
  1115. !     
  1116. !     HTSetSuffix(".gif", "image/gif", "binary", 1.0);
  1117. !     HTSetSuffix(".tiff","image/x-tiff", "binary", 1.0);
  1118. !     
  1119. !     HTSetSuffix(".jpg", "image/jpeg", "binary", 1.0);
  1120. !     HTSetSuffix(".JPG", "image/jpeg", "binary", 1.0);
  1121. !     HTSetSuffix(".JPEG","image/jpeg", "binary", 1.0);
  1122. !     HTSetSuffix(".jpeg","image/jpeg", "binary", 1.0);
  1123. !     
  1124. !     HTSetSuffix(".MPEG","video/mpeg", "binary", 1.0);
  1125. !     HTSetSuffix(".mpg","video/mpeg", "binary", 1.0);
  1126. !     HTSetSuffix(".MPG","video/mpeg", "binary", 1.0);
  1127. !     HTSetSuffix(".mpeg","video/mpeg", "binary", 1.0);
  1128.   
  1129.   }
  1130.   #endif /* NO_INIT */
  1131. --- 64,160 ----
  1132.   
  1133.   #ifndef NO_INIT
  1134.   PUBLIC void HTFileInit NOARGS
  1135. ! {
  1136. !     /*        Suffix     Contenet-Type    Content-Encoding  Quality            */
  1137.   
  1138. !     HTSetSuffix(".mime",   "www/mime",            "8bit",   1.0);    /* Internal -- MIME is    */
  1139. !                                                                         /* not recursive    */
  1140. !     HTSetSuffix(".bin",    "application/octet-stream",    "binary", 1.0); /* Uninterpreted binary    */
  1141. !     HTSetSuffix(".oda",    "application/oda",        "binary", 1.0);
  1142. !     HTSetSuffix(".pdf",    "application/pdf",        "binary", 1.0);
  1143. !     HTSetSuffix(".ai",     "application/postscript",    "8bit",   0.5);    /* Adobe Illustrator    */
  1144. !     HTSetSuffix(".PS",     "application/postscript",    "8bit",      0.8);    /* PostScript        */
  1145. !     HTSetSuffix(".eps",    "application/postscript",    "8bit",   0.8);
  1146. !     HTSetSuffix(".ps",     "application/postscript",    "8bit",   0.8);
  1147. !     HTSetSuffix(".rtf",    "application/x-rtf",        "7bit",   1.0);    /* RTF            */
  1148. !     HTSetSuffix(".Z",      "application/x-compressed",    "binary", 1.0);    /* Compressed data    */
  1149. !     HTSetSuffix(".csh",    "application/x-csh",        "7bit",   0.5);    /* C-shell script    */
  1150. !     HTSetSuffix(".dvi",    "application/x-dvi",        "binary", 1.0);    /* TeX DVI        */
  1151. !     HTSetSuffix(".hdf",    "application/x-hdf",        "binary", 1.0);    /* NCSA HDF data file    */
  1152. !     HTSetSuffix(".latex",  "application/x-latex",    "8bit",   1.0);    /* LaTeX source        */
  1153. !     HTSetSuffix(".nc",     "application/x-netcdf",    "binary", 1.0);    /* Unidata netCDF data    */
  1154. !     HTSetSuffix(".cdf",    "application/x-netcdf",    "binary", 1.0);
  1155. !     HTSetSuffix(".sh",     "application/x-sh",        "7bit",   0.5);    /* Shell-script        */
  1156. !     HTSetSuffix(".tcl",    "application/x-tcl",        "7bit",   0.5);    /* TCL-script        */
  1157. !     HTSetSuffix(".tex",    "application/x-tex",        "8bit",   1.0);    /* TeX source        */
  1158. !     HTSetSuffix(".texi",   "application/x-texinfo",    "7bit",   1.0);    /* Texinfo        */
  1159. !     HTSetSuffix(".texinfo","application/x-texinfo",    "7bit",   1.0);
  1160. !     HTSetSuffix(".t",      "application/x-troff",    "7bit",   0.5);    /* Troff        */
  1161. !     HTSetSuffix(".roff",   "application/x-troff",    "7bit",   0.5);
  1162. !     HTSetSuffix(".tr",     "application/x-troff",    "7bit",   0.5);
  1163. !     HTSetSuffix(".man",    "application/x-troff-man",    "7bit",   0.5);    /* Troff with man macros*/
  1164. !     HTSetSuffix(".me",     "application/x-troff-me",    "7bit",   0.5);    /* Troff with me macros    */
  1165. !     HTSetSuffix(".ms",     "application/x-troff-ms",    "7bit",   0.5);    /* Troff with ms macros    */
  1166. !     HTSetSuffix(".src",    "application/x-wais-source",    "7bit",   1.0);    /* WAIS source        */
  1167. !     HTSetSuffix(".zip",    "application/zip",        "binary", 1.0);    /* PKZIP        */
  1168. !     HTSetSuffix(".bcpio",  "application/x-bcpio",    "binary", 1.0);    /* Old binary CPIO    */
  1169. !     HTSetSuffix(".cpio",   "application/x-cpio",    "binary", 1.0);    /* POSIX CPIO        */
  1170. !     HTSetSuffix(".gtar",   "application/x-gtar",    "binary", 1.0);    /* Gnu tar        */
  1171. !     HTSetSuffix(".shar",   "application/x-shar",    "8bit",   1.0);    /* Shell archive    */
  1172. !     HTSetSuffix(".sv4cpio","application/x-sv4cpio",    "binary", 1.0);    /* SVR4 CPIO        */
  1173. !     HTSetSuffix(".sv4crc", "application/x-sv4crc",    "binary", 1.0);    /* SVR4 CPIO with CRC    */
  1174. !     HTSetSuffix(".tar",    "application/x-tar",        "binary", 1.0);    /* 4.3BSD tar        */
  1175. !     HTSetSuffix(".ustar",  "application/x-ustar",    "binary", 1.0);    /* POSIX tar        */
  1176. !     HTSetSuffix(".snd",    "audio/basic",        "binary", 1.0);    /* Audio        */
  1177. !     HTSetSuffix(".au",     "audio/basic",        "binary", 1.0);
  1178. !     HTSetSuffix(".aiff",   "audio/x-aiff",        "binary", 1.0);
  1179. !     HTSetSuffix(".aifc",   "audio/x-aiff",        "binary", 1.0);
  1180. !     HTSetSuffix(".aif",    "audio/x-aiff",        "binary", 1.0);
  1181. !     HTSetSuffix(".wav",    "audio/x-wav",        "binary", 1.0);    /* Windows+ WAVE format    */
  1182. !     HTSetSuffix(".gif",    "image/gif",            "binary", 1.0);    /* GIF            */
  1183. !     HTSetSuffix(".ief",    "image/ief",            "binary", 1.0);    /* Image Exchange fmt    */
  1184. !     HTSetSuffix(".jpg",    "image/jpeg",        "binary", 1.0);    /* JPEG            */
  1185. !     HTSetSuffix(".JPG",    "image/jpeg",        "binary", 1.0);
  1186. !     HTSetSuffix(".JPE",    "image/jpeg",        "binary", 1.0);
  1187. !     HTSetSuffix(".jpe",    "image/jpeg",        "binary", 1.0);
  1188. !     HTSetSuffix(".JPEG",   "image/jpeg",        "binary", 1.0);
  1189. !     HTSetSuffix(".jpeg",   "image/jpeg",        "binary", 1.0);
  1190. !     HTSetSuffix(".tif",    "image/tiff",        "binary", 1.0);    /* TIFF            */
  1191. !     HTSetSuffix(".tiff",   "image/tiff",        "binary", 1.0);
  1192. !     HTSetSuffix(".ras",    "image/cmu-raster",        "binary", 1.0);
  1193. !     HTSetSuffix(".pnm",    "image/x-portable-anymap",    "binary", 1.0);    /* PBM Anymap format    */
  1194. !     HTSetSuffix(".pbm",    "image/x-portable-bitmap",    "binary", 1.0);    /* PBM Bitmap format    */
  1195. !     HTSetSuffix(".pgm",    "image/x-portable-graymap",    "binary", 1.0);    /* PBM Graymap format    */
  1196. !     HTSetSuffix(".ppm",    "image/x-portable-pixmap",    "binary", 1.0);    /* PBM Pixmap format    */
  1197. !     HTSetSuffix(".rgb",    "image/x-rgb",        "binary", 1.0);
  1198. !     HTSetSuffix(".xbm",    "image/x-xbitmap",        "binary", 1.0);    /* X bitmap        */
  1199. !     HTSetSuffix(".xpm",    "image/x-xpixmap",        "binary", 1.0);    /* X pixmap format    */
  1200. !     HTSetSuffix(".xwd",    "image/x-xwindowdump",    "binary", 1.0);    /* X window dump (xwd)    */
  1201. !     HTSetSuffix(".html",   "text/html",            "8bit",   1.0);    /* HTML            */
  1202. !     HTSetSuffix(".c",      "text/plain",        "7bit",   0.5);    /* C source        */
  1203. !     HTSetSuffix(".h",      "text/plain",        "7bit",   0.5);    /* C headers        */
  1204. !     HTSetSuffix(".C",      "text/plain",        "7bit",   0.5);    /* C++ source        */
  1205. !     HTSetSuffix(".cc",     "text/plain",        "7bit",   0.5);    /* C++ source        */
  1206. !     HTSetSuffix(".hh",     "text/plain",        "7bit",   0.5);    /* C++ headers        */
  1207. !     HTSetSuffix(".m",      "text/plain",        "7bit",   0.5);    /* Objective-C source    */
  1208. !     HTSetSuffix(".f90",    "text/plain",        "7bit",   0.5);    /* Fortran 90 source    */
  1209. !     HTSetSuffix(".txt",    "text/plain",        "7bit",   0.5);    /* Plain text        */
  1210. !     HTSetSuffix(".rtx",    "text/richtext",        "7bit",   1.0);    /* MIME Richtext format    */
  1211. !     HTSetSuffix(".tsv",    "text/tab-separated-values",    "7bit",   1.0);    /* Tab-separated values    */
  1212. !     HTSetSuffix(".etx",    "text/x-setext",        "7bit",   0.9);    /* Struct Enchanced Txt    */
  1213. !     HTSetSuffix(".MPG",    "video/mpeg",        "binary", 1.0);    /* MPEG            */
  1214. !     HTSetSuffix(".mpg",    "video/mpeg",        "binary", 1.0);
  1215. !     HTSetSuffix(".MPE",    "video/mpeg",        "binary", 1.0);
  1216. !     HTSetSuffix(".mpe",    "video/mpeg",        "binary", 1.0);
  1217. !     HTSetSuffix(".MPEG",   "video/mpeg",        "binary", 1.0);
  1218. !     HTSetSuffix(".mpeg",   "video/mpeg",        "binary", 1.0);
  1219. !     HTSetSuffix(".qt",     "video/quicktime",        "binary", 1.0);    /* QuickTime        */
  1220. !     HTSetSuffix(".mov",    "video/quicktime",        "binary", 1.0);
  1221. !     HTSetSuffix(".avi",    "video/x-msvideo",        "binary", 1.0);    /* MS Video for Windows    */
  1222. !     HTSetSuffix(".movie",  "video/x-sgi-movie",        "binary", 1.0);    /* SGI "moviepalyer"    */
  1223.       
  1224. !     HTSetSuffix("*.*",     "application/octet-stream",    "binary", 0.1);
  1225. !     HTSetSuffix("*",       "text/plain",        "7bit",   0.5);
  1226.   
  1227.   }
  1228.   #endif /* NO_INIT */
  1229. *** ../../../../2.12/WWW/Library/Implementation/HTML.c    Thu Sep  2 17:55:07 1993
  1230. --- HTML.c    Wed Nov  3 16:21:35 1993
  1231. ***************
  1232. *** 493,498 ****
  1233. --- 493,512 ----
  1234.          HTAnchor_setIndex(me->node_anchor);
  1235.       break;
  1236.       
  1237. +     case HTML_BR: 
  1238. +     UPDATE_STYLE;
  1239. +     HText_appendCharacter(me->text, '\n');
  1240. +     me->in_word = NO;
  1241. +     break;
  1242. +     
  1243. +     case HTML_HR: 
  1244. +     UPDATE_STYLE;
  1245. +     HText_appendCharacter(me->text, '\n');
  1246. +     HText_appendCharacter(me->text, "___________________________________");
  1247. +     HText_appendCharacter(me->text, '\n');
  1248. +     me->in_word = NO;
  1249. +     break;
  1250. +     
  1251.       case HTML_P:
  1252.       UPDATE_STYLE;
  1253.       HText_appendParagraph(me->text);
  1254. ***************
  1255. *** 659,665 ****
  1256.   {
  1257.       HTML_put_string(me, ISO_Latin1[entity_number]);    /* @@ Other representations */
  1258.   }
  1259.   
  1260.   
  1261.   /*    Free an HTML object
  1262. --- 673,678 ----
  1263. *** ../../../../2.12/WWW/Library/Implementation/HTML.h    Mon Jun 21 16:13:15 1993
  1264. --- HTML.h    Thu Nov  4 10:07:11 1993
  1265. ***************
  1266. *** 1,6 ****
  1267. --- 1,8 ----
  1268.   /*                                                     HTML to rich text converter for libwww
  1269.                                THE HTML TO RTF OBJECT CONVERTER
  1270.                                                
  1271. +    This interprets the HTML semantics.
  1272. +    
  1273.    */
  1274.   #ifndef HTML_H
  1275.   #define HTML_H
  1276. ***************
  1277. *** 73,78 ****
  1278. --- 75,81 ----
  1279.           CONST char *    message));
  1280.   
  1281.   #endif
  1282.   
  1283.   /*
  1284.   
  1285. *** ../../../../2.12/WWW/Library/Implementation/HTMLDTD.c    Thu Jul  8 12:17:36 1993
  1286. --- HTMLDTD.c    Thu Nov  4 15:35:11 1993
  1287. ***************
  1288. *** 89,95 ****
  1289.   **    Lists must be in alphatbetical order by attribute name
  1290.   **    The tag elements contain the number of attributes
  1291.   */
  1292. ! static attr no_attr[] = 
  1293.       {{ 0 }};
  1294.   
  1295.   static attr a_attr[] = {        /* Anchor attributes */
  1296. --- 89,95 ----
  1297.   **    Lists must be in alphatbetical order by attribute name
  1298.   **    The tag elements contain the number of attributes
  1299.   */
  1300. ! static attr no_attr[1] = 
  1301.       {{ 0 }};
  1302.   
  1303.   static attr a_attr[] = {        /* Anchor attributes */
  1304. ***************
  1305. *** 103,111 ****
  1306.       { 0 }    /* Terminate list */
  1307.   };    
  1308.   
  1309. ! static attr img_attr[] = {            /* Anchor attributes */
  1310.       { "SRC"},
  1311. -     { "ISMAP"},            /* @@@ Use HTTP SpaceJump instead */
  1312.       { 0 }    /* Terminate list */
  1313.   };    
  1314.   
  1315. --- 103,113 ----
  1316.       { 0 }    /* Terminate list */
  1317.   };    
  1318.   
  1319. ! static attr img_attr[HTML_IMG_ATTRIBUTES+1] = {    /* Anchor attributes */
  1320. !     { "ALIGN" },
  1321. !     { "ALT" },
  1322. !     { "ISMAP"},            /* Use HTTP SpaceJump instead */
  1323.       { "SRC"},
  1324.       { 0 }    /* Terminate list */
  1325.   };    
  1326.   
  1327. ***************
  1328. *** 119,129 ****
  1329.       { 0 }    /* Terminate list */
  1330.   };
  1331.   
  1332. ! static attr nextid_attr[] = {
  1333. !     { "N" }
  1334.   };
  1335.   
  1336.   
  1337.   /*    Elements
  1338.   **    --------
  1339.   **
  1340. --- 121,137 ----
  1341.       { 0 }    /* Terminate list */
  1342.   };
  1343.   
  1344. ! static attr nextid_attr[HTML_NEXTID_ATTRIBUTES+1] = {
  1345. !     { "N" },
  1346. !     { 0 }    /* Terminate list */
  1347.   };
  1348.   
  1349. + static attr pre_attr[HTML_PRE_ATTRIBUTES+1] = {
  1350. +     { "WIDTH" },
  1351. +     { 0 }    /* Terminate list */
  1352. + };
  1353.   
  1354.   /*    Elements
  1355.   **    --------
  1356.   **
  1357. ***************
  1358. *** 138,143 ****
  1359. --- 146,152 ----
  1360.       { "B"    , no_attr,    0,        SGML_MIXED },
  1361.       { "BLOCKQUOTE", no_attr,    0,        SGML_MIXED },
  1362.       { "BODY"    , no_attr,    0,        SGML_MIXED },
  1363. +     { "BR"    , no_attr,    0,        SGML_EMPTY },
  1364.       { "CITE"    , no_attr,    0,        SGML_MIXED },
  1365.       { "CODE"    , no_attr,    0,        SGML_MIXED },
  1366.       { "COMMENT",  no_attr,    0,        SGML_MIXED },
  1367. ***************
  1368. *** 156,161 ****
  1369. --- 165,171 ----
  1370.       { "H5"    , no_attr,    0,        SGML_MIXED },
  1371.       { "H6"    , no_attr,    0,        SGML_MIXED },
  1372.       { "H7"    , no_attr,    0,        SGML_MIXED },
  1373. +     { "HR"    , no_attr,    0,        SGML_EMPTY },
  1374.       { "HTML"    , no_attr,    0,        SGML_MIXED },
  1375.       { "I"    , no_attr,    0,        SGML_MIXED },
  1376.       { "IMG"     , img_attr,    2,        SGML_EMPTY },
  1377. ***************
  1378. *** 169,175 ****
  1379.       { "OL"    , list_attr,    1,        SGML_MIXED },
  1380.       { "P"    , no_attr,    0,        SGML_EMPTY },
  1381.       { "PLAINTEXT", no_attr,    0,        SGML_LITTERAL },
  1382. !     { "PRE"    , no_attr,    0,        SGML_MIXED },
  1383.       { "SAMP"    , no_attr,    0,        SGML_MIXED },
  1384.       { "STRONG"    , no_attr,    0,        SGML_MIXED },
  1385.       { "TITLE",       no_attr,    0,        SGML_CDATA },
  1386. --- 179,185 ----
  1387.       { "OL"    , list_attr,    1,        SGML_MIXED },
  1388.       { "P"    , no_attr,    0,        SGML_EMPTY },
  1389.       { "PLAINTEXT", no_attr,    0,        SGML_LITTERAL },
  1390. !     { "PRE"    , pre_attr,    0,        SGML_MIXED },
  1391.       { "SAMP"    , no_attr,    0,        SGML_MIXED },
  1392.       { "STRONG"    , no_attr,    0,        SGML_MIXED },
  1393.       { "TITLE",       no_attr,    0,        SGML_CDATA },
  1394. ***************
  1395. *** 224,229 ****
  1396. --- 234,259 ----
  1397.       }
  1398.       
  1399.       (*obj->isa->start_element)(obj, HTML_A , present, value);
  1400. + }
  1401. + PUBLIC void HTNextID ARGS2(HTStructured *, obj,
  1402. +         int,    next_one)
  1403. + {
  1404. +     BOOL        present[HTML_NEXTID_ATTRIBUTES];
  1405. +     CONST char*        value[HTML_NEXTID_ATTRIBUTES];
  1406. +     char string[10];
  1407. +     
  1408. +     sprintf(string, "z%i", next_one);
  1409. +     {
  1410. +         int i;
  1411. +         for(i=0; i<HTML_NEXTID_ATTRIBUTES; i++)
  1412. +         present[i] = NO;
  1413. +     }
  1414. +     present[HTML_NEXTID_N] = YES;
  1415. +     value[HTML_NEXTID_N] = string;
  1416. +     
  1417. +     (*obj->isa->start_element)(obj, HTML_NEXTID , present, value);
  1418.   
  1419.   }
  1420.   
  1421. *** ../../../../2.12/WWW/Library/Implementation/HTMLDTD.h    Thu Sep  2 18:02:20 1993
  1422. --- HTMLDTD.h    Wed Nov  3 16:29:06 1993
  1423. ***************
  1424. *** 29,34 ****
  1425. --- 29,35 ----
  1426.   typedef enum _HTMLElement {
  1427.           HTML_A,         HTML_ADDRESS,
  1428.           HTML_B,         HTML_BLOCKQUOTE,        HTML_BODY,
  1429. +         HTML_BR,
  1430.           HTML_CITE,      HTML_CODE,      HTML_COMMENT,
  1431.           HTML_DD,        HTML_DFN,       HTML_DIR,
  1432.           HTML_DL,        HTML_DLC,       HTML_DT,
  1433. ***************
  1434. *** 36,41 ****
  1435. --- 37,43 ----
  1436.           HTML_HEAD,
  1437.           HTML_H1,        HTML_H2,        HTML_H3,
  1438.           HTML_H4,        HTML_H5,        HTML_H6,        HTML_H7,
  1439. +         HTML_HR,
  1440.           HTML_HTML,
  1441.           HTML_I,         HTML_IMG,       HTML_ISINDEX,
  1442.           HTML_KBD,
  1443. ***************
  1444. *** 47,53 ****
  1445.           HTML_U,         HTML_UL,
  1446.           HTML_VAR,       HTML_XMP } HTMLElement;
  1447.   
  1448. ! #define HTML_ELEMENTS 45
  1449.   
  1450.   /*
  1451.   
  1452. --- 49,55 ----
  1453.           HTML_U,         HTML_UL,
  1454.           HTML_VAR,       HTML_XMP } HTMLElement;
  1455.   
  1456. ! #define HTML_ELEMENTS 48
  1457.   
  1458.   /*
  1459.   
  1460. ***************
  1461. *** 57,63 ****
  1462.   
  1463.   /*
  1464.   
  1465. !    Identifier is HTML_<element>_<attribute>. These must match the tables in HTML.c!
  1466.      
  1467.    */
  1468.   #define HTML_A_HREF             0
  1469. --- 59,65 ----
  1470.   
  1471.   /*
  1472.   
  1473. !    Identifier is HTML_<element>_<attribute>. These must match the tables in HTMLDTD.c !
  1474.      
  1475.    */
  1476.   #define HTML_A_HREF             0
  1477. ***************
  1478. *** 71,80 ****
  1479.   
  1480.   #define DL_COMPACT 0
  1481.   
  1482. ! #define HTML_IMG_SRC            0
  1483.   
  1484. ! #define NEXTID_N 0
  1485.   
  1486.   extern CONST SGML_dtd HTML_dtd;
  1487.   
  1488.   
  1489. --- 73,91 ----
  1490.   
  1491.   #define DL_COMPACT 0
  1492.   
  1493. ! #define HTML_IMG_ALIGN          0
  1494.   
  1495. ! #define HTML_IMG_ALT            1
  1496. ! #define HTML_IMG_ISMAP          2       /* Obsolete but supported */
  1497. ! #define HTML_IMG_SRC            3
  1498. ! #define HTML_IMG_ATTRIBUTES     4
  1499.   
  1500. + #define HTML_NEXTID_ATTRIBUTES  1
  1501. + #define HTML_NEXTID_N 0
  1502. + #define HTML_PRE_WIDTH          0
  1503. + #define HTML_PRE_ATTRIBUTES     1
  1504.   extern CONST SGML_dtd HTML_dtd;
  1505.   
  1506.   
  1507. ***************
  1508. *** 99,104 ****
  1509. --- 110,126 ----
  1510.   
  1511.   
  1512.   #endif /* HTMLDTD_H */
  1513. + /*
  1514. + Specify next ID to be used
  1515. +    This is anoter convenience routine, for specifying the next ID to be used by an editor
  1516. +    in the series z1. z2,...
  1517. +    
  1518. +  */
  1519. + extern void HTNextID PARAMS((HTStructured * targetStream, int n));
  1520.   
  1521.   /*
  1522.   
  1523. *** ../../../../2.12/WWW/Library/Implementation/HTMLGen.c    Thu Sep  2 17:55:30 1993
  1524. --- HTMLGen.c    Wed Nov  3 16:21:46 1993
  1525. ***************
  1526. *** 8,17 ****
  1527.   **        Should convert old XMP, LISTING and PLAINTEXT to PRE.
  1528.   **
  1529.   **    It is not obvious to me right now whether the HEAD should be generated
  1530. ! **    from the incomming data or the anchor.  Currently itis from the former
  1531.   **    which is cleanest.
  1532.   */
  1533.   
  1534.   /* Implements:
  1535.   */
  1536.   #include "HTMLGen.h"
  1537. --- 8,19 ----
  1538.   **        Should convert old XMP, LISTING and PLAINTEXT to PRE.
  1539.   **
  1540.   **    It is not obvious to me right now whether the HEAD should be generated
  1541. ! **    from the incomming data or the anchor.  Currently it is from the former
  1542.   **    which is cleanest.
  1543.   */
  1544.   
  1545. + #define BUFFER_SIZE    80    /* Line buffer attempts to make neat breaks */
  1546.   /* Implements:
  1547.   */
  1548.   #include "HTMLGen.h"
  1549. ***************
  1550. *** 23,29 ****
  1551.   #include "HTFormat.h"
  1552.   
  1553.   #define PUTC(c) (*me->targetClass.put_character)(me->target, c)
  1554. ! #define PUTS(s) (*me->targetClass.put_string)(me->target, s)
  1555.   #define PUTB(s,l) (*me->targetClass.put_block)(me->target, s, l)
  1556.   
  1557.   /*        HTML Object
  1558. --- 25,31 ----
  1559.   #include "HTFormat.h"
  1560.   
  1561.   #define PUTC(c) (*me->targetClass.put_character)(me->target, c)
  1562. ! /* #define PUTS(s) (*me->targetClass.put_string)(me->target, s) */
  1563.   #define PUTB(s,l) (*me->targetClass.put_block)(me->target, s, l)
  1564.   
  1565.   /*        HTML Object
  1566. ***************
  1567. *** 40,54 ****
  1568.       CONST HTStructuredClass *    isa;
  1569.       HTStream *             target;
  1570.       HTStreamClass            targetClass;    /* COPY for speed */
  1571.   };
  1572.   
  1573.   
  1574.   /*    Character handling
  1575.   **    ------------------
  1576.   */
  1577.   PRIVATE void HTMLGen_put_character ARGS2(HTStructured *, me, char, c)
  1578.   {
  1579. !     PUTC(c);
  1580.   }
  1581.   
  1582.   
  1583. --- 42,109 ----
  1584.       CONST HTStructuredClass *    isa;
  1585.       HTStream *             target;
  1586.       HTStreamClass            targetClass;    /* COPY for speed */
  1587. +     
  1588. +     char                buffer[BUFFER_SIZE];
  1589. +     char *                write_pointer;
  1590. +     char *                line_break;
  1591. +     int                cleanness;
  1592. +     BOOL                preformatted;
  1593.   };
  1594.   
  1595.   
  1596. + /*    Flush Buffer
  1597. + **    ------------
  1598. + */
  1599. + PRIVATE void HTMLGen_flush ARGS1(HTStructured *, me)
  1600. + {
  1601. +     (*me->targetClass.put_block)(me->target, 
  1602. +                     me->buffer,
  1603. +                 me->write_pointer - me->buffer);
  1604. +     me->write_pointer = me->buffer;
  1605. +     me->line_break = me->buffer;
  1606. +     me->cleanness = 0;
  1607. + }
  1608.   /*    Character handling
  1609.   **    ------------------
  1610.   */
  1611.   PRIVATE void HTMLGen_put_character ARGS2(HTStructured *, me, char, c)
  1612.   {
  1613. !     *me->write_pointer++ = c;
  1614. !     
  1615. !     if (c=='\n') {
  1616. !         HTMLGen_flush(me);
  1617. !     return;
  1618. !     }
  1619. !     
  1620. !     if ((!me->preformatted  && c==' ')) {
  1621. !         me->line_break = me->write_pointer;
  1622. !     me->cleanness = 1;
  1623. !     }
  1624. !     
  1625. !     /* Flush buffer out when full */
  1626. !     if (me->write_pointer == me->buffer + BUFFER_SIZE) {
  1627. !         if (me->cleanness) {
  1628. !         me->line_break[-1] = '\n';
  1629. !         (*me->targetClass.put_block)(me->target,
  1630. !                         me->buffer,
  1631. !                     me->line_break - me->buffer);
  1632. !         {  /* move next line in */
  1633. !             char * p,*q;
  1634. !         for(q=me->buffer, p=me->line_break; p < me->write_pointer; )
  1635. !             *q++ = *p++;
  1636. !         }
  1637. !         me->cleanness = 0;
  1638. !     } else {
  1639. !         (*me->targetClass.put_block)(me->target,
  1640. !             me->buffer,
  1641. !         BUFFER_SIZE);
  1642. !     }
  1643. !     me->write_pointer = me->buffer;
  1644. !     me->line_break = me->buffer;
  1645. !     }
  1646.   }
  1647.   
  1648.   
  1649. ***************
  1650. *** 58,74 ****
  1651.   */
  1652.   PRIVATE void HTMLGen_put_string ARGS2(HTStructured *, me, CONST char*, s)
  1653.   {
  1654. !     PUTS(s);
  1655.   }
  1656.   
  1657.   PRIVATE void HTMLGen_write ARGS3(HTStructured *, me, CONST char*, s, int, l)
  1658.   {
  1659. !     PUTB(s,l);
  1660.   }
  1661.   
  1662.   
  1663.   /*    Start Element
  1664.   **    -------------
  1665.   */
  1666.   PRIVATE void HTMLGen_start_element ARGS4(
  1667.       HTStructured *,     me,
  1668. --- 113,134 ----
  1669.   */
  1670.   PRIVATE void HTMLGen_put_string ARGS2(HTStructured *, me, CONST char*, s)
  1671.   {
  1672. !     CONST char * p;
  1673. !     for(p=s; *p; p++) HTMLGen_put_character(me, *p);
  1674.   }
  1675.   
  1676.   PRIVATE void HTMLGen_write ARGS3(HTStructured *, me, CONST char*, s, int, l)
  1677.   {
  1678. !     CONST char * p;
  1679. !     for(p=s; p<s+l; p++) HTMLGen_put_character(me, *p);
  1680.   }
  1681.   
  1682.   
  1683.   /*    Start Element
  1684.   **    -------------
  1685. + **
  1686. + **    Within the opening tag, there may be spaces
  1687. + **    and the line may be broken at these spaces.
  1688.   */
  1689.   PRIVATE void HTMLGen_start_element ARGS4(
  1690.       HTStructured *,     me,
  1691. ***************
  1692. *** 77,98 ****
  1693.       CONST char **,        value)
  1694.   {
  1695.       int i;
  1696.       HTTag * tag = &HTML_dtd.tags[element_number];
  1697. !     PUTC('<');
  1698. !     PUTS(tag->name);
  1699.       if (present) for (i=0; i< tag->number_of_attributes; i++) {
  1700.           if (present[i]) {
  1701. !         PUTC(' ');
  1702. !         PUTS(tag->attributes[i].name);
  1703.           if (value[i]) {
  1704. !          PUTS("=\"");
  1705. !         PUTS(value[i]);
  1706. !         PUTC('"');
  1707.           }
  1708.       }
  1709.       }
  1710. !     PUTC('>');
  1711.   }
  1712.   
  1713.   
  1714. --- 137,166 ----
  1715.       CONST char **,        value)
  1716.   {
  1717.       int i;
  1718. !     
  1719. !     BOOL was_preformatted = me->preformatted;
  1720.       HTTag * tag = &HTML_dtd.tags[element_number];
  1721. !     me->preformatted = NO;
  1722. !     HTMLGen_put_character(me, '<');
  1723. !     HTMLGen_put_string(me, tag->name);
  1724.       if (present) for (i=0; i< tag->number_of_attributes; i++) {
  1725.           if (present[i]) {
  1726. !         HTMLGen_put_character(me, ' ');
  1727. !         HTMLGen_put_string(me, tag->attributes[i].name);
  1728.           if (value[i]) {
  1729. !          HTMLGen_put_string(me, "=\"");
  1730. !         HTMLGen_put_string(me, value[i]);
  1731. !         HTMLGen_put_character(me, '"');
  1732.           }
  1733.       }
  1734.       }
  1735. !     HTMLGen_put_string(me, ">\n");
  1736. !     
  1737. !     /* Make very specific HTML assumption that PRE can't be
  1738. !        nested! */
  1739. !        
  1740. !     me->preformatted = (element_number == HTML_PRE)  ? YES : was_preformatted;
  1741.   }
  1742.   
  1743.   
  1744. ***************
  1745. *** 110,118 ****
  1746.   PRIVATE void HTMLGen_end_element ARGS2(HTStructured *, me,
  1747.               int , element_number)
  1748.   {
  1749. !     PUTS("</");
  1750. !     PUTS(HTML_dtd.tags[element_number].name);
  1751. !     PUTC('>');
  1752.   }
  1753.   
  1754.   
  1755. --- 178,187 ----
  1756.   PRIVATE void HTMLGen_end_element ARGS2(HTStructured *, me,
  1757.               int , element_number)
  1758.   {
  1759. !     HTMLGen_put_string(me, "</");
  1760. !     HTMLGen_put_string(me, HTML_dtd.tags[element_number].name);
  1761. !     HTMLGen_put_character(me, '>');
  1762. !     if (element_number == HTML_PRE) me->preformatted = NO;
  1763.   }
  1764.   
  1765.   
  1766. ***************
  1767. *** 123,131 ****
  1768.   
  1769.   PRIVATE void HTMLGen_put_entity ARGS2(HTStructured *, me, int, entity_number)
  1770.   {
  1771. !     PUTC('&');
  1772. !     PUTS(HTML_dtd.entity_names[entity_number]);
  1773. !     PUTC(';');
  1774.   }
  1775.   
  1776.   
  1777. --- 192,200 ----
  1778.   
  1779.   PRIVATE void HTMLGen_put_entity ARGS2(HTStructured *, me, int, entity_number)
  1780.   {
  1781. !     HTMLGen_put_character(me, '&');
  1782. !     HTMLGen_put_string(me, HTML_dtd.entity_names[entity_number]);
  1783. !     HTMLGen_put_character(me, ';');
  1784.   }
  1785.   
  1786.   
  1787. ***************
  1788. *** 133,149 ****
  1789.   /*    Free an HTML object
  1790.   **    -------------------
  1791.   **
  1792. - **    Note that the SGML parsing context is freed, but the created object is not,
  1793. - **    as it takes on an existence of its own unless explicitly freed.
  1794.   */
  1795.   PRIVATE void HTMLGen_free ARGS1(HTStructured *, me)
  1796.   {
  1797.       (*me->targetClass.free)(me->target);    /* ripple through */
  1798.       free(me);
  1799.   }
  1800.   
  1801.   
  1802.   
  1803.   PRIVATE void HTMLGen_abort ARGS2(HTStructured *, me, HTError, e)
  1804.   {
  1805.       HTMLGen_free(me);
  1806. --- 202,227 ----
  1807.   /*    Free an HTML object
  1808.   **    -------------------
  1809.   **
  1810.   */
  1811.   PRIVATE void HTMLGen_free ARGS1(HTStructured *, me)
  1812.   {
  1813. +     (*me->targetClass.put_character)(me->target, '\n');
  1814. +     HTMLGen_flush(me);
  1815.       (*me->targetClass.free)(me->target);    /* ripple through */
  1816.       free(me);
  1817.   }
  1818.   
  1819.   
  1820. + PRIVATE void PlainToHTML_free ARGS1(HTStructured *, me)
  1821. + {
  1822. +     HTMLGen_end_element(me, HTML_PRE);
  1823. +     HTMLGen_end_element(me, HTML_BODY);
  1824. +     HTMLGen_end_element(me, HTML_HTML);
  1825. +     HTMLGen_free(me);
  1826. + }
  1827.   
  1828.   PRIVATE void HTMLGen_abort ARGS2(HTStructured *, me, HTError, e)
  1829.   {
  1830.       HTMLGen_free(me);
  1831. ***************
  1832. *** 152,158 ****
  1833.   
  1834.   PRIVATE void PlainToHTML_abort ARGS2(HTStructured *, me, HTError, e)
  1835.   {
  1836. !     HTMLGen_free(me);
  1837.   }
  1838.   
  1839.   
  1840. --- 230,236 ----
  1841.   
  1842.   PRIVATE void PlainToHTML_abort ARGS2(HTStructured *, me, HTError, e)
  1843.   {
  1844. !     PlainToHTML_free(me);
  1845.   }
  1846.   
  1847.   
  1848. ***************
  1849. *** 183,189 ****
  1850.   
  1851.       me->target = output;
  1852.       me->targetClass = *me->target->isa; /* Copy pointers to routines for speed*/
  1853.       return me;
  1854.   }
  1855.   
  1856. --- 261,271 ----
  1857.   
  1858.       me->target = output;
  1859.       me->targetClass = *me->target->isa; /* Copy pointers to routines for speed*/
  1860. !     
  1861. !     me->write_pointer = me->buffer;
  1862. !     me->line_break =     me->buffer;
  1863. !     me->cleanness =     0;
  1864. !     me->preformatted =     NO;
  1865.       return me;
  1866.   }
  1867.   
  1868. ***************
  1869. *** 217,232 ****
  1870.       HTParentAnchor *,    anchor,    
  1871.       HTStream *,        sink)
  1872.   {
  1873. !     HTStream* me = (HTStream*)malloc(sizeof(*me));
  1874.       if (me == NULL) outofmem(__FILE__, "PlainToHTML");
  1875. !     me->isa = (HTStreamClass*) &PlainToHTMLConversion;       
  1876.   
  1877.       me->target = sink;
  1878.       me->targetClass = *me->target->isa;
  1879.           /* Copy pointers to routines for speed*/
  1880.       
  1881. !     PUTS("<BODY>\n<PRE>\n");
  1882. !     return me;
  1883.   }
  1884.   
  1885.   
  1886. --- 299,315 ----
  1887.       HTParentAnchor *,    anchor,    
  1888.       HTStream *,        sink)
  1889.   {
  1890. !     HTStructured* me = (HTStructured*)malloc(sizeof(*me));
  1891.       if (me == NULL) outofmem(__FILE__, "PlainToHTML");
  1892. !     me->isa = (HTStructuredClass*) &PlainToHTMLConversion;       
  1893.   
  1894.       me->target = sink;
  1895.       me->targetClass = *me->target->isa;
  1896.           /* Copy pointers to routines for speed*/
  1897.       
  1898. !     HTMLGen_put_string(me, "<HTML>\n<BODY>\n<PRE>\n");
  1899. !     me->preformatted = YES;
  1900. !     return (HTStream*) me;
  1901.   }
  1902.   
  1903.   
  1904. *** ../../../../2.12/WWW/Library/Implementation/HTMLGen.h    Thu Jun 10 11:55:22 1993
  1905. --- HTMLGen.h    Thu Nov  4 10:07:12 1993
  1906. ***************
  1907. *** 1,8 ****
  1908. ! /*  */
  1909. ! /*              HTML generator
  1910. ! */
  1911.   #ifndef HTMLGEN_H
  1912.   #define HTMLGEN_H
  1913.   
  1914. --- 1,10 ----
  1915. ! /*                  /Net/dxcern/userd/timbl/hypertext/WWW/Library/Implementation/HTMLGen.html
  1916. !                                       HTML GENERATOR
  1917. !                                              
  1918. !    This module converts structed stream into stream.  That is, given a stream to write to,
  1919. !    it will give you a structured stream to
  1920. !    
  1921. !  */
  1922.   #ifndef HTMLGEN_H
  1923.   #define HTMLGEN_H
  1924.   
  1925. ***************
  1926. *** 24,29 ****
  1927. --- 26,32 ----
  1928.   
  1929.   
  1930.   #endif
  1931.   /*
  1932.   
  1933.       */
  1934. *** ../../../../2.12/WWW/Library/Implementation/HTPasswd.c    Thu Oct  7 14:42:24 1993
  1935. --- HTPasswd.c    Wed Nov  3 16:20:34 1993
  1936. ***************
  1937. *** 28,33 ****
  1938. --- 28,62 ----
  1939.   PRIVATE char salt_chars [65] =
  1940.       "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./";
  1941.   
  1942. + /* PRIVATE                        next_rec()
  1943. + **        GO TO THE BEGINNING OF THE NEXT RECORD
  1944. + **        Otherwise like HTAAFile_nextRec() but
  1945. + **        does not handle continuation lines
  1946. + **        (because password file has none).
  1947. + ** ON ENTRY:
  1948. + **    fp    is the password file from which records are read from.
  1949. + **
  1950. + ** ON EXIT:
  1951. + **    returns    nothing. File read pointer is located at the beginning
  1952. + **        of the next record.
  1953. + */
  1954. + PRIVATE void next_rec ARGS1(FILE *, fp)
  1955. + {
  1956. +     int ch = getc(fp);
  1957. +     while (ch != EOF  &&  ch != CR  &&  ch != LF)
  1958. +     ch = getc(fp);        /* Skip until end-of-line */
  1959. +     while (ch != EOF &&
  1960. +        (ch == CR  ||  ch == LF))    /*Skip carriage returns and linefeeds*/
  1961. +     ch = getc(fp);
  1962. +     if (ch != EOF)
  1963. +     ungetc(ch, fp);
  1964. + }
  1965.   /* PUBLIC                        HTAA_encryptPasswd()
  1966.   **        ENCRYPT PASSWORD TO THE FORM THAT IT IS SAVED
  1967.   **        IN THE PASSWORD FILE.
  1968. ***************
  1969. *** 96,101 ****
  1970. --- 125,136 ----
  1971.   ** ON EXIT:
  1972.   **    returns        YES, if password matches the encrypted one.
  1973.   **            NO, if not, or if either parameter is NULL.
  1974. + ** FIX:
  1975. + **    Only the length of original encrypted password is
  1976. + **    checked -- longer given passwords are accepted if
  1977. + **    common length is correct (but not shorter).
  1978. + **    This is to allow interoperation of servers and clients
  1979. + **    who have a hard-coded limit of 8 to password.
  1980.   */
  1981.   PUBLIC BOOL HTAA_passwdMatch ARGS2(CONST char *, password,
  1982.                      CONST char *, encrypted)
  1983. ***************
  1984. *** 104,114 ****
  1985.       int len;
  1986.       int status;
  1987.   
  1988. !     if (!password || !encrypted ||
  1989. !     13*((strlen(password)+7)/8) != strlen(encrypted))
  1990.       return NO;
  1991.   
  1992. !     len = strlen(encrypted);
  1993.   
  1994.       if (!(result = (char*)malloc(len + 1)))
  1995.       outofmem(__FILE__, "HTAA_encryptPasswd");
  1996. --- 139,150 ----
  1997.       int len;
  1998.       int status;
  1999.   
  2000. !     if (!password || !encrypted)
  2001.       return NO;
  2002.   
  2003. !     len = 13*((strlen(password)+7)/8);
  2004. !     if (len < strlen(encrypted))
  2005. !     return NO;
  2006.   
  2007.       if (!(result = (char*)malloc(len + 1)))
  2008.       outofmem(__FILE__, "HTAA_encryptPasswd");
  2009. ***************
  2010. *** 137,143 ****
  2011.       len -= 13;
  2012.       } /* while */
  2013.   
  2014. !     status = strcmp(result, encrypted);
  2015.   
  2016.       if (TRACE)
  2017.       fprintf(stderr,
  2018. --- 173,179 ----
  2019.       len -= 13;
  2020.       } /* while */
  2021.   
  2022. !     status = strncmp(result, encrypted, strlen(encrypted));
  2023.   
  2024.       if (TRACE)
  2025.       fprintf(stderr,
  2026. ***************
  2027. *** 155,161 ****
  2028.   }
  2029.   
  2030.   
  2031. ! /* PUBLIC                        HTAAFile_readPasswdRec()
  2032.   **            READ A RECORD FROM THE PASSWORD FILE
  2033.   ** ON ENTRY:
  2034.   **    fp        open password file
  2035. --- 191,197 ----
  2036.   }
  2037.   
  2038.   
  2039. ! /* PUBLIC                    HTAAFile_readPasswdRec()
  2040.   **            READ A RECORD FROM THE PASSWORD FILE
  2041.   ** ON ENTRY:
  2042.   **    fp        open password file
  2043. ***************
  2044. *** 189,200 ****
  2045.       return EOF;
  2046.       }
  2047.       else if (terminator == CR  ||  terminator == LF) {    /* End of line */
  2048. !     HTAAFile_nextRec(fp);
  2049.       return 1;
  2050.       }
  2051.       else {
  2052.       HTAAFile_readField(fp, out_password, MAX_PASSWORD_LEN);
  2053. !     HTAAFile_nextRec(fp);
  2054.       return 2;
  2055.       }
  2056.   }
  2057. --- 225,236 ----
  2058.       return EOF;
  2059.       }
  2060.       else if (terminator == CR  ||  terminator == LF) {    /* End of line */
  2061. !     next_rec(fp);
  2062.       return 1;
  2063.       }
  2064.       else {
  2065.       HTAAFile_readField(fp, out_password, MAX_PASSWORD_LEN);
  2066. !     next_rec(fp);
  2067.       return 2;
  2068.       }
  2069.   }
  2070. *** ../../../../2.12/WWW/Library/Implementation/HTRules.c    Tue Oct  5 10:47:51 1993
  2071. --- HTRules.c    Wed Nov  3 16:20:34 1993
  2072. ***************
  2073. *** 10,19 ****
  2074.   **      17 Jun 92       Bug fix: pass and fail failed if didn't contain '*' TBL
  2075.   **       1 Sep 93       Bug fix: no memory check - Nathan Torkington
  2076.   **                      BYTE_ADDRESSING removed - Arthur Secret
  2077. ! **    11 Sep 93 MD    Changed %i into %d in debug printf. 
  2078.   **            VMS does not recognize %i.
  2079.   **            Bug Fix: in case of PASS, only one parameter to printf.
  2080. ! **    19 Sep 93    Added Access Authorization stuff - AL
  2081.   **
  2082.   */
  2083.   
  2084. --- 10,20 ----
  2085.   **      17 Jun 92       Bug fix: pass and fail failed if didn't contain '*' TBL
  2086.   **       1 Sep 93       Bug fix: no memory check - Nathan Torkington
  2087.   **                      BYTE_ADDRESSING removed - Arthur Secret
  2088. ! **    11 Sep 93  MD    Changed %i into %d in debug printf. 
  2089.   **            VMS does not recognize %i.
  2090.   **            Bug Fix: in case of PASS, only one parameter to printf.
  2091. ! **    19 Sep 93  AL    Added Access Authorization stuff.
  2092. ! **     1 Nov 93  AL    Added htbin.
  2093.   **
  2094.   */
  2095.   
  2096. ***************
  2097. *** 35,40 ****
  2098. --- 36,47 ----
  2099.       char *        equiv;
  2100.   } rule;
  2101.   
  2102. + /*    Global variables
  2103. + **    ----------------
  2104. + */
  2105. + PUBLIC char *HTBinDir = NULL;    /* Physical /htbin directory path.    */
  2106. +                                 /* In future this should not be global.    */
  2107.   /*    Module-wide variables
  2108.   **    ---------------------
  2109.   */
  2110. ***************
  2111. *** 341,347 ****
  2112.               status >= 1? quality         : 1.0,
  2113.               status >= 2 ? secs             : 0.0,
  2114.               status >= 3 ? secs_per_byte     : 0.0 );
  2115. !     
  2116.       } else {
  2117.       op =    0==strcasecomp(word1, "map")  ?    HT_Map
  2118.           :    0==strcasecomp(word1, "pass") ?    HT_Pass
  2119. --- 348,357 ----
  2120.               status >= 1? quality         : 1.0,
  2121.               status >= 2 ? secs             : 0.0,
  2122.               status >= 3 ? secs_per_byte     : 0.0 );
  2123. !     } else if (0==strcasecomp(word1, "htbin")) { /* Physical /htbin location */
  2124. !     StrAllocCopy(HTBinDir, word2);
  2125.       } else {
  2126.       op =    0==strcasecomp(word1, "map")  ?    HT_Map
  2127.           :    0==strcasecomp(word1, "pass") ?    HT_Pass
  2128. *** ../../../../2.12/WWW/Library/Implementation/HTRules.h    Tue Oct  5 11:04:24 1993
  2129. --- HTRules.h    Thu Nov  4 10:07:13 1993
  2130. ***************
  2131. *** 27,32 ****
  2132. --- 27,37 ----
  2133.           HT_Protect
  2134.   } HTRuleOp;
  2135.   
  2136. + #ifndef HTBINDIR
  2137. + #define HTBINDIR "/htbin"       /* Default /htbin location */
  2138. + #endif
  2139. + extern char * HTBinDir;         /* Physical /htbin location */
  2140.   /*
  2141.   
  2142.   HTAddRule:  Add rule to the list
  2143. *** ../../../../2.12/WWW/Library/Implementation/HTStyle.h    Thu Sep  2 18:02:22 1993
  2144. --- HTStyle.h    Thu Nov  4 10:07:12 1993
  2145. ***************
  2146. *** 7,13 ****
  2147.      A StyleSheet is a collection of styles, defining the translation necessary to represent
  2148.      a document. It is a linked list of styles.
  2149.      
  2150. ! Overiding this module
  2151.   
  2152.      Why is the style structure declared in the HTStyle.h module, instead of having the user
  2153.      browser define the structure, and the HTStyle routines just use sizeof() for copying?
  2154. --- 7,13 ----
  2155.      A StyleSheet is a collection of styles, defining the translation necessary to represent
  2156.      a document. It is a linked list of styles.
  2157.      
  2158. ! Overriding this module
  2159.   
  2160.      Why is the style structure declared in the HTStyle.h module, instead of having the user
  2161.      browser define the structure, and the HTStyle routines just use sizeof() for copying?
  2162. ***************
  2163. *** 55,61 ****
  2164.   #endif
  2165.   
  2166.   #ifdef NeXT_suppressed
  2167. ! #include 60;appkit/appkit.h>
  2168.   typedef NXCoord HTCoord;
  2169.   #define HTParagraphStyle NXTextStyle
  2170.   #define HTCoord NXCoord
  2171. --- 55,61 ----
  2172.   #endif
  2173.   
  2174.   #ifdef NeXT_suppressed
  2175. ! #include <appkit/appkit.h>
  2176.   typedef NXCoord HTCoord;
  2177.   #define HTParagraphStyle NXTextStyle
  2178.   #define HTCoord NXCoord
  2179. ***************
  2180. *** 174,179 ****
  2181. --- 174,180 ----
  2182.   #endif
  2183.   #define CLEAR_POINTER ((void *)-1)      /* Pointer value means "clear me" */
  2184.   #endif /* HTStyle_H */
  2185.   
  2186.   /*
  2187.   
  2188. *** ../../../../2.12/WWW/Library/Implementation/HTTP.c    Tue Oct  5 10:47:53 1993
  2189. --- HTTP.c    Wed Oct 13 16:53:44 1993
  2190. ***************
  2191. *** 85,90 ****
  2192. --- 85,91 ----
  2193.       char crlf[3];            /* A CR LF equivalent string */
  2194.       HTStream *    target = NULL;        /* Unconverted data */
  2195.       HTFormat format_in;            /* Format arriving in the message */
  2196. +     char *auth = NULL;            /* Authorization information */
  2197.       
  2198.       CONST char* gate = 0;        /* disable this feature */
  2199.       SockA soc_address;            /* Binary network address */
  2200. ***************
  2201. *** 124,129 ****
  2202. --- 125,166 ----
  2203.       }
  2204.       
  2205.   retry:
  2206. + /*
  2207. + ** Compose authorization information (this was moved here
  2208. + ** from after the making of the connection so that the connection
  2209. + ** wouldn't have to wait while prompting username and password
  2210. + ** from the user).                -- AL 13.10.93
  2211. + */
  2212. + #ifdef ACCESS_AUTH
  2213. + #define FREE(x)    if (x) {free(x); x=NULL;}
  2214. +     {
  2215. +     char *docname;
  2216. +     char *hostname;
  2217. +     char *colon;
  2218. +     int portnumber;
  2219. +     docname = HTParse(arg, "", PARSE_PATH);
  2220. +     hostname = HTParse((gate ? gate : arg), "", PARSE_HOST);
  2221. +     if (hostname &&
  2222. +         NULL != (colon = strchr(hostname, ':'))) {
  2223. +         *(colon++) = NULL;    /* Chop off port number */
  2224. +         portnumber = atoi(colon);
  2225. +     }
  2226. +     else portnumber = 80;
  2227. +     
  2228. +     auth = HTAA_composeAuth(hostname, portnumber, docname);
  2229. +     if (TRACE) {
  2230. +         if (auth)
  2231. +         fprintf(stderr, "HTTP: Sending authorization: %s\n", auth);
  2232. +         else
  2233. +         fprintf(stderr, "HTTP: Not sending authorization (yet)\n");
  2234. +     }
  2235. +     FREE(hostname);
  2236. +     FREE(docname);
  2237. +     }
  2238. + #endif /* ACCESS_AUTH */
  2239.      
  2240.   /*    Now, let's get a socket set up from the server for the data:
  2241.   */      
  2242. ***************
  2243. *** 199,233 ****
  2244.             StrAllocCat(command, line);
  2245.   
  2246.   #ifdef ACCESS_AUTH
  2247. ! #define FREE(x)    if (x) {free(x); x=NULL;}
  2248. !     {
  2249. !         char *docname;
  2250. !         char *hostname;
  2251. !         char *colon;
  2252. !         int portnumber;
  2253. !         char *auth;
  2254. !         docname = HTParse(arg, "", PARSE_PATH);
  2255. !         hostname = HTParse((gate ? gate : arg), "", PARSE_HOST);
  2256. !         if (hostname &&
  2257. !         NULL != (colon = strchr(hostname, ':'))) {
  2258. !         *(colon++) = NULL;    /* Chop off port number */
  2259. !         portnumber = atoi(colon);
  2260. !         }
  2261. !         else portnumber = 80;
  2262. !         if (NULL!=(auth=HTAA_composeAuth(hostname, portnumber, docname))) {
  2263. !         sprintf(line, "%s%c%c", auth, CR, LF);
  2264. !         StrAllocCat(command, line);
  2265. !         }
  2266. !         if (TRACE) {
  2267. !         if (auth)
  2268. !             fprintf(stderr, "HTTP: Sending authorization: %s\n", auth);
  2269. !         else
  2270. !             fprintf(stderr, "HTTP: Not sending authorization (yet)\n");
  2271. !         }
  2272. !         FREE(hostname);
  2273. !         FREE(docname);
  2274.       }
  2275.   #endif /* ACCESS_AUTH */
  2276.       }
  2277. --- 236,244 ----
  2278.             StrAllocCat(command, line);
  2279.   
  2280.   #ifdef ACCESS_AUTH
  2281. !     if (auth != NULL) {
  2282. !         sprintf(line, "%s%c%c", auth, CR, LF);
  2283. !         StrAllocCat(command, line);
  2284.       }
  2285.   #endif /* ACCESS_AUTH */
  2286.       }
  2287. *** ../../../../2.12/WWW/Library/Implementation/HTUtils.h    Mon Oct 11 12:01:52 1993
  2288. --- HTUtils.h    Mon Oct 18 16:34:34 1993
  2289. ***************
  2290. *** 183,190 ****
  2291.   #define BOOL BOOLEAN
  2292.   #endif
  2293.   #ifndef YES
  2294. ! #define YES (BOOLEAN)1
  2295. ! #define NO (BOOLEAN)0
  2296.   #endif
  2297.   
  2298.   #ifndef min
  2299. --- 183,190 ----
  2300.   #define BOOL BOOLEAN
  2301.   #endif
  2302.   #ifndef YES
  2303. ! #define YES (BOOL)1
  2304. ! #define NO (BOOL)0
  2305.   #endif
  2306.   
  2307.   #ifndef min
  2308. *** ../../../../2.12/WWW/Library/Implementation/HText.h    Mon Jun 21 16:13:19 1993
  2309. --- HText.h    Thu Nov  4 16:16:13 1993
  2310. ***************
  2311. *** 5,11 ****
  2312.   
  2313.   /*
  2314.   
  2315. !    This is the C interface to the Objective-C (or whatever) HyperText class.
  2316.      
  2317.    */
  2318.   #ifndef HTEXT_H
  2319. --- 5,13 ----
  2320.   
  2321.   /*
  2322.   
  2323. !    This is the C interface to the Objective-C (or whatever) Style-oriented HyperText
  2324. !    class. It is used when a style-oriented text object is available or craeted in order to
  2325. !    display hypertext.
  2326.      
  2327.    */
  2328.   #ifndef HTEXT_H
  2329. ***************
  2330. *** 13,18 ****
  2331. --- 15,21 ----
  2332.   #include "HTAnchor.h"
  2333.   #include "HTStyle.h"
  2334.   #include "HTStream.h"
  2335. + #include "SGML.h"
  2336.   
  2337.   #ifdef SHORT_NAMES
  2338.   #define HTMainText                      HTMaText
  2339. ***************
  2340. *** 24,29 ****
  2341. --- 27,33 ----
  2342.   #define HText_endAppend                 HTHTEnAp
  2343.   #define HText_setStyle                  HTHTSeSt
  2344.   #define HText_appendCharacter           HTHTApCh
  2345. + #define HText_appendImage               HTHTApIm
  2346.   #define HText_appendText                HTHTApTe
  2347.   #define HText_appendParagraph           HTHTApPa
  2348.   #define HText_beginAnchor               HTHTBeAn
  2349. ***************
  2350. *** 55,139 ****
  2351.   extern HText * HTMainText;              /* Pointer to current main text */
  2352.   extern HTParentAnchor * HTMainAnchor;   /* Pointer to current text's anchor */
  2353.   
  2354. ! /*                      Creation and deletion
  2355. ! **
  2356. ! **      Create hypertext object                                 HText_new
  2357. ! */
  2358.    extern HText * HText_new PARAMS((HTParentAnchor * anchor));
  2359.    extern HText * HText_new2 PARAMS((HTParentAnchor * anchor,
  2360.                                   HTStream * output_stream));
  2361.   
  2362. ! /*      Free hypertext object                                   HText_free
  2363. ! */
  2364.   extern void     HText_free PARAMS((HText * me));
  2365.   
  2366.   
  2367. ! /*                      Object Building methods
  2368. ! **                      -----------------------
  2369. ! **
  2370. ! **      These are used by a parser to build the text in an object
  2371. ! **      HText_beginAppend must be called, then any combination of other
  2372. ! **      append calls, then HText_endAppend. This allows optimised
  2373. ! **      handling using buffers and caches which are flushed at the end.
  2374. ! */
  2375.   extern void HText_beginAppend PARAMS((HText * text));
  2376.   
  2377.   extern void HText_endAppend PARAMS((HText * text));
  2378.   
  2379. ! /*      Set the style for future text
  2380. ! */
  2381.   extern void HText_setStyle PARAMS((HText * text, HTStyle * style));
  2382.   
  2383. ! /*      Add one character
  2384. ! */
  2385.   extern void HText_appendCharacter PARAMS((HText * text, char ch));
  2386.   
  2387. ! /*      Add a zero-terminated string
  2388. ! */
  2389.   extern void HText_appendText PARAMS((HText * text, CONST char * str));
  2390.   
  2391. ! /*      New Paragraph
  2392. ! */
  2393.   extern void HText_appendParagraph PARAMS((HText * text));
  2394.   
  2395. ! /*      Start/end sensitive text
  2396. ! **
  2397. ! ** The anchor object is created and passed to HText_beginAnchor.
  2398. ! ** The senstive text is added to the text object, and then HText_endAnchor
  2399. ! ** is called. Anchors may not be nested.
  2400. ! */
  2401.   
  2402.   extern void HText_beginAnchor PARAMS((HText * text, HTChildAnchor * anc));
  2403.   extern void HText_endAnchor PARAMS((HText * text));
  2404.   
  2405.   
  2406. ! /*      Dump diagnostics to stderr
  2407. ! */
  2408.   extern void HText_dump PARAMS((HText * me));
  2409.   
  2410. ! /*      Return the anchor associated with this node
  2411. ! */
  2412.   extern HTParentAnchor * HText_nodeAnchor PARAMS((HText * me));
  2413.   
  2414.   
  2415. ! /*              Browsing functions
  2416. ! **              ------------------
  2417. ! */
  2418.   
  2419. ! /*      Bring to front and highlight it
  2420. ! */
  2421.   
  2422.   extern BOOL HText_select PARAMS((HText * text));
  2423.   extern BOOL HText_selectAnchor PARAMS((HText * text, HTChildAnchor* anchor));
  2424.   
  2425. ! /*              Editing functions
  2426. ! **              -----------------
  2427. ! **
  2428. ! **      These are called from the application. There are many more functions
  2429. ! **      not included here from the orginal text object. These functions
  2430. ! **      NEED NOT BE IMPLEMENTED in a browser which cannot edit.
  2431. ! */
  2432.   
  2433.   /*      Style handling:
  2434.   */
  2435.   /*      Apply this style to the selection
  2436. --- 59,221 ----
  2437.   extern HText * HTMainText;              /* Pointer to current main text */
  2438.   extern HTParentAnchor * HTMainAnchor;   /* Pointer to current text's anchor */
  2439.   
  2440. ! /*
  2441. ! Creation and deletion
  2442. !   HTEXT_NEW: CREATE HYPERTEXT OBJECT
  2443. !   
  2444. !    There are several methods depending on how much you want to specify. The output stream
  2445. !    is used with objects which need to output the hypertext to a stream.  The structure is
  2446. !    for objects which need to refer to the structure which is kep by the creating stream.
  2447. !    
  2448. !  */
  2449.    extern HText * HText_new PARAMS((HTParentAnchor * anchor));
  2450.    extern HText * HText_new2 PARAMS((HTParentAnchor * anchor,
  2451.                                   HTStream * output_stream));
  2452.   
  2453. !  extern HText * HText_new3 PARAMS((HTParentAnchor * anchor,
  2454. !                                 HTStream * output_stream,
  2455. !                                 HTStructured * structure));
  2456. ! /*
  2457. !   FREE HYPERTEXT OBJECT
  2458. !   
  2459. !  */
  2460.   extern void     HText_free PARAMS((HText * me));
  2461.   
  2462.   
  2463. ! /*
  2464. ! Object Building methods
  2465. !    These are used by a parser to build the text in an object HText_beginAppend must be
  2466. !    called, then any combination of other append calls, then HText_endAppend. This allows
  2467. !    optimised handling using buffers and caches which are flushed at the end.
  2468. !    
  2469. !  */
  2470.   extern void HText_beginAppend PARAMS((HText * text));
  2471.   
  2472.   extern void HText_endAppend PARAMS((HText * text));
  2473.   
  2474. ! /*
  2475. !   SET THE STYLE FOR FUTURE TEXT
  2476. !   
  2477. !  */
  2478.   extern void HText_setStyle PARAMS((HText * text, HTStyle * style));
  2479.   
  2480. ! /*
  2481. !   ADD ONE CHARACTER
  2482. !   
  2483. !  */
  2484.   extern void HText_appendCharacter PARAMS((HText * text, char ch));
  2485.   
  2486. ! /*
  2487. !   ADD A ZERO-TERMINATED STRING
  2488. !   
  2489. !  */
  2490.   extern void HText_appendText PARAMS((HText * text, CONST char * str));
  2491.   
  2492. ! /*
  2493. !   NEW PARAGRAPH
  2494. !   
  2495. !    and similar things
  2496. !    
  2497. !  */
  2498.   extern void HText_appendParagraph PARAMS((HText * text));
  2499.   
  2500. ! extern void HText_appendLineBreak PARAMS((HText * text));
  2501.   
  2502. + extern void HText_appendHorizontalRule PARAMS((HText * text));
  2503. + /*
  2504. +   START/END SENSITIVE TEXT
  2505. +   
  2506. +  */
  2507. + /*
  2508. +    The anchor object is created and passed to HText_beginAnchor. The senstive text is
  2509. +    added to the text object, and then HText_endAnchor is called. Anchors may not be
  2510. +    nested.
  2511. +    
  2512. +  */
  2513.   extern void HText_beginAnchor PARAMS((HText * text, HTChildAnchor * anc));
  2514.   extern void HText_endAnchor PARAMS((HText * text));
  2515.   
  2516.   
  2517. ! /*
  2518. !   APPEND AN INLINE IMAGE
  2519. !   
  2520. !    The image is handled by the creation of an anchor whose destination is the image
  2521. !    document to be included. The semantics is the intended inline display of the image.
  2522. !    
  2523. !    An alternative implementation could be, for example, to begin an anchor, append the
  2524. !    alternative text or "IMAGE", then end the anchor. This would simply generate some text
  2525. !    linked to the image itself as a separate document.
  2526. !    
  2527. !  */
  2528. ! extern void HText_appendImage PARAMS((
  2529. !         HText *         text,
  2530. !         HTChildAnchor * anc,
  2531. !         CONST char *    alternative_text,
  2532. !         int             alignment,
  2533. !         BOOL            isMap));
  2534. ! /*
  2535. !   DUMP DIAGNOSTICS TO STDERR
  2536. !   
  2537. !  */
  2538.   extern void HText_dump PARAMS((HText * me));
  2539.   
  2540. ! /*
  2541. !   RETURN THE ANCHOR ASSOCIATED WITH THIS NODE
  2542. !   
  2543. !  */
  2544.   extern HTParentAnchor * HText_nodeAnchor PARAMS((HText * me));
  2545.   
  2546.   
  2547. ! /*
  2548.   
  2549. ! Browsing functions
  2550.   
  2551. +  */
  2552. + /*
  2553. +   BRING TO FRONT AND HIGHLIGHT IT
  2554. +   
  2555. +  */
  2556.   extern BOOL HText_select PARAMS((HText * text));
  2557.   extern BOOL HText_selectAnchor PARAMS((HText * text, HTChildAnchor* anchor));
  2558.   
  2559. ! /*
  2560.   
  2561. + Editing functions
  2562. +    These are called from the application. There are many more functions not included here
  2563. +    from the orginal text object. These functions NEED NOT BE IMPLEMENTED in a browser
  2564. +    which cannot edit.
  2565. +    
  2566. +  */
  2567.   /*      Style handling:
  2568.   */
  2569.   /*      Apply this style to the selection
  2570. ***************
  2571. *** 177,180 ****
  2572.   #endif /* HTEXT_H */
  2573.   /*
  2574.   
  2575. !    end  */
  2576. --- 259,262 ----
  2577.   #endif /* HTEXT_H */
  2578.   /*
  2579.   
  2580. !    end */
  2581. *** ../../../../2.12/WWW/Library/Implementation/SGML.c    Thu Sep  2 19:03:14 1993
  2582. --- SGML.c    Thu Nov  4 15:43:09 1993
  2583. ***************
  2584. *** 265,271 ****
  2585.   **        NULL        tag not found
  2586.   **        else        address of tag structure in dtd
  2587.   */
  2588. ! PRIVATE HTTag * find_tag ARGS2(CONST SGML_dtd*, dtd, char *, string)
  2589.   {
  2590.       int high, low, i, diff;
  2591.       for(low=0, high=dtd->number_of_tags;
  2592. --- 265,271 ----
  2593.   **        NULL        tag not found
  2594.   **        else        address of tag structure in dtd
  2595.   */
  2596. ! PUBLIC HTTag * SGMLFindTag ARGS2(CONST SGML_dtd*, dtd, CONST char *, string)
  2597.   {
  2598.       int high, low, i, diff;
  2599.       for(low=0, high=dtd->number_of_tags;
  2600. ***************
  2601. *** 424,430 ****
  2602.           }
  2603.           HTChunkTerminate(string) ;
  2604.   
  2605. !         t = find_tag(dtd, string->data);
  2606.           if (!t) {
  2607.           if(TRACE) fprintf(stderr, "SGML: *** Unknown element %s\n",
  2608.               string->data);
  2609. --- 424,430 ----
  2610.           }
  2611.           HTChunkTerminate(string) ;
  2612.   
  2613. !         t = SGMLFindTag(dtd, string->data);
  2614.           if (!t) {
  2615.           if(TRACE) fprintf(stderr, "SGML: *** Unknown element %s\n",
  2616.               string->data);
  2617. ***************
  2618. *** 563,569 ****
  2619.           if (!*string->data)    {    /* Empty end tag */
  2620.               t = context->element_stack->tag;
  2621.           } else {
  2622. !         t = find_tag(dtd, string->data);
  2623.           }
  2624.           if (!t) {
  2625.           if(TRACE) fprintf(stderr,
  2626. --- 563,569 ----
  2627.           if (!*string->data)    {    /* Empty end tag */
  2628.               t = context->element_stack->tag;
  2629.           } else {
  2630. !         t = SGMLFindTag(dtd, string->data);
  2631.           }
  2632.           if (!t) {
  2633.           if(TRACE) fprintf(stderr,
  2634. *** ../../../../2.12/WWW/Library/Implementation/SGML.h    Fri Sep  3 15:24:43 1993
  2635. --- SGML.h    Thu Nov  4 15:51:31 1993
  2636. ***************
  2637. *** 90,119 ****
  2638.   
  2639.   /*__________________________________________________________________________
  2640.   */
  2641. - /*              Structured Object definition
  2642. - **
  2643. - **      A structured object is something which can reasonably be
  2644. - **      represented in SGML.  I'll rephrase that.  A structured
  2645. - **      object is am ordered tree-structured arrangement of data
  2646. - **      which is representable as text.
  2647. - **
  2648. - **      The SGML parer outputs to a Structured object.
  2649. - **      A Structured object can output its contents
  2650. - **      to another Structured Object.
  2651. - **      It's a kind of typed stream.  The architecure
  2652. - **      is largely Dan Conolly's.
  2653. - **      Elements and entities are passed to the sob by number, implying
  2654. - **      a knowledge of the DTD.
  2655. - **      Knowledge of the SGML syntax is not here, though.
  2656. - **
  2657. - **      Superclass: HTStream
  2658. - */
  2659.   
  2660.   
  2661. ! /*      The creation methods will vary on the type of Structured Object.
  2662. ! **      Maybe the callerData is enough info to pass along.
  2663. ! */
  2664.   
  2665.   typedef struct _HTStructured HTStructured;
  2666.   
  2667.   typedef struct _HTStructuredClass{
  2668. --- 90,114 ----
  2669.   
  2670.   /*__________________________________________________________________________
  2671.   */
  2672.   
  2673. + /*
  2674.   
  2675. ! Structured Object definition
  2676.   
  2677. +    A structured object is something which can reasonably be represented in SGML.  I'll
  2678. +    rephrase that.  A structured object is am ordered tree-structured arrangement of data
  2679. +    which is representable as text.The SGML parer outputs to a Structured object. A
  2680. +    Structured object can output its contents to another Structured Object. It's a kind of
  2681. +    typed stream. The architecure is largely Dan Conolly's. Elements and entities are
  2682. +    passed to the sob by number, implying a knowledge of the DTD. Knowledge of the SGML
  2683. +    syntax is not here, though.
  2684. +    
  2685. +    Superclass: HTStream
  2686. +    
  2687. +    The creation methods will vary on the type of Structured Object.Maybe the callerData is
  2688. +    enough info to pass along.
  2689. +    
  2690. +  */
  2691.   typedef struct _HTStructured HTStructured;
  2692.   
  2693.   typedef struct _HTStructuredClass{
  2694. ***************
  2695. *** 156,165 ****
  2696.                   
  2697.   }HTStructuredClass;
  2698.   
  2699.   
  2700.   
  2701. ! /*      Create an SGML parser
  2702. ! **
  2703.   ** On entry,
  2704.   **      dtd             must point to a DTD structure as defined above
  2705.   **      callbacks       must point to user routines.
  2706. --- 151,172 ----
  2707.                   
  2708.   }HTStructuredClass;
  2709.   
  2710. + /*
  2711.   
  2712. + Find a Tag by Name
  2713.   
  2714. !    Returns a pointer to the tag within the DTD.
  2715. !    
  2716. !  */
  2717. ! extern HTTag * SGMLFindTag PARAMS((CONST SGML_dtd* dtd, CONST char * string));
  2718. ! /*
  2719. ! Create an SGML parser
  2720. !  */
  2721. ! /*
  2722.   ** On entry,
  2723.   **      dtd             must point to a DTD structure as defined above
  2724.   **      callbacks       must point to user routines.
  2725. ***************
  2726. *** 177,182 ****
  2727. --- 184,194 ----
  2728.   
  2729.   
  2730.   #endif  /* SGML_H */
  2731.   
  2732.   
  2733.   
  2734. *** ../../../../2.12/WWW/Library/Implementation/Version.make    Thu Oct  7 17:50:45 1993
  2735. --- Version.make    Wed Nov  3 16:20:38 1993
  2736. ***************
  2737. *** 1 ****
  2738. ! VC = 2.12
  2739. --- 1 ----
  2740. ! VC = 2.13
  2741. *** ../../../../2.12/WWW/Library/Implementation/tcp.h    Tue Oct  5 11:04:28 1993
  2742. --- tcp.h    Thu Nov  4 10:07:14 1993
  2743. ***************
  2744. *** 2,8 ****
  2745.                                      SYSTEM DEPENDENCIES
  2746.                                                
  2747.      System-system differences for TCP include files and macros. This file includes for each
  2748. !    system the files necessary for network and file I/O.
  2749.      
  2750.     AUTHORS
  2751.     
  2752. --- 2,8 ----
  2753.                                      SYSTEM DEPENDENCIES
  2754.                                                
  2755.      System-system differences for TCP include files and macros. This file includes for each
  2756. !    system the files necessary for network and file I/O.  Part of libwww.
  2757.      
  2758.     AUTHORS
  2759.     
  2760. ***************
  2761. *** 461,466 ****
  2762. --- 461,475 ----
  2763.   #ifdef mips
  2764.   extern int errno;
  2765.   #endif
  2766. + /*
  2767. + OSF/1
  2768. +  */
  2769. + #ifdef __osf__
  2770. + #define USE_DIRENT
  2771. + #endif /* OSF1 AXP */
  2772.   
  2773.   
  2774.   /*
  2775.