lib_4.0C_1.fix
上传用户:zlh9724
上传日期:2007-01-04
资源大小:1991k
文件大小:128k
源码类别:

浏览器

开发平台:

Unix_Linux

  1. diff -c Library/Repository/Implementation/HTAABrow.c:2.28.4.1 Library/Repository/Implementation/HTAABrow.c:2.28
  2. *** Library/Repository/Implementation/HTAABrow.c:2.28.4.1 Tue Jan 23 16:31:15 1996
  3. --- Library/Repository/Implementation/HTAABrow.c Tue Jan 23 16:31:15 1996
  4. ***************
  5. *** 768,810 ****
  6.       return (HTPasswordDialog(req));
  7.   }
  8.   
  9. - /*
  10. - ** Setup HTTP access authentication
  11. - */
  12. - PUBLIC BOOL HTAA_authentication (HTRequest * request)
  13. - {
  14. -     HTAAScheme scheme;
  15. -     HTList *valid_schemes = HTList_new();
  16. -     HTAssocList **scheme_specifics = NULL;
  17. -     char *tmplate = NULL;
  18. -     if (request->WWWAAScheme) {
  19. -  if ((scheme = HTAAScheme_enum(request->WWWAAScheme)) != HTAA_UNKNOWN) {
  20. -      HTList_addObject(valid_schemes, (void *) scheme);
  21. -      if (!scheme_specifics) {
  22. -  int i;
  23. -  scheme_specifics = (HTAssocList**)
  24. -      malloc(HTAA_MAX_SCHEMES * sizeof(HTAssocList*));
  25. -  if (!scheme_specifics)
  26. -      outofmem(__FILE__, "HTTPAuthentication");
  27. -  for (i=0; i < HTAA_MAX_SCHEMES; i++)
  28. -      scheme_specifics[i] = NULL;
  29. -      }
  30. -      scheme_specifics[scheme] = HTAA_parseArgList(request->WWWAARealm);
  31. -  } else if (PROT_TRACE) {
  32. -      HTRequest_addError(request, ERR_INFO, NO, HTERR_UNKNOWN_AA,
  33. -         (void *) request->WWWAAScheme, 0, "HTTPAuthentication");
  34. -      return NO;
  35. -  }
  36. -     }
  37. -     if (request->WWWprotection) {
  38. -  if (PROT_TRACE)
  39. -      TTYPrint(TDEST, "Protection template set to `%s'n",
  40. -      request->WWWprotection);
  41. -  StrAllocCopy(tmplate, request->WWWprotection);
  42. -     }
  43. -     request->valid_schemes = valid_schemes;
  44. -     request->scheme_specifics = scheme_specifics;
  45. -     request->prot_template = tmplate;
  46. -     return YES;
  47. - }
  48. --- 768,770 ----
  49. diff -c Library/Repository/Implementation/HTAABrow.html:2.20.4.1 Library/Repository/Implementation/HTAABrow.html:2.20
  50. *** Library/Repository/Implementation/HTAABrow.html:2.20.4.1 Tue Jan 23 16:31:16 1996
  51. --- Library/Repository/Implementation/HTAABrow.html Tue Jan 23 16:31:16 1996
  52. ***************
  53. *** 1,6 ****
  54.   <HEAD>
  55.   <TITLE>Browser side Access Auth</TITLE>
  56. ! <!-- Changed by: Henrik Frystyk Nielsen, 20-Jan-1996 -->
  57.   </HEAD>
  58.   <BODY>
  59.   
  60. --- 1,6 ----
  61.   <HEAD>
  62.   <TITLE>Browser side Access Auth</TITLE>
  63. ! <!-- Changed by: Henrik Frystyk Nielsen, 19-Nov-1995 -->
  64.   </HEAD>
  65.   <BODY>
  66.   
  67. ***************
  68. *** 186,197 ****
  69.   extern void HTAAForwardAuth_set (CONST char * scheme_name,
  70.     CONST char * scheme_specifics);
  71.   extern void HTAAForwardAuth_reset (void);
  72. - </PRE>
  73. - <H2>Setup HTTP access authentication</H2>
  74. - <PRE>
  75. - extern BOOL HTAA_authentication (HTRequest * request);
  76.   </PRE>
  77.   
  78.   <PRE>
  79. --- 186,191 ----
  80. diff -c Library/Repository/Implementation/HTAccess.c:1.108.2.1 Library/Repository/Implementation/HTAccess.c:1.108
  81. *** Library/Repository/Implementation/HTAccess.c:1.108.2.1 Tue Jan 23 16:31:17 1996
  82. --- Library/Repository/Implementation/HTAccess.c Tue Jan 23 16:31:17 1996
  83. ***************
  84. *** 423,443 ****
  85.   ** to NNTP and puts into the "newsgroups" header
  86.   ** Returns YES if request accepted, else NO
  87.   */
  88. ! PUBLIC BOOL HTCopyAnchor (HTAnchor * src_anchor, HTRequest * main_dest)
  89.   { 
  90.       HTRequest * src_req;
  91.       HTList * cur;
  92. !     if (!src_anchor || !main_dest) {
  93. !  if (WWWTRACE) TTYPrint(TDEST, "Copy........ BAD ARGUMENTn");
  94.    return NO;
  95. -     }
  96.   
  97.       /* Build the POST web if not already there */
  98. !     if (!main_dest->source) {
  99. !  src_req = HTRequest_dupInternal(main_dest);   /* Get a duplicate */
  100.    HTAnchor_clearHeader((HTParentAnchor *) src_anchor);
  101. -  src_req->method = METHOD_GET;
  102.    src_req->reload = HT_MEM_REFRESH;
  103.    src_req->output_stream = NULL;
  104.    src_req->output_format = WWW_SOURCE;  /* We want source (for now) */
  105.   
  106. --- 423,441 ----
  107.   ** to NNTP and puts into the "newsgroups" header
  108.   ** Returns YES if request accepted, else NO
  109.   */
  110. ! PUBLIC BOOL HTCopyAnchor (HTAnchor * src_anchor, HTRequest * main_req)
  111.   { 
  112.       HTRequest * src_req;
  113.       HTList * cur;
  114. !     if (!src_anchor || !main_req)
  115.    return NO;
  116.   
  117.       /* Build the POST web if not already there */
  118. !     if (!main_req->source) {
  119. !  src_req = HTRequest_dup(main_req);   /* First set up the source */
  120.    HTAnchor_clearHeader((HTParentAnchor *) src_anchor);
  121.    src_req->reload = HT_MEM_REFRESH;
  122. +  src_req->source = src_req;   /* Point to myself */
  123.    src_req->output_stream = NULL;
  124.    src_req->output_format = WWW_SOURCE;  /* We want source (for now) */
  125.   
  126. ***************
  127. *** 448,470 ****
  128.        HTMethod method = HTLink_method(main_link);
  129.        if (!main_link || method==METHOD_INVALID) {
  130.    if (WWWTRACE)
  131. !      TTYPrint(TDEST, "Copy Anchor. No destination found or unspecified methodn");
  132.    HTRequest_delete(src_req);
  133.    return NO;
  134.        }
  135. !      main_dest->GenMask |= HT_G_DATE;  /* Send date header */
  136. !      main_dest->reload = HT_CACHE_REFRESH;
  137. !      main_dest->method = method;
  138. !      main_dest->input_format = WWW_SOURCE;
  139. !      HTRequest_addDestination(src_req, main_dest);
  140. !      if (HTLoadAnchor(main_anchor, main_dest) == NO)
  141. !  return NO;
  142.    }
  143.   
  144.    /* For all other links in the source anchor */
  145.    if ((cur = HTAnchor_subLinks(src_anchor))) {
  146.        HTLink * pres;
  147. !      while ((pres = (HTLink *) HTList_nextObject(cur))) {
  148.    HTAnchor *dest = HTLink_destination(pres);
  149.    HTMethod method = HTLink_method(pres);
  150.    HTRequest *dest_req;
  151. --- 446,472 ----
  152.        HTMethod method = HTLink_method(main_link);
  153.        if (!main_link || method==METHOD_INVALID) {
  154.    if (WWWTRACE)
  155. !      TTYPrint(TDEST, "Copy Anchor. No destination found or unspecified method");
  156.    HTRequest_delete(src_req);
  157.    return NO;
  158.        }
  159. !      if (HTLink_result(main_link) == HT_LINK_NONE) {
  160. !  main_req->GenMask |= HT_G_DATE;  /* Send date header */
  161. !  main_req->source = src_req;
  162. !  main_req->reload = HT_CACHE_REFRESH;
  163. !  main_req->method = method;
  164. !  HTRequest_addDestination(src_req, main_req);
  165. !  main_req->input_format = WWW_SOURCE;
  166. !  if (HTLoadAnchor(main_anchor, main_req) == NO)
  167. !      return NO;
  168. !      }
  169.    }
  170.   
  171.    /* For all other links in the source anchor */
  172.    if ((cur = HTAnchor_subLinks(src_anchor))) {
  173.        HTLink * pres;
  174. !      while ((pres = (HTLink *) HTList_nextObject(cur)) &&
  175. !     HTLink_result(pres) == HT_LINK_NONE) {
  176.    HTAnchor *dest = HTLink_destination(pres);
  177.    HTMethod method = HTLink_method(pres);
  178.    HTRequest *dest_req;
  179. ***************
  180. *** 474,495 ****
  181.    dest);
  182.        return NO;
  183.    }
  184. !  dest_req = HTRequest_dupInternal(main_dest);
  185.    dest_req->GenMask |= HT_G_DATE;  /* Send date header */
  186.    dest_req->reload = HT_CACHE_REFRESH;
  187.    dest_req->method = method;
  188.    dest_req->output_stream = NULL;
  189.    dest_req->output_format = WWW_SOURCE;
  190. -  HTRequest_addDestination(src_req, dest_req);
  191.   
  192.    if (HTLoadAnchor(dest, dest_req) == NO)
  193.        return NO;
  194.        }
  195.    }
  196.       } else {  /* Use the existing Post Web and restart it */
  197. !  src_req = main_dest->source;
  198.    if (src_req->mainDestination)
  199. !      if (HTLoadDocument(main_dest, NO) == NO)
  200.    return NO;
  201.    if (src_req->destinations) {
  202.        HTRequest * pres;
  203. --- 476,499 ----
  204.    dest);
  205.        return NO;
  206.    }
  207. !  dest_req = HTRequest_dup(main_req);
  208.    dest_req->GenMask |= HT_G_DATE;  /* Send date header */
  209. +  dest_req->source = src_req;
  210.    dest_req->reload = HT_CACHE_REFRESH;
  211.    dest_req->method = method;
  212. +  HTRequest_addDestination(src_req, dest_req);
  213.    dest_req->output_stream = NULL;
  214.    dest_req->output_format = WWW_SOURCE;
  215.   
  216.    if (HTLoadAnchor(dest, dest_req) == NO)
  217.        return NO;
  218.        }
  219.    }
  220.       } else {  /* Use the existing Post Web and restart it */
  221. !  src_req = main_req->source;
  222.    if (src_req->mainDestination)
  223. !      if (HTLoadDocument(main_req, NO) == NO)
  224.    return NO;
  225.    if (src_req->destinations) {
  226.        HTRequest * pres;
  227. ***************
  228. *** 519,528 ****
  229.        HTRequest * dest_req)
  230.   {
  231.       HTMethod allowed = HTAnchor_methods(dest_anchor);
  232. !     if (!src_anchor || !dest_anchor || !dest_req) {
  233. !  if (WWWTRACE) TTYPrint(TDEST, "Upload...... BAD ARGUMENTn");
  234.    return NO;
  235. -     }
  236.       if (!(allowed & dest_req->method)) {
  237.    BOOL confirm = NO;
  238.    HTAlertCallback *cbf = HTAlert_find(HT_A_CONFIRM);
  239. --- 523,530 ----
  240.        HTRequest * dest_req)
  241.   {
  242.       HTMethod allowed = HTAnchor_methods(dest_anchor);
  243. !     if (!src_anchor || !dest_anchor || !dest_req)
  244.    return NO;
  245.       if (!(allowed & dest_req->method)) {
  246.    BOOL confirm = NO;
  247.    HTAlertCallback *cbf = HTAlert_find(HT_A_CONFIRM);
  248. diff -c Library/Repository/Implementation/HTConLen.c:2.4.4.1 Library/Repository/Implementation/HTConLen.c:2.4
  249. *** Library/Repository/Implementation/HTConLen.c:2.4.4.1 Tue Jan 23 16:31:18 1996
  250. --- Library/Repository/Implementation/HTConLen.c Tue Jan 23 16:31:18 1996
  251. ***************
  252. *** 125,131 ****
  253.    me->head = cur->next;
  254.    free_buf(cur);
  255.       }
  256. -     me->give_up = YES;
  257.       return HT_OK;
  258.   }
  259.   
  260. --- 125,130 ----
  261. ***************
  262. *** 187,201 ****
  263.   
  264.   PRIVATE int buf_abort (HTStream * me, HTList * e)
  265.   {
  266. -     HTBufItem * cur;
  267.       if (!me->give_up)
  268.    free_buf_all(me);
  269.       if (me->target)
  270.    (*me->target->isa->abort)(me->target,e);
  271. -     while ((cur = me->head)) {
  272. -  me->head = cur->next;
  273. -  free_buf(cur);
  274. -     }
  275.       free(me);
  276.       if (PROT_TRACE) TTYPrint(TDEST, "Length...... ABORTING...n");
  277.       return HT_ERROR;
  278. --- 186,195 ----
  279. diff -c Library/Repository/Implementation/HTDialog.c:2.3.2.1 Library/Repository/Implementation/HTDialog.c:2.3
  280. *** Library/Repository/Implementation/HTDialog.c:2.3.2.1 Tue Jan 23 16:31:19 1996
  281. --- Library/Repository/Implementation/HTDialog.c Tue Jan 23 16:31:20 1996
  282. ***************
  283. *** 136,153 ****
  284.    break;
  285.   
  286.         case HT_PROG_WRITE:
  287. !  if (HTRequest_isPostWeb(request)) {
  288. !      HTParentAnchor *anchor=HTRequest_anchor(HTRequest_source(request));
  289. !      long cl = HTAnchor_length(anchor);
  290. !      if (cl > 0) {
  291. !  long b_write = HTRequest_bytesWritten(request);
  292. !  double pro = (double) b_write/cl*100;
  293. !  char buf[10];
  294. !  HTNumToStr((unsigned long) cl, buf, 10);
  295. !  TTYPrint(TDEST, "Written (%d%% of %s)n", (int) pro, buf);
  296. !      } else
  297. !  TTYPrint(TDEST, "Writing...n");
  298. !  }
  299.    break;
  300.   
  301.         case HT_PROG_DONE:
  302. --- 136,142 ----
  303.    break;
  304.   
  305.         case HT_PROG_WRITE:
  306. !  TTYPrint(TDEST, "Writing...n");
  307.    break;
  308.   
  309.         case HT_PROG_DONE:
  310. diff -c Library/Repository/Implementation/HTEvntrg.c:2.24.2.1 Library/Repository/Implementation/HTEvntrg.c:2.24
  311. *** Library/Repository/Implementation/HTEvntrg.c:2.24.2.1 Tue Jan 23 16:31:20 1996
  312. --- Library/Repository/Implementation/HTEvntrg.c Tue Jan 23 16:31:20 1996
  313. ***************
  314. *** 431,437 ****
  315.        TTYPrint(TDEST, "Req Update.. updating for socket %un", s) ;
  316.       rqp->unregister = (ops & FD_UNREGISTER) ? YES : NO;
  317.       rqp->actions[0].rq = rq ;
  318. !     rqp->actions[0].ops |= ops ;
  319.       rqp->actions[0].cbf = cbf ;
  320.       rqp->actions[0].p = p ;
  321.       return;
  322. --- 431,437 ----
  323.        TTYPrint(TDEST, "Req Update.. updating for socket %un", s) ;
  324.       rqp->unregister = (ops & FD_UNREGISTER) ? YES : NO;
  325.       rqp->actions[0].rq = rq ;
  326. !     rqp->actions[0].ops = ops ;
  327.       rqp->actions[0].cbf = cbf ;
  328.       rqp->actions[0].p = p ;
  329.       return;
  330. ***************
  331. *** 459,466 ****
  332.       }
  333.   
  334.       if (THD_TRACE)
  335. !      TTYPrint(TDEST, "UnRegister.. %s entry for socket %d with ops %xn",
  336. !   (found) ? "Found" : "Didn't find", s, (unsigned) ops);
  337.       if (! found) 
  338.           return 0;
  339.   
  340. --- 459,466 ----
  341.       }
  342.   
  343.       if (THD_TRACE)
  344. !      TTYPrint(TDEST, "UnRegister.. %s entry for socket %dn",
  345. !  (found) ? "Found" : "Didn't find", s);
  346.       if (! found) 
  347.           return 0;
  348.   
  349. ***************
  350. *** 844,853 ****
  351.       HTRequest * rqp = NULL;
  352.       HTEventCallback *cbf = HTEvent_Retrieve( s, ops, &rqp);
  353.       /* although it makes no sense, callbacks can be null */
  354. !     if (!cbf || !rqp || rqp->priority == HT_PRIORITY_OFF) {
  355. !  if (THD_TRACE) TTYPrint(TDEST, "Callback.... No callback foundn");
  356.           return (0);
  357. -     }
  358.       return (*cbf)(s, rqp, ops);
  359.   }
  360.   
  361. --- 844,851 ----
  362.       HTRequest * rqp = NULL;
  363.       HTEventCallback *cbf = HTEvent_Retrieve( s, ops, &rqp);
  364.       /* although it makes no sense, callbacks can be null */
  365. !     if (!cbf || rqp->priority == HT_PRIORITY_OFF)
  366.           return (0);
  367.       return (*cbf)(s, rqp, ops);
  368.   }
  369.   
  370. ***************
  371. *** 860,869 ****
  372.       HTRequest * rqp = NULL;
  373.       HTEventCallback *cbf = HTEvent_Retrieve( s, ops, &rqp);
  374.       /* although it makes no sense, callbacks can be null*/
  375. !     if (!cbf || !rqp || rqp->priority == HT_PRIORITY_OFF) {
  376. !  if (THD_TRACE) TTYPrint(TDEST, "UserCallback No callback foundn");
  377.           return (0);
  378. -     }
  379.       return (*cbf)(s, rqp, ops);
  380.   }
  381.   
  382. --- 858,865 ----
  383.       HTRequest * rqp = NULL;
  384.       HTEventCallback *cbf = HTEvent_Retrieve( s, ops, &rqp);
  385.       /* although it makes no sense, callbacks can be null*/
  386. !     if (!cbf || rqp->priority == HT_PRIORITY_OFF)
  387.           return (0);
  388.       return (*cbf)(s, rqp, ops);
  389.   }
  390.   
  391. ***************
  392. *** 966,972 ****
  393.               s = all_fds.fd_array[ui] ;
  394.   #else 
  395.           for (s = 0 ; s <= max_sock; s++) { 
  396. !             if (FD_ISSET(s, fdp))
  397.   #endif
  398.        {
  399.            TTYPrint(TDEST, "%4dn", s);
  400. --- 962,968 ----
  401.               s = all_fds.fd_array[ui] ;
  402.   #else 
  403.           for (s = 0 ; s <= max_sock; s++) { 
  404. !             if (FD_ISSET(s, &all_fds))
  405.   #endif
  406.        {
  407.            TTYPrint(TDEST, "%4dn", s);
  408. diff -c Library/Repository/Implementation/HTFile.c:1.106.2.1 Library/Repository/Implementation/HTFile.c:1.106
  409. *** Library/Repository/Implementation/HTFile.c:1.106.2.1 Tue Jan 23 16:31:21 1996
  410. --- Library/Repository/Implementation/HTFile.c Tue Jan 23 16:31:21 1996
  411. ***************
  412. *** 119,125 ****
  413.   ** Reads the directory "path"
  414.   ** Returns:
  415.   ** HT_ERROR Error
  416. ! ** HT_FORBIDDEN Directory reading not allowed
  417.   ** HT_LOADED Successfully read the directory
  418.   */
  419.   PRIVATE int HTFile_readDir (HTRequest * request, file_info *file)
  420. --- 119,125 ----
  421.   ** Reads the directory "path"
  422.   ** Returns:
  423.   ** HT_ERROR Error
  424. ! ** HT_NO_ACCESS Directory reading not allowed
  425.   ** HT_LOADED Successfully read the directory
  426.   */
  427.   PRIVATE int HTFile_readDir (HTRequest * request, file_info *file)
  428. ***************
  429. *** 136,142 ****
  430.       if (dir_access == HT_DIR_FORBID) {
  431.    HTRequest_addError(request, ERR_FATAL, NO, HTERR_FORBIDDEN,
  432.       NULL, 0, "HTFile_readDir");
  433. !  return HT_FORBIDDEN;
  434.       }
  435.       
  436.       /* Initialize path name for stat() */
  437. --- 136,142 ----
  438.       if (dir_access == HT_DIR_FORBID) {
  439.    HTRequest_addError(request, ERR_FATAL, NO, HTERR_FORBIDDEN,
  440.       NULL, 0, "HTFile_readDir");
  441. !  return HT_NO_ACCESS;
  442.       }
  443.       
  444.       /* Initialize path name for stat() */
  445. ***************
  446. *** 160,166 ****
  447.    "Read dir.... `%s' not foundn", DEFAULT_DIR_FILE);
  448.        HTRequest_addError(request, ERR_FATAL, NO, HTERR_FORBIDDEN,
  449.           NULL, 0, "HTFile_readDir");
  450. !      return HT_FORBIDDEN;
  451.    }
  452.       }
  453.   
  454. --- 160,166 ----
  455.    "Read dir.... `%s' not foundn", DEFAULT_DIR_FILE);
  456.        HTRequest_addError(request, ERR_FATAL, NO, HTERR_FORBIDDEN,
  457.           NULL, 0, "HTFile_readDir");
  458. !      return HT_NO_ACCESS;
  459.    }
  460.       }
  461.   
  462. ***************
  463. *** 363,371 ****
  464.       file_info *file = (file_info *) net->context;
  465.   
  466.       /* Free stream with data TO Local file system */
  467. !     if (HTRequest_isDestination(req))
  468. !  HTRequest_removeDestination(req);
  469. !     else  if (req->input_stream) {
  470.    if (status == HT_INTERRUPTED)
  471.        (*req->input_stream->isa->abort)(req->input_stream, NULL);
  472.    else
  473. --- 363,369 ----
  474.       file_info *file = (file_info *) net->context;
  475.   
  476.       /* Free stream with data TO Local file system */
  477. !     if (!HTRequest_isDestination(req) && req->input_stream) {
  478.    if (status == HT_INTERRUPTED)
  479.        (*req->input_stream->isa->abort)(req->input_stream, NULL);
  480.    else
  481. ***************
  482. *** 384,390 ****
  483.    FREE(file->local);
  484.    free(file);
  485.       }
  486. !     HTNet_delete(net, req->internal ? HT_IGNORE : status);
  487.       return YES;
  488.   }
  489.   
  490. --- 382,388 ----
  491.    FREE(file->local);
  492.    free(file);
  493.       }
  494. !     HTNet_delete(net, status);
  495.       return YES;
  496.   }
  497.   
  498. ***************
  499. *** 418,426 ****
  500.    file->state = FS_BEGIN;
  501.    net->context = file;
  502.       } if (ops == FD_CLOSE) {       /* Interrupted */
  503. !  HTRequest_addError(request, ERR_FATAL, NO, HTERR_INTERRUPTED,
  504. !     NULL, 0, "HTLoadHTTP");
  505. !  FileCleanup(request, HT_INTERRUPTED);
  506.    return HT_OK;
  507.       } else
  508.    file = (file_info *) net->context; /* Get existing copy */
  509. --- 416,425 ----
  510.    file->state = FS_BEGIN;
  511.    net->context = file;
  512.       } if (ops == FD_CLOSE) {       /* Interrupted */
  513. !  if(HTRequest_isPostWeb(request)&&!HTRequest_isMainDestination(request))
  514. !      FileCleanup(request, HT_IGNORE);
  515. !  else
  516. !      FileCleanup(request, HT_INTERRUPTED);
  517.    return HT_OK;
  518.       } else
  519.    file = (file_info *) net->context; /* Get existing copy */
  520. ***************
  521. *** 560,565 ****
  522. --- 559,573 ----
  523.    TTYPrint(TDEST,"HTLoadFile.. `%s' opened using FILE %pn",
  524.    file->local, file->fp);
  525.   #endif /* !NO_UNIX_IO */
  526. +      file->state = FS_NEED_TARGET;
  527. +      break;
  528. +    case FS_NEED_TARGET:
  529. +      /*
  530. +      ** We need to wait for the destinations to get ready
  531. +      */
  532. +      if (HTRequest_isSource(request) && !request->output_stream)
  533. +  return HT_OK;
  534.   
  535.        /* Set up stream TO local file system */
  536.        request->input_stream = HTBufWriter_new(net, YES, 512);
  537. ***************
  538. *** 570,586 ****
  539.        ** before all destinations are ready. If destination then
  540.        ** register the input stream and get ready for read
  541.        */
  542. !      if (HTRequest_isDestination(request)) {
  543.    HTEvent_Register(net->sockfd, request, (SockOps) FD_READ,
  544.     HTLoadFile, net->priority);
  545.    HTRequest_linkDestination(request);
  546.        }
  547. -      file->state = FS_NEED_TARGET;
  548. -      if (HTRequest_isSource(request) && !HTRequest_destinationsReady(request))
  549. -  return HT_OK;
  550. -      break;
  551.   
  552. -    case FS_NEED_TARGET:
  553.        /*
  554.        ** Set up read buffer and streams.
  555.        ** If cache element, we know that it's MIME, so call MIME parser
  556. --- 578,589 ----
  557.        ** before all destinations are ready. If destination then
  558.        ** register the input stream and get ready for read
  559.        */
  560. !      if (HTRequest_isPostWeb(request)) {
  561.    HTEvent_Register(net->sockfd, request, (SockOps) FD_READ,
  562.     HTLoadFile, net->priority);
  563.    HTRequest_linkDestination(request);
  564.        }
  565.   
  566.        /*
  567.        ** Set up read buffer and streams.
  568.        ** If cache element, we know that it's MIME, so call MIME parser
  569. ***************
  570. *** 636,690 ****
  571.   
  572.      case FS_GOT_DATA:
  573.        if (HTRequest_isPostWeb(request)) {
  574.    if (HTRequest_isDestination(request)) {
  575.        HTLink *link =
  576.    HTAnchor_findLink((HTAnchor *) request->source->anchor,
  577.      (HTAnchor *) anchor);
  578.        HTLink_setResult(link, HT_LINK_OK);
  579.    }
  580. !      }
  581. !      FileCleanup(request, HT_LOADED);
  582.        return HT_OK;
  583.        break;
  584.   
  585.      case FS_NO_DATA:
  586.        if (HTRequest_isPostWeb(request)) {
  587.    if (HTRequest_isDestination(request)) {
  588.        HTLink *link =
  589.    HTAnchor_findLink((HTAnchor *) request->source->anchor,
  590.      (HTAnchor *) anchor);
  591.        HTLink_setResult(link, HT_LINK_OK);
  592.    }
  593. !      }
  594. !      FileCleanup(request, HT_NO_DATA);
  595.        return HT_OK;
  596.        break;
  597.   
  598.      case FS_RETRY:
  599.        if (HTRequest_isPostWeb(request)) {
  600.    if (HTRequest_isDestination(request)) {
  601.        HTLink *link =
  602.    HTAnchor_findLink((HTAnchor *) request->source->anchor,
  603.      (HTAnchor *) anchor);
  604.        HTLink_setResult(link, HT_LINK_ERROR);
  605.    }
  606. !  HTRequest_killPostWeb(request);
  607. !      }
  608. !      FileCleanup(request, HT_RETRY);
  609.        return HT_OK;
  610.        break;
  611.   
  612.      case FS_ERROR:
  613.        if (HTRequest_isPostWeb(request)) {
  614.    if (HTRequest_isDestination(request)) {
  615.        HTLink *link =
  616.    HTAnchor_findLink((HTAnchor *) request->source->anchor,
  617.      (HTAnchor *) anchor);
  618.        HTLink_setResult(link, HT_LINK_ERROR);
  619.    }
  620. !  HTRequest_killPostWeb(request);
  621. !      }
  622. !      FileCleanup(request, HT_ERROR);
  623.        return HT_OK;
  624.        break;
  625.    }
  626. --- 639,706 ----
  627.   
  628.      case FS_GOT_DATA:
  629.        if (HTRequest_isPostWeb(request)) {
  630. +  FileCleanup(request, HTRequest_isMainDestination(request) ?
  631. +      HT_LOADED : HT_IGNORE);
  632.    if (HTRequest_isDestination(request)) {
  633.        HTLink *link =
  634.    HTAnchor_findLink((HTAnchor *) request->source->anchor,
  635.      (HTAnchor *) anchor);
  636.        HTLink_setResult(link, HT_LINK_OK);
  637.    }
  638. !  HTRequest_removeDestination(request);
  639. !      } else
  640. !  FileCleanup(request, HT_LOADED);
  641.        return HT_OK;
  642.        break;
  643.   
  644.      case FS_NO_DATA:
  645.        if (HTRequest_isPostWeb(request)) {
  646. +  FileCleanup(request, HTRequest_isMainDestination(request) ?
  647. +      HT_NO_DATA : HT_IGNORE);
  648.    if (HTRequest_isDestination(request)) {
  649.        HTLink *link =
  650.    HTAnchor_findLink((HTAnchor *) request->source->anchor,
  651.      (HTAnchor *) anchor);
  652.        HTLink_setResult(link, HT_LINK_OK);
  653.    }
  654. !  HTRequest_removeDestination(request);
  655. !      } else
  656. !  FileCleanup(request, HT_NO_DATA);
  657.        return HT_OK;
  658.        break;
  659.   
  660.      case FS_RETRY:
  661.        if (HTRequest_isPostWeb(request)) {
  662. +  FileCleanup(request, HTRequest_isMainDestination(request) ?
  663. +      HT_RETRY : HT_IGNORE);
  664. +  HTRequest_killPostWeb(request);
  665.    if (HTRequest_isDestination(request)) {
  666.        HTLink *link =
  667.    HTAnchor_findLink((HTAnchor *) request->source->anchor,
  668.      (HTAnchor *) anchor);
  669.        HTLink_setResult(link, HT_LINK_ERROR);
  670.    }
  671. !  HTRequest_removeDestination(request);
  672. !      } else
  673. !  FileCleanup(request, HT_RETRY);
  674.        return HT_OK;
  675.        break;
  676.   
  677.      case FS_ERROR:
  678. +      /* Clean up the other connections or just this one */
  679.        if (HTRequest_isPostWeb(request)) {
  680. +  FileCleanup(request, HTRequest_isMainDestination(request) ?
  681. +      HT_ERROR : HT_IGNORE);
  682. +  HTRequest_killPostWeb(request);
  683.    if (HTRequest_isDestination(request)) {
  684.        HTLink *link =
  685.    HTAnchor_findLink((HTAnchor *) request->source->anchor,
  686.      (HTAnchor *) anchor);
  687.        HTLink_setResult(link, HT_LINK_ERROR);
  688.    }
  689. !  HTRequest_removeDestination(request);
  690. !      } else
  691. !  FileCleanup(request, HT_ERROR);
  692.        return HT_OK;
  693.        break;
  694.    }
  695. diff -c Library/Repository/Implementation/HTInit.html:2.28.2.1 Library/Repository/Implementation/HTInit.html:2.28
  696. *** Library/Repository/Implementation/HTInit.html:2.28.2.1 Tue Jan 23 16:31:22 1996
  697. --- Library/Repository/Implementation/HTInit.html Tue Jan 23 16:31:22 1996
  698. ***************
  699. *** 1,7 ****
  700.   <HTML>
  701.   <HEAD>
  702.   <TITLE>Initialization Routines</TITLE>
  703. ! <!-- Changed by: Henrik Frystyk Nielsen, 22-Jan-1996 -->
  704.   </HEAD>
  705.   <BODY>
  706.   <H1>Initialization Module</H1>
  707. --- 1,7 ----
  708.   <HTML>
  709.   <HEAD>
  710.   <TITLE>Initialization Routines</TITLE>
  711. ! <!-- Changed by: Henrik Frystyk Nielsen,  8-Dec-1995 -->
  712.   </HEAD>
  713.   <BODY>
  714.   <H1>Initialization Module</H1>
  715. ***************
  716. *** 36,42 ****
  717.   
  718.   <IMG SRC="../../Icons/32x32/warning.gif"> <B>PLEASE SEE THE <A
  719.   HREF="HTBInit.html">HTBInit MODULE</A> FOR STANDARD BINDINGS BETWEEN
  720. ! FILE EXTENSIONS AND MEDIA TYPES.</B>
  721.   
  722.   <PRE>
  723.   #ifndef HTINIT_H
  724. --- 36,42 ----
  725.   
  726.   <IMG SRC="../../Icons/32x32/warning.gif"> <B>PLEASE SEE THE <A
  727.   HREF="HTBInit.html">HTBInit MODULE</A> FOR STANDARD BINDINGS BETWEEN
  728. ! FILE EXTENSIONS AND MEDIA TYPES.
  729.   
  730.   <PRE>
  731.   #ifndef HTINIT_H
  732. ***************
  733. *** 95,101 ****
  734.   
  735.   <PRE>
  736.   #include "HTIcons.h"
  737. ! #include "WWWHTTP.h"
  738.   #include "HTFile.h"
  739.   #include "HTFTP.h"
  740.   #include "HTGopher.h"
  741. --- 95,101 ----
  742.   
  743.   <PRE>
  744.   #include "HTIcons.h"
  745. ! #include "HTTP.h"
  746.   #include "HTFile.h"
  747.   #include "HTFTP.h"
  748.   #include "HTGopher.h"
  749. diff -c Library/Repository/Implementation/HTMIME.c:2.45.2.1 Library/Repository/Implementation/HTMIME.c:2.45
  750. *** Library/Repository/Implementation/HTMIME.c:2.45.2.1 Tue Jan 23 16:31:23 1996
  751. --- Library/Repository/Implementation/HTMIME.c Tue Jan 23 16:31:23 1996
  752. ***************
  753. *** 499,505 ****
  754.        break;
  755.   
  756.      case LOCATION:
  757. !      request->redirectionAnchor = HTAnchor_findAddress(HTStrip(ptr));
  758.        state = JUNK_LINE;
  759.        break;
  760.   
  761. --- 499,513 ----
  762.        break;
  763.   
  764.      case LOCATION:
  765. ! #if 0
  766. !      /*
  767. !      ** Doesn't work as a redirection header might contain a '='
  768. !      ** Thanks to mitch@tam.net (Mitch DeShields)
  769. !      */
  770. !      if ((value = HTNextField(&ptr)) != NULL)
  771. !  StrAllocCopy(request->redirect, value);
  772. ! #endif
  773. !      StrAllocCopy(request->redirect, ptr);
  774.        state = JUNK_LINE;
  775.        break;
  776.   
  777. ***************
  778. *** 586,592 ****
  779.    if (me->EOLstate == EOL_FCR) {
  780.        if (*b == CR) {     /* End of header */
  781.    int status = parseheader(me, me->request, me->anchor);
  782. !  HTNet_setBytesRead(me->net, l);
  783.    if (status != HT_OK)
  784.        return status;
  785.        } else if (*b == LF)          /* CRLF */
  786. --- 594,600 ----
  787.    if (me->EOLstate == EOL_FCR) {
  788.        if (*b == CR) {     /* End of header */
  789.    int status = parseheader(me, me->request, me->anchor);
  790. !  me->net->bytes_read = l;
  791.    if (status != HT_OK)
  792.        return status;
  793.        } else if (*b == LF)          /* CRLF */
  794. ***************
  795. *** 604,610 ****
  796.    me->EOLstate = EOL_SCR;
  797.        else if (*b == LF) {     /* End of header */
  798.    int status = parseheader(me, me->request, me->anchor);
  799. !  HTNet_setBytesRead(me->net, l);
  800.    if (status != HT_OK)
  801.        return status;
  802.        } else if (WHITE(*b)) {        /* Folding: LF SP or CR LF SP */
  803. --- 612,618 ----
  804.    me->EOLstate = EOL_SCR;
  805.        else if (*b == LF) {     /* End of header */
  806.    int status = parseheader(me, me->request, me->anchor);
  807. !  me->net->bytes_read = l;
  808.    if (status != HT_OK)
  809.        return status;
  810.        } else if (WHITE(*b)) {        /* Folding: LF SP or CR LF SP */
  811. ***************
  812. *** 618,624 ****
  813.    } else if (me->EOLstate == EOL_SCR) {
  814.        if (*b==CR || *b==LF) {     /* End of header */
  815.    int status = parseheader(me, me->request, me->anchor);
  816. !  HTNet_setBytesRead(me->net, l);
  817.    if (status != HT_OK)
  818.        return status;
  819.        } else if (WHITE(*b)) {  /* Folding: LF CR SP or CR LF CR SP */
  820. --- 626,632 ----
  821.    } else if (me->EOLstate == EOL_SCR) {
  822.        if (*b==CR || *b==LF) {     /* End of header */
  823.    int status = parseheader(me, me->request, me->anchor);
  824. !  me->net->bytes_read = l;
  825.    if (status != HT_OK)
  826.        return status;
  827.        } else if (WHITE(*b)) {  /* Folding: LF CR SP or CR LF CR SP */
  828. ***************
  829. *** 643,662 ****
  830.       ** that we get the correct content length of data
  831.       */
  832.       if (l > 0) {
  833. -  HTParentAnchor * anchor = me->anchor;
  834.    if (me->target) {
  835.        int status = (*me->target->isa->put_block)(me->target, b, l);
  836.        if (status == HT_OK)
  837.    /* Check if CL at all - thanks to jwei@hal.com (John Wei) */
  838.    return (me->request->method == METHOD_HEAD ||
  839. !  (anchor->content_length >= 0 &&
  840. !   HTNet_bytesRead(me->net) >= anchor->content_length)) ?
  841.         HT_LOADED : HT_OK;
  842.        else
  843.    return status;
  844. !  } else if (anchor->header_parsed)
  845. !      return HT_LOADED;
  846. !  else
  847.        return HT_WOULD_BLOCK;
  848.       }
  849.       return HT_OK;
  850. --- 651,667 ----
  851.       ** that we get the correct content length of data
  852.       */
  853.       if (l > 0) {
  854.    if (me->target) {
  855.        int status = (*me->target->isa->put_block)(me->target, b, l);
  856.        if (status == HT_OK)
  857.    /* Check if CL at all - thanks to jwei@hal.com (John Wei) */
  858.    return (me->request->method == METHOD_HEAD ||
  859. !  (me->anchor->content_length >= 0 &&
  860. !   me->net->bytes_read >= me->anchor->content_length)) ?
  861.         HT_LOADED : HT_OK;
  862.        else
  863.    return status;
  864. !  } else
  865.        return HT_WOULD_BLOCK;
  866.       }
  867.       return HT_OK;
  868. diff -c Library/Repository/Implementation/HTMIMERq.c:2.8.2.1 Library/Repository/Implementation/HTMIMERq.c:2.8
  869. *** Library/Repository/Implementation/HTMIMERq.c:2.8.2.1 Tue Jan 23 16:31:24 1996
  870. --- Library/Repository/Implementation/HTMIMERq.c Tue Jan 23 16:31:24 1996
  871. ***************
  872. *** 197,207 ****
  873.    return b ? PUTBLOCK(b, l) : HT_OK;
  874.       else {
  875.    MIMEMakeRequest(me, me->request);
  876. !  if (HTRequest_isDestination(me->request)) {
  877. !      (*me->target->isa->flush)(me->target);
  878. !      HTNet_setBytesWritten(me->request->net, 0);
  879.    }
  880. !  me->transparent = YES;
  881.    return b ? PUTBLOCK(b, l) : HT_OK;
  882.       }
  883.   }
  884. --- 197,210 ----
  885.    return b ? PUTBLOCK(b, l) : HT_OK;
  886.       else {
  887.    MIMEMakeRequest(me, me->request);
  888. ! #if 0
  889. !  if ((status = PUTBLOCK(HTChunk_data(me->buffer),
  890. !         HTChunk_size(me->buffer))) == HT_OK) {
  891. !      me->transparent = YES;
  892. !      return b ? PUTBLOCK(b, l) : HT_OK;
  893.    }
  894. ! #endif
  895. !  me->transparent = YES;
  896.    return b ? PUTBLOCK(b, l) : HT_OK;
  897.       }
  898.   }
  899. diff -c Library/Repository/Implementation/HTNet.c:2.44.2.1 Library/Repository/Implementation/HTNet.c:2.44
  900. *** Library/Repository/Implementation/HTNet.c:2.44.2.1 Tue Jan 23 16:31:25 1996
  901. --- Library/Repository/Implementation/HTNet.c Tue Jan 23 16:31:25 1996
  902. ***************
  903. *** 503,520 ****
  904.   
  905.    /* Close socket */
  906.    if (net->sockfd != INVSOC) {
  907. -      HTEvent_UnRegister(net->sockfd, (SockOps) FD_ALL);
  908.        if (HTDNS_socket(net->dns) == INVSOC) {
  909.    if ((status = NETCLOSE(net->sockfd)) < 0)
  910.        HTRequest_addSystemError(net->request, ERR_FATAL,
  911.         socerrno, NO, "NETCLOSE");
  912.    if (WWWTRACE)
  913.        TTYPrint(TDEST, "HTNet_delete closing %dn", net->sockfd);
  914.        } else {
  915.    if (WWWTRACE)
  916.        TTYPrint(TDEST, "HTNet_delete keeping %dn", net->sockfd);
  917.    HTDNS_clearActive(net->dns);
  918.    /* Here we should probably use a low priority */
  919.    HTEvent_Register(net->sockfd, net->request, (SockOps) FD_READ,
  920.     HTDNS_closeSocket, net->priority);
  921.        }
  922. --- 503,521 ----
  923.   
  924.    /* Close socket */
  925.    if (net->sockfd != INVSOC) {
  926.        if (HTDNS_socket(net->dns) == INVSOC) {
  927.    if ((status = NETCLOSE(net->sockfd)) < 0)
  928.        HTRequest_addSystemError(net->request, ERR_FATAL,
  929.         socerrno, NO, "NETCLOSE");
  930.    if (WWWTRACE)
  931.        TTYPrint(TDEST, "HTNet_delete closing %dn", net->sockfd);
  932. +  HTEvent_UnRegister(net->sockfd, (SockOps) FD_ALL);
  933.        } else {
  934.    if (WWWTRACE)
  935.        TTYPrint(TDEST, "HTNet_delete keeping %dn", net->sockfd);
  936.    HTDNS_clearActive(net->dns);
  937.    /* Here we should probably use a low priority */
  938. +  HTEvent_UnRegister(net->sockfd, (SockOps) FD_ALL);
  939.    HTEvent_Register(net->sockfd, net->request, (SockOps) FD_READ,
  940.     HTDNS_closeSocket, net->priority);
  941.        }
  942. diff -c Library/Repository/Implementation/HTNetMan.html:2.5.4.1 Library/Repository/Implementation/HTNetMan.html:2.6
  943. *** Library/Repository/Implementation/HTNetMan.html:2.5.4.1 Tue Jan 23 16:31:26 1996
  944. --- Library/Repository/Implementation/HTNetMan.html Tue Jan 23 16:31:26 1996
  945. ***************
  946. *** 1,7 ****
  947.   <HTML>
  948.   <HEAD>
  949.   <TITLE>Asyncronous Socket Management</TITLE>
  950. ! <!-- Changed by: Henrik Frystyk Nielsen, 21-Jan-1996 -->
  951.   </HEAD>
  952.   <BODY>
  953.   
  954. --- 1,7 ----
  955.   <HTML>
  956.   <HEAD>
  957.   <TITLE>Asyncronous Socket Management</TITLE>
  958. ! <!-- Changed by: Henrik Frystyk Nielsen, 23-Sep-1995 -->
  959.   </HEAD>
  960.   <BODY>
  961.   
  962. ***************
  963. *** 65,85 ****
  964.       int  home;  /* Current home if multiple */
  965.       time_t connecttime;  /* Used on multihomed hosts */
  966.       long bytes_read;   /* Bytes read from network */
  967. !     long bytes_written;  /* Bytes written to network */
  968. !     BOOL preemtive;   /* Eff result from Request and Protocol */
  969.       HTPriority priority;  /* Priority of this request (event) */
  970.       HTEventCallback * cbf;      /* Library load routine */
  971.       HTRequest * request;    /* Link back to request structure */
  972.       void * context; /* Protocol Specific context */
  973.   };
  974.   
  975. ! #define HTNet_bytesRead(me) ((me) ? (me)-&gt;bytes_read : -1)
  976. ! #define HTNet_bytesWritten(me) ((me) ? (me)-&gt;bytes_written : -1)
  977. ! #define HTNet_setBytesRead(me,l) ((me) ? (me-&gt;bytes_read=(l)) : -1)
  978. ! #define HTNet_setBytesWritten(me,l) ((me) ? (me-&gt;bytes_written=(l)) :-1)
  979. ! #define HTNet_dns(me) ((me) ? (me)-&gt;dns : NULL)
  980.   </PRE>
  981.   
  982.   <PRE>
  983. --- 65,79 ----
  984.       int  home;  /* Current home if multiple */
  985.       time_t connecttime;  /* Used on multihomed hosts */
  986.       long bytes_read;   /* Bytes read from network */
  987. !     BOOL preemptive;   /* Eff result from Request and Protocol */
  988.       HTPriority priority;  /* Priority of this request (event) */
  989.       HTEventCallback * cbf;      /* Library load routine */
  990.       HTRequest * request;    /* Link back to request structure */
  991.       void * context; /* Protocol Specific context */
  992.   };
  993.   
  994. ! #define HTNet_bytesRead(me) ((me) ? (me)-&gt;bytes_read : -1)
  995. ! #define HTNet_dns(me) ((me) ? (me)-&gt;dns : NULL)
  996.   </PRE>
  997.   
  998.   <PRE>
  999. diff -c Library/Repository/Implementation/HTProt.html:2.11 Library/Repository/Implementation/HTProt.html:2.12
  1000. *** Library/Repository/Implementation/HTProt.html:2.11 Tue Jan 23 16:31:27 1996
  1001. --- Library/Repository/Implementation/HTProt.html Tue Jan 23 16:31:27 1996
  1002. ***************
  1003. *** 59,69 ****
  1004.   access acheme. For example HTTP.c is bound to http URLs. The call back
  1005.   function is the function to be called for loading. The reason why it
  1006.   is of type HTEventCallback is that it then can be used directly in the
  1007. ! event loop when used in non-preemtive mode.
  1008.   
  1009.   <PRE>
  1010.   extern BOOL HTProtocol_add (CONST char *        name,
  1011. !      BOOL preemtive,
  1012.        HTEventCallback * client,
  1013.        HTEventCallback * server);
  1014.   </PRE>
  1015. --- 59,69 ----
  1016.   access acheme. For example HTTP.c is bound to http URLs. The call back
  1017.   function is the function to be called for loading. The reason why it
  1018.   is of type HTEventCallback is that it then can be used directly in the
  1019. ! event loop when used in non-preemptive mode.
  1020.   
  1021.   <PRE>
  1022.   extern BOOL HTProtocol_add (CONST char *        name,
  1023. !      BOOL preemptive,
  1024.        HTEventCallback * client,
  1025.        HTEventCallback * server);
  1026.   </PRE>
  1027. ***************
  1028. *** 106,118 ****
  1029.   extern HTEventCallback * HTProtocol_server (HTProtocol * protocol);
  1030.   </PRE>
  1031.   
  1032. ! <H3>Is Access Scheme Preemtive</H3>
  1033.   
  1034.   Returns YES if the implementation of the access scheme supports
  1035. ! preemtive access only.
  1036.   
  1037.   <PRE>
  1038. ! extern BOOL HTProtocol_preemtive (HTProtocol * protocol);
  1039.   </PRE>
  1040.   
  1041.   <PRE>
  1042. --- 106,118 ----
  1043.   extern HTEventCallback * HTProtocol_server (HTProtocol * protocol);
  1044.   </PRE>
  1045.   
  1046. ! <H3>Is Access Scheme Preemptive</H3>
  1047.   
  1048.   Returns YES if the implementation of the access scheme supports
  1049. ! preemptive access only.
  1050.   
  1051.   <PRE>
  1052. ! extern BOOL HTProtocol_preemptive (HTProtocol * protocol);
  1053.   </PRE>
  1054.   
  1055.   <PRE>
  1056. diff -c Library/Repository/Implementation/HTReq.html:2.17.2.1 Library/Repository/Implementation/HTReq.html:2.18
  1057. *** Library/Repository/Implementation/HTReq.html:2.17.2.1 Tue Jan 23 16:31:28 1996
  1058. --- Library/Repository/Implementation/HTReq.html Tue Jan 23 16:31:28 1996
  1059. ***************
  1060. *** 1,7 ****
  1061.   <HTML>
  1062.   <HEAD>
  1063.   <TITLE>Public Declaration of Request Manager</TITLE>
  1064. ! <!-- Changed by: Henrik Frystyk Nielsen, 23-Jan-1996 -->
  1065.   <NEXTID N="z11">
  1066.   </HEAD>
  1067.   <BODY>
  1068. --- 1,7 ----
  1069.   <HTML>
  1070.   <HEAD>
  1071.   <TITLE>Public Declaration of Request Manager</TITLE>
  1072. ! <!-- Changed by: Henrik Frystyk Nielsen, 18-Dec-1995 -->
  1073.   <NEXTID N="z11">
  1074.   </HEAD>
  1075.   <BODY>
  1076. ***************
  1077. *** 85,102 ****
  1078.   extern HTRequest * HTRequest_dup (HTRequest * src);
  1079.   </PRE>
  1080.   
  1081. - <H4>Create a duplicate for Internal use</H4>
  1082. - Creates a new HTRequest object as a duplicate of the src request.  The
  1083. - difference to the HTRequest_dup function is that we don't copy the
  1084. - error_stack and other information that the application keeps in its
  1085. - copy of the request object. Otherwise it will be freed multiple times.
  1086. - Returns YES if OK, else NO
  1087. - <PRE>
  1088. - extern HTRequest * HTRequest_dupInternal (HTRequest * src);
  1089. - </PRE>
  1090.   <H3>Delete Object</H3>
  1091.   
  1092.   This function deletes the object and cleans up the memory.
  1093. --- 85,90 ----
  1094. ***************
  1095. *** 164,182 ****
  1096.   extern HTReload HTRequest_reloadMode (HTRequest *request);
  1097.   </PRE>
  1098.   
  1099. - <H2>Redirections</H2>
  1100. - When a redirection response is returned to the Library, for example
  1101. - from a remote HTTP server, this code is passed back to the
  1102. - application. The application can then decide whether a new request
  1103. - should be established or not. These two methods return the redirection
  1104. - information required to issue a new request, that is the new anchor
  1105. - and any list of keywords associated with this anchor.
  1106. - <PRE>
  1107. - extern HTAnchor * HTRequest_redirection (HTRequest * request);
  1108. - </PRE>
  1109.   <H2>Max number of Retrys for a Down Load</H2>
  1110.   
  1111.   Automatic reload can happen in two situations:
  1112. --- 152,157 ----
  1113. ***************
  1114. *** 499,507 ****
  1115.   extern void *HTRequest_context (HTRequest *request);
  1116.   </PRE>
  1117.   
  1118. ! <H2>Preemtive or Non-preemtive Access</H2>
  1119.   
  1120. ! A access scheme is defined with a default for using either preemtive
  1121.   (blocking I/O) or non-premitve (non-blocking I/O). This is basically a
  1122.   result of the implementation of the protocol module itself. However,
  1123.   if non-blocking I/O is the default then some times it is nice to be
  1124. --- 474,482 ----
  1125.   extern void *HTRequest_context (HTRequest *request);
  1126.   </PRE>
  1127.   
  1128. ! <H2>Preemptive or Non-preemptive Access</H2>
  1129.   
  1130. ! A access scheme is defined with a default for using either preemptive
  1131.   (blocking I/O) or non-premitve (non-blocking I/O). This is basically a
  1132.   result of the implementation of the protocol module itself. However,
  1133.   if non-blocking I/O is the default then some times it is nice to be
  1134. ***************
  1135. *** 510,517 ****
  1136.   non-blocking.
  1137.   
  1138.   <PRE>
  1139. ! extern void HTRequest_setPreemtive (HTRequest *request, BOOL mode);
  1140. ! extern BOOL HTRequest_preemtive (HTRequest *request);
  1141.   </PRE>
  1142.   
  1143.   <H2>Priority Management</H2>
  1144. --- 485,492 ----
  1145.   non-blocking.
  1146.   
  1147.   <PRE>
  1148. ! extern void HTRequest_setPreemptive (HTRequest *request, BOOL mode);
  1149. ! extern BOOL HTRequest_preemptive (HTRequest *request);
  1150.   </PRE>
  1151.   
  1152.   <H2>Priority Management</H2>
  1153. ***************
  1154. *** 586,602 ****
  1155.          char * syscall);
  1156.   </PRE>
  1157.   
  1158. ! <H2>Bytes Read or Written in a Request</H2>
  1159.   
  1160.   This function returns the bytes read in the current request. For a
  1161.   deeper description of what the current request is, please read the
  1162.   user's guide. This function can be used in for example the <A
  1163.   HREF="HTAlert.html">HTAlert module</A> to give the number of bytes
  1164. ! read or written in a progress message.
  1165.   
  1166.   <PRE>
  1167. ! extern long HTRequest_bytesRead (HTRequest * request);
  1168. ! extern long HTRequest_bytesWritten (HTRequest * request);
  1169.   </PRE>
  1170.   
  1171.   <H2>Kill a Request</H2>
  1172. --- 561,576 ----
  1173.          char * syscall);
  1174.   </PRE>
  1175.   
  1176. ! <H2>Bytes Read in Current Request</H2>
  1177.   
  1178.   This function returns the bytes read in the current request. For a
  1179.   deeper description of what the current request is, please read the
  1180.   user's guide. This function can be used in for example the <A
  1181.   HREF="HTAlert.html">HTAlert module</A> to give the number of bytes
  1182. ! read in a progress message.
  1183.   
  1184.   <PRE>
  1185. ! extern long HTRequest_bytesRead(HTRequest * request);
  1186.   </PRE>
  1187.   
  1188.   <H2>Kill a Request</H2>
  1189. diff -c Library/Repository/Implementation/HTReqMan.c:2.22.2.1 Library/Repository/Implementation/HTReqMan.c:2.22
  1190. *** Library/Repository/Implementation/HTReqMan.c:2.22.2.1 Tue Jan 23 16:31:29 1996
  1191. --- Library/Repository/Implementation/HTReqMan.c Tue Jan 23 16:31:29 1996
  1192. ***************
  1193. *** 108,149 ****
  1194.       return me;
  1195.   }
  1196.   
  1197. - /* HTRequest_dupInternal
  1198. - ** ---------------------
  1199. - ** Creates a new HTRequest object as a duplicate of the src request.
  1200. - ** The difference to the HTRequest_dup function is that we don't copy the
  1201. - ** error_stack and other information that the application keeps in its
  1202. - ** copy of the request object. Otherwise it will be freed multiple times
  1203. - ** Returns YES if OK, else NO
  1204. - */
  1205. - PUBLIC HTRequest * HTRequest_dupInternal (HTRequest * src)
  1206. - {
  1207. -     HTRequest * me;
  1208. -     if (!src) return NO;
  1209. -     if ((me = (HTRequest *) malloc(sizeof(HTRequest))) == NULL)
  1210. -  outofmem(__FILE__, "HTRequest_dup");
  1211. -     memcpy(me, src, sizeof(HTRequest));
  1212. -     me->internal = YES;
  1213. -     me->boundary = NULL;
  1214. -     me->authenticate = NULL;
  1215. -     me->error_stack = NULL;
  1216. -     me->access = NULL;
  1217. -     me->authorization = NULL;
  1218. -     me->prot_template = NULL;
  1219. -     me->dialog_msg = NULL;
  1220. -     me->net = NULL;
  1221. -     me->WWWAAScheme = NULL;
  1222. -     me->WWWAARealm = NULL;
  1223. -     me->WWWprotection = NULL;
  1224. -     return me;
  1225. - }
  1226.   /*  Delete a request structure
  1227.   **  --------------------------
  1228.   */
  1229.   PUBLIC void HTRequest_delete (HTRequest * request)
  1230.   {
  1231.       if (request) {
  1232.    FREE(request->boundary);
  1233.    FREE(request->authenticate);
  1234.    if (request->error_stack) HTError_deleteAll(request->error_stack);
  1235. --- 108,120 ----
  1236.       return me;
  1237.   }
  1238.   
  1239.   /*  Delete a request structure
  1240.   **  --------------------------
  1241.   */
  1242.   PUBLIC void HTRequest_delete (HTRequest * request)
  1243.   {
  1244.       if (request) {
  1245. +  FREE(request->redirect);
  1246.    FREE(request->boundary);
  1247.    FREE(request->authenticate);
  1248.    if (request->error_stack) HTError_deleteAll(request->error_stack);
  1249. ***************
  1250. *** 158,163 ****
  1251. --- 129,135 ----
  1252.        request->net->request = NULL;
  1253.   
  1254.    /* These are temporary until we get a MIME thingy */
  1255. +  FREE(request->redirect);
  1256.    FREE(request->WWWAAScheme);
  1257.    FREE(request->WWWAARealm);
  1258.    FREE(request->WWWprotection);
  1259. ***************
  1260. *** 534,547 ****
  1261.   }
  1262.   
  1263.   /*
  1264. - ** Bytes written in this request
  1265. - */
  1266. - PUBLIC long HTRequest_bytesWritten (HTRequest * request)
  1267. - {
  1268. -     return request ? HTNet_bytesWritten(request->net) : -1;
  1269. - }
  1270. - /*
  1271.   ** Kill this request
  1272.   */
  1273.   PUBLIC BOOL HTRequest_kill(HTRequest * request)
  1274. --- 506,511 ----
  1275. ***************
  1276. *** 603,616 ****
  1277.   }
  1278.   
  1279.   /*
  1280. - **    Redirection informantion
  1281. - */
  1282. - PUBLIC HTAnchor * HTRequest_redirection (HTRequest * request)
  1283. - {
  1284. -     return (request ? request->redirectionAnchor : NULL);
  1285. - }
  1286. - /*
  1287.   **  Set max number of automatic reload. Default is HT_MAX_RELOADS
  1288.   */
  1289.   PUBLIC BOOL HTRequest_setMaxRetry (int newmax)
  1290. --- 567,572 ----
  1291. ***************
  1292. *** 682,705 ****
  1293.   **  build the internal request representation of the POST web
  1294.   **  Returns YES if OK, else NO
  1295.   */
  1296. ! PUBLIC BOOL HTRequest_addDestination (HTRequest * src, HTRequest * dest)
  1297.   {
  1298.       if (src && dest) {
  1299. -  dest->source = src->source = src;
  1300.    if (!src->mainDestination) {
  1301.        src->mainDestination = dest;
  1302.        src->destRequests = 1;
  1303. -      if (WWWTRACE)
  1304. -  TTYPrint(TDEST,"POSTWeb..... Adding dest %p to src %pn",
  1305. -   dest, src);
  1306.        return YES;
  1307.    } else {
  1308. !      if (!src->destinations) src->destinations = HTList_new();
  1309.        if (HTList_addObject(src->destinations, (void *) dest)==YES) {
  1310.    src->destRequests++;
  1311. -  if (WWWTRACE)
  1312. -      TTYPrint(TDEST,"POSTWeb..... Adding dest %p to src %pn",
  1313. -       dest, src);
  1314.    return YES;
  1315.        }
  1316.    }
  1317. --- 638,655 ----
  1318.   **  build the internal request representation of the POST web
  1319.   **  Returns YES if OK, else NO
  1320.   */
  1321. ! PUBLIC BOOL HTRequest_addDestination (HTRequest *src, HTRequest *dest)
  1322.   {
  1323.       if (src && dest) {
  1324.    if (!src->mainDestination) {
  1325.        src->mainDestination = dest;
  1326.        src->destRequests = 1;
  1327.        return YES;
  1328.    } else {
  1329. !      if (!src->destinations)
  1330. !  src->destinations = HTList_new();
  1331.        if (HTList_addObject(src->destinations, (void *) dest)==YES) {
  1332.    src->destRequests++;
  1333.    return YES;
  1334.        }
  1335.    }
  1336. ***************
  1337. *** 709,719 ****
  1338.   
  1339.   /*
  1340.   **  Remove a destination request from this source request structure
  1341. ! **  Remember only to delete the internal request objects as the other
  1342. ! **  comes from the application!
  1343.   **  Returns YES if OK, else NO
  1344.   */
  1345. ! PUBLIC BOOL HTRequest_removeDestination (HTRequest * dest)
  1346.   {
  1347.       BOOL found=NO;
  1348.       if (dest && dest->source) {
  1349. --- 659,669 ----
  1350.   
  1351.   /*
  1352.   **  Remove a destination request from this source request structure
  1353. ! **  Remember not to delete the main destination as it comes from the
  1354. ! **  application!
  1355.   **  Returns YES if OK, else NO
  1356.   */
  1357. ! PUBLIC BOOL HTRequest_removeDestination (HTRequest *dest)
  1358.   {
  1359.       BOOL found=NO;
  1360.       if (dest && dest->source) {
  1361. ***************
  1362. *** 723,773 ****
  1363.        src->mainDestination = NULL;
  1364.        src->destRequests--;
  1365.        found = YES;
  1366. !  } else if (src->destinations) {
  1367.        if (HTList_removeObject(src->destinations, (void *) dest)) {
  1368.    src->destRequests--;
  1369.    found = YES;
  1370.        }
  1371.    }
  1372.    if (found) {
  1373. -      if (dest->internal) HTRequest_delete(dest);
  1374.        if (WWWTRACE)
  1375. !       TTYPrint(TDEST, "POSTWeb..... Deleting dest %p from src %pn",
  1376. !   dest, src);
  1377.    }
  1378. !  if (src->destRequests <= 0) {
  1379.        if (WWWTRACE)
  1380. !  TTYPrint(TDEST, "POSTWeb..... terminatedn");
  1381. !      if (src->internal) HTRequest_delete(src);
  1382.    }
  1383.       }
  1384.       return found;
  1385.   }
  1386.   
  1387.   /*
  1388. ! **  Check to see whether all destinations are ready. If so then enable the
  1389. ! **  source as ready for reading.
  1390. ! **  Returns YES if all dests are ready, NO otherwise
  1391. ! */
  1392. ! PUBLIC BOOL HTRequest_destinationsReady (HTRequest * me)
  1393. ! {
  1394. !     HTRequest * source = me ? me->source : NULL;
  1395. !     if (source) {
  1396. !  if (source->destStreams == source->destRequests) {
  1397. !      HTNet * net = source->net;
  1398. !      if (WWWTRACE)
  1399. !  TTYPrint(TDEST, "POSTWeb..... All destinations are ready!n");
  1400. !      if (net)       /* Might already have finished */
  1401. !  HTEvent_Register(net->sockfd, source, (SockOps) FD_READ,
  1402. !   net->cbf, net->priority);
  1403. !      return YES;
  1404. !  }
  1405. !     }
  1406. !     return NO;
  1407. ! }
  1408. ! /*
  1409. ! **  Find the source request object and make the link between the 
  1410.   **  source output stream and the destination input stream. There can be
  1411.   **  a conversion between the two streams!
  1412.   **  Returns YES if link is made, NO otherwise
  1413. --- 673,701 ----
  1414.        src->mainDestination = NULL;
  1415.        src->destRequests--;
  1416.        found = YES;
  1417. !  } if (src->destinations) {
  1418.        if (HTList_removeObject(src->destinations, (void *) dest)) {
  1419. +  HTRequest_delete(dest);
  1420.    src->destRequests--;
  1421.    found = YES;
  1422.        }
  1423.    }
  1424.    if (found) {
  1425.        if (WWWTRACE)
  1426. !  TTYPrint(TDEST, "Destination. %p removed from %pn",
  1427. !  dest, src);
  1428.    }
  1429. !  if (!src->destRequests) {
  1430.        if (WWWTRACE)
  1431. !  TTYPrint(TDEST, "Destination. PostWeb terminatedn");
  1432. !      HTRequest_delete(src);
  1433.    }
  1434.       }
  1435.       return found;
  1436.   }
  1437.   
  1438.   /*
  1439. ! **  Find the source request structure and make the link between the 
  1440.   **  source output stream and the destination input stream. There can be
  1441.   **  a conversion between the two streams!
  1442.   **  Returns YES if link is made, NO otherwise
  1443. ***************
  1444. *** 782,801 ****
  1445.           dest, YES);
  1446.   
  1447.    /* Check if we are the only one - else spawn off T streams */
  1448.    /* @@@ We don't do this yet @@@ */
  1449.   
  1450. -  /* Now set up output stream of the source */
  1451. -  if (source->output_stream)
  1452. -      (*source->output_stream->isa->_free)(source->output_stream);
  1453.    source->output_stream = pipe ? pipe : dest->input_stream;
  1454.   
  1455. !  if (WWWTRACE)
  1456. !      TTYPrint(TDEST,"POSTWeb..... Linking dest %p to src %pn",
  1457. !       dest, source);
  1458.    if (++source->destStreams == source->destRequests) {
  1459.        HTNet *net = source->net;
  1460. !      if (WWWTRACE)
  1461. !  TTYPrint(TDEST, "POSTWeb..... All destinations ready!n");
  1462.        if (net)       /* Might already have finished */
  1463.    HTEvent_Register(net->sockfd, source, (SockOps) FD_READ,
  1464.     net->cbf, net->priority);
  1465. --- 710,726 ----
  1466.           dest, YES);
  1467.   
  1468.    /* Check if we are the only one - else spawn off T streams */
  1469.    /* @@@ We don't do this yet @@@ */
  1470.   
  1471.    source->output_stream = pipe ? pipe : dest->input_stream;
  1472.   
  1473. !  if (STREAM_TRACE)
  1474. !      TTYPrint(TDEST,"Destination. Linked %p to source %pn",dest,source);
  1475.    if (++source->destStreams == source->destRequests) {
  1476.        HTNet *net = source->net;
  1477. !      if (STREAM_TRACE)
  1478. !  TTYPrint(TDEST, "Destination. All destinations ready!n");
  1479.        if (net)       /* Might already have finished */
  1480.    HTEvent_Register(net->sockfd, source, (SockOps) FD_READ,
  1481.     net->cbf, net->priority);
  1482. ***************
  1483. *** 828,836 ****
  1484.    }
  1485.    if (found) {
  1486.        src->destStreams--;
  1487. !      if (WWWTRACE)
  1488. !  TTYPrint(TDEST, "POSTWeb..... Unlinking dest %p from src %pn",
  1489. !   dest, src);
  1490.        return YES;
  1491.    }
  1492.       }
  1493. --- 753,761 ----
  1494.    }
  1495.    if (found) {
  1496.        src->destStreams--;
  1497. !      if (STREAM_TRACE)
  1498. !  TTYPrint(TDEST, "Destination. Unlinked %p from source %pn",
  1499. !  dest, src);
  1500.        return YES;
  1501.    }
  1502.       }
  1503. ***************
  1504. *** 866,872 ****
  1505.   
  1506.   /*
  1507.   **  Kills all threads in a POST WEB connected to this request but
  1508. ! **  NOT this request itself. We also keep the request structures.
  1509.   **  Some requests might be preemtive, for example a SMTP request (when
  1510.   **  that has been implemented). However, this will be handled internally
  1511.   **  in the load function.
  1512. --- 791,797 ----
  1513.   
  1514.   /*
  1515.   **  Kills all threads in a POST WEB connected to this request but
  1516. ! **  keep the request structures.
  1517.   **  Some requests might be preemtive, for example a SMTP request (when
  1518.   **  that has been implemented). However, this will be handled internally
  1519.   **  in the load function.
  1520. ***************
  1521. *** 875,902 ****
  1522.   {
  1523.       if (me && me->source) {
  1524.    HTRequest *source = me->source;
  1525. -  if (WWWTRACE) TTYPrint(TDEST, "POSTWeb..... Killingn");
  1526.   
  1527. !  /*
  1528. !  ** Kill source. The stream tree is now freed so we have to build
  1529. !  ** that again. This is done in HTRequest_linkDestination()
  1530. !  */
  1531. !  if (me != source) {
  1532. !      HTNet_kill(source->net);
  1533. !      source->output_stream = NULL;
  1534. !  }
  1535.   
  1536.    /* Kill all other destinations */
  1537.    if (source->destinations) {
  1538.        HTList *cur = source->destinations;
  1539.        HTRequest *pres;
  1540.        while ((pres = (HTRequest *) HTList_nextObject(cur)) != NULL)
  1541. !  if (me != pres) HTNet_kill(pres->net);
  1542.    }
  1543. !  /* Kill main destination */
  1544. !  if (source->mainDestination && me != source->mainDestination)
  1545. !      HTNet_kill(source->mainDestination->net);
  1546.    return YES;
  1547.       }
  1548.       return NO;
  1549. --- 800,823 ----
  1550.   {
  1551.       if (me && me->source) {
  1552.    HTRequest *source = me->source;
  1553.   
  1554. !  /* Kill main destination */
  1555. !  if (source->mainDestination)
  1556. !      HTNet_kill(source->mainDestination->net);
  1557.   
  1558.    /* Kill all other destinations */
  1559.    if (source->destinations) {
  1560.        HTList *cur = source->destinations;
  1561.        HTRequest *pres;
  1562.        while ((pres = (HTRequest *) HTList_nextObject(cur)) != NULL)
  1563. !  HTNet_kill(pres->net);
  1564.    }
  1565. !  /*
  1566. !  ** Kill source. The stream tree is now freed so we have to build
  1567. !  ** that again. This is done in HTRequest_linkDestination()
  1568. !  */
  1569. !  HTNet_kill(source->net);
  1570. !  source->output_stream = NULL;
  1571.    return YES;
  1572.       }
  1573.       return NO;
  1574. diff -c Library/Repository/Implementation/HTReqMan.html:2.12.2.1 Library/Repository/Implementation/HTReqMan.html:2.13
  1575. *** Library/Repository/Implementation/HTReqMan.html:2.12.2.1 Tue Jan 23 16:31:31 1996
  1576. --- Library/Repository/Implementation/HTReqMan.html Tue Jan 23 16:31:31 1996
  1577. ***************
  1578. *** 1,7 ****
  1579.   <HTML>
  1580.   <HEAD>
  1581.   <TITLE>Request Object</TITLE>
  1582. ! <!-- Changed by: Henrik Frystyk Nielsen, 23-Jan-1996 -->
  1583.   </HEAD>
  1584.   <BODY>
  1585.   
  1586. --- 1,7 ----
  1587.   <HTML>
  1588.   <HEAD>
  1589.   <TITLE>Request Object</TITLE>
  1590. ! <!-- Changed by: Henrik Frystyk Nielsen,  8-Dec-1995 -->
  1591.   </HEAD>
  1592.   <BODY>
  1593.   
  1594. ***************
  1595. *** 49,60 ****
  1596.   
  1597.   <PRE>
  1598.   struct _HTRequest {
  1599. -     BOOL internal;      /* Does the app knows about this one? */
  1600.       HTMethod method;
  1601.       HTReload reload;
  1602.   
  1603.       char * boundary;   /* MIME multipart boundary */
  1604.       int retrys;              /* Number of automatic reloads */
  1605.       time_t retry_after;  /* Absolut time for a retry */
  1606. --- 49,58 ----
  1607.   
  1608.   <PRE>
  1609.   struct _HTRequest {
  1610.       HTMethod method;
  1611.       HTReload reload;
  1612.   
  1613. +     char * redirect;   /* Location or URI */
  1614.       char * boundary;   /* MIME multipart boundary */
  1615.       int retrys;              /* Number of automatic reloads */
  1616.       time_t retry_after;  /* Absolut time for a retry */
  1617. ***************
  1618. *** 103,117 ****
  1619.       HTParentAnchor * parentAnchor; /* For referer field */
  1620.   </PRE>
  1621.   
  1622. - <H4>Redirection</H4>
  1623. - If we get a redirection back then we return the new destination for
  1624. - this request to the application using this anchor.
  1625. - <PRE>
  1626. -     HTAnchor * redirectionAnchor;   /* Redirection URL */
  1627. - </PRE>
  1628.   <H3>Streams From Network to Application</H3>
  1629.   
  1630.   <PRE>
  1631. --- 101,106 ----
  1632. ***************
  1633. *** 145,151 ****
  1634.   <H3>Other Flags</H3>
  1635.   
  1636.   <PRE>
  1637. !     BOOL preemtive;
  1638.       BOOL ContentNegotiation;
  1639.       BOOL using_proxy;
  1640.   </PRE>
  1641. --- 134,140 ----
  1642.   <H3>Other Flags</H3>
  1643.   
  1644.   <PRE>
  1645. !     BOOL preemptive;
  1646.       BOOL ContentNegotiation;
  1647.       BOOL using_proxy;
  1648.   </PRE>
  1649. ***************
  1650. *** 210,216 ****
  1651.   <PRE>
  1652.   extern BOOL HTRequest_addDestination (HTRequest * src, HTRequest * dest);
  1653.   extern BOOL HTRequest_removeDestination (HTRequest * dest);
  1654. - extern BOOL HTRequest_destinationsReady (HTRequest * me);
  1655.   
  1656.   extern BOOL HTRequest_linkDestination (HTRequest * dest);
  1657.   extern BOOL HTRequest_unlinkDestination (HTRequest * dest);
  1658. --- 199,204 ----
  1659. diff -c Library/Repository/Implementation/HTSocket.c:2.19.2.1 Library/Repository/Implementation/HTSocket.c:2.19
  1660. *** Library/Repository/Implementation/HTSocket.c:2.19.2.1 Tue Jan 23 16:31:32 1996
  1661. --- Library/Repository/Implementation/HTSocket.c Tue Jan 23 16:31:33 1996
  1662. ***************
  1663. *** 114,121 ****
  1664.         net->cbf, net->priority);
  1665.        return HT_WOULD_BLOCK;
  1666.    } else { /* We have a real error */
  1667. !      HTRequest_addSystemError(request,  ERR_FATAL, socerrno, NO,
  1668. !       "NETREAD");
  1669.        return HT_ERROR;
  1670.    }
  1671.        } else if (!b_read) {
  1672. --- 114,122 ----
  1673.         net->cbf, net->priority);
  1674.        return HT_WOULD_BLOCK;
  1675.    } else { /* We have a real error */
  1676. !      if (PROT_TRACE)
  1677. !  TTYPrint(TDEST, "Read Socket. READ ERROR %dn",
  1678. !  socerrno);
  1679.        return HT_ERROR;
  1680.    }
  1681.        } else if (!b_read) {
  1682. diff -c Library/Repository/Implementation/HTTP.c:1.111.2.1 Library/Repository/Implementation/HTTP.c:1.111
  1683. *** Library/Repository/Implementation/HTTP.c:1.111.2.1 Tue Jan 23 16:31:34 1996
  1684. --- Library/Repository/Implementation/HTTP.c Tue Jan 23 16:31:34 1996
  1685. ***************
  1686. *** 61,69 ****
  1687.       HTTP_BEGIN = 0,
  1688.       HTTP_NEED_CONNECTION,
  1689.       HTTP_NEED_REQUEST,
  1690. !     HTTP_PERM_REDIRECT,
  1691. !     HTTP_TEMP_REDIRECT,
  1692.       HTTP_NOT_MODIFIED,
  1693.       HTTP_AA
  1694.   } HTTPState;
  1695.   
  1696. --- 61,69 ----
  1697.       HTTP_BEGIN = 0,
  1698.       HTTP_NEED_CONNECTION,
  1699.       HTTP_NEED_REQUEST,
  1700. !     HTTP_REDIRECTION,
  1701.       HTTP_NOT_MODIFIED,
  1702. +     HTTP_EXPIRED,
  1703.       HTTP_AA
  1704.   } HTTPState;
  1705.   
  1706. ***************
  1707. *** 104,112 ****
  1708.       http_info *http = (http_info *) net->context;
  1709.   
  1710.       /* Free stream with data TO network */
  1711. !     if (HTRequest_isDestination(req))
  1712. !  HTRequest_removeDestination(req);
  1713. !     else if (req->input_stream) {
  1714.    if (status == HT_INTERRUPTED)
  1715.        (*req->input_stream->isa->abort)(req->input_stream, NULL);
  1716.    else
  1717. --- 104,110 ----
  1718.       http_info *http = (http_info *) net->context;
  1719.   
  1720.       /* Free stream with data TO network */
  1721. !     if (!HTRequest_isDestination(req) && req->input_stream) {
  1722.    if (status == HT_INTERRUPTED)
  1723.        (*req->input_stream->isa->abort)(req->input_stream, NULL);
  1724.    else
  1725. ***************
  1726. *** 114,129 ****
  1727.    req->input_stream = NULL;
  1728.       }
  1729.   
  1730. -     /* Free user part of stream pipe if error */
  1731. -     if (!net->target && req->output_stream)
  1732. -  (*req->output_stream->isa->abort)(req->output_stream, NULL);
  1733.       /* Remove the request object and our own context structure for http */
  1734. !     HTNet_delete(net, req->internal ? HT_IGNORE : status);
  1735.       FREE(http);
  1736.       return YES;
  1737.   }
  1738.   
  1739.   /*
  1740.   ** This is a big switch handling all HTTP return codes. It puts in any
  1741.   ** appropiate error message and decides whether we should expect data
  1742. --- 112,163 ----
  1743.    req->input_stream = NULL;
  1744.       }
  1745.   
  1746.       /* Remove the request object and our own context structure for http */
  1747. !     HTNet_delete(net, status);
  1748.       FREE(http);
  1749.       return YES;
  1750.   }
  1751.   
  1752. + PRIVATE BOOL HTTPAuthentication (HTRequest * request)
  1753. + {
  1754. +     HTAAScheme scheme;
  1755. +     HTList *valid_schemes = HTList_new();
  1756. +     HTAssocList **scheme_specifics = NULL;
  1757. +     char *tmplate = NULL;
  1758. +     if (request->WWWAAScheme) {
  1759. +  if ((scheme = HTAAScheme_enum(request->WWWAAScheme)) != HTAA_UNKNOWN) {
  1760. +      HTList_addObject(valid_schemes, (void *) scheme);
  1761. +      if (!scheme_specifics) {
  1762. +  int i;
  1763. +  scheme_specifics = (HTAssocList**)
  1764. +      malloc(HTAA_MAX_SCHEMES * sizeof(HTAssocList*));
  1765. +  if (!scheme_specifics)
  1766. +      outofmem(__FILE__, "HTTPAuthentication");
  1767. +  for (i=0; i < HTAA_MAX_SCHEMES; i++)
  1768. +      scheme_specifics[i] = NULL;
  1769. +      }
  1770. +      scheme_specifics[scheme] = HTAA_parseArgList(request->WWWAARealm);
  1771. +  } else if (PROT_TRACE) {
  1772. +      HTRequest_addError(request, ERR_INFO, NO, HTERR_UNKNOWN_AA,
  1773. +         (void *) request->WWWAAScheme, 0, "HTTPAuthentication");
  1774. +      return NO;
  1775. +  }
  1776. +     }
  1777. +     if (request->WWWprotection) {
  1778. +  if (PROT_TRACE)
  1779. +      TTYPrint(TDEST, "Protection template set to `%s'n",
  1780. +      request->WWWprotection);
  1781. +  StrAllocCopy(tmplate, request->WWWprotection);
  1782. +     }
  1783. +     request->valid_schemes = valid_schemes;
  1784. +     request->scheme_specifics = scheme_specifics;
  1785. +     request->prot_template = tmplate;
  1786. +     return YES;
  1787. + }
  1788.   /*
  1789.   ** This is a big switch handling all HTTP return codes. It puts in any
  1790.   ** appropiate error message and decides whether we should expect data
  1791. ***************
  1792. *** 135,183 ****
  1793.   
  1794.         case 0:      /* 0.9 response */
  1795.         case 200:
  1796. -  me->http->next = HTTP_GOT_DATA;
  1797. -  break;
  1798.         case 201:
  1799. -  HTRequest_addError(me->request, ERR_INFO, NO, HTERR_CREATED,
  1800. -     me->reason, (int) strlen(me->reason),
  1801. -     "HTTPNextState");
  1802. -  me->http->next = HTTP_GOT_DATA;
  1803. -  break;
  1804.         case 202:
  1805. -  HTRequest_addError(me->request, ERR_INFO, NO, HTERR_ACCEPTED,
  1806. -     me->reason, (int) strlen(me->reason),
  1807. -     "HTTPNextState");
  1808. -  me->http->next = HTTP_GOT_DATA;
  1809. -  break;
  1810.         case 203:
  1811. -  HTRequest_addError(me->request, ERR_INFO, NO, HTERR_PARTIAL,
  1812. -     me->reason, (int) strlen(me->reason),
  1813. -     "HTTPNextState");
  1814.    me->http->next = HTTP_GOT_DATA;
  1815.    break;
  1816.   
  1817.         case 204:       /* No Response */
  1818. -  HTRequest_addError(me->request, ERR_INFO, NO, HTERR_NO_CONTENT,
  1819. -     me->reason, (int) strlen(me->reason),
  1820. -     "HTTPNextState");
  1821.    me->http->next = HTTP_NO_DATA;
  1822.    break;
  1823.   
  1824.         case 301:         /* Moved */
  1825. -  HTRequest_addError(me->request, ERR_INFO, NO, HTERR_MOVED,
  1826. -     me->reason, (int) strlen(me->reason),
  1827. -     "HTTPNextState");
  1828. -  me->http->next = HTTP_PERM_REDIRECT;
  1829. -  break;
  1830.         case 302:     /* Found */
  1831. !  HTRequest_addError(me->request, ERR_INFO, NO, HTERR_FOUND,
  1832. !     me->reason, (int) strlen(me->reason),
  1833. !     "HTTPNextState");
  1834. !  me->http->next = HTTP_TEMP_REDIRECT;
  1835.    break;
  1836.   
  1837.         case 303:    /* Method */
  1838. --- 169,187 ----
  1839.   
  1840.         case 0:      /* 0.9 response */
  1841.         case 200:
  1842.         case 201:
  1843.         case 202:
  1844.         case 203:
  1845.    me->http->next = HTTP_GOT_DATA;
  1846.    break;
  1847.   
  1848.         case 204:       /* No Response */
  1849.    me->http->next = HTTP_NO_DATA;
  1850.    break;
  1851.   
  1852.         case 301:         /* Moved */
  1853.         case 302:     /* Found */
  1854. !  me->http->next = HTTP_REDIRECTION;
  1855.    break;
  1856.   
  1857.         case 303:    /* Method */
  1858. ***************
  1859. *** 188,196 ****
  1860.    break;
  1861.   
  1862.         case 304:      /* Not Modified */
  1863. -  HTRequest_addError(me->request, ERR_FATAL, NO, HTERR_NOT_MODIFIED,
  1864. -     me->reason, (int) strlen(me->reason),
  1865. -     "HTTPNextState");
  1866.    me->http->next = HTTP_NOT_MODIFIED;
  1867.    break;
  1868.   
  1869. --- 192,197 ----
  1870. ***************
  1871. *** 350,356 ****
  1872.        *ptr = '';
  1873.   
  1874.    /* Set up the streams */
  1875. !  if (me->status==200) {
  1876.        HTStream *s;
  1877.        me->target = HTStreamStack(WWW_MIME, req->output_format,
  1878.           req->output_stream, req, NO);
  1879. --- 351,357 ----
  1880.        *ptr = '';
  1881.   
  1882.    /* Set up the streams */
  1883. !  if (me->status==200 && req->method==METHOD_GET) {
  1884.        HTStream *s;
  1885.        me->target = HTStreamStack(WWW_MIME, req->output_format,
  1886.           req->output_stream, req, NO);
  1887. ***************
  1888. *** 492,499 ****
  1889.       int status = HT_ERROR;
  1890.       HTNet *net = request->net;      /* Generic protocol information */
  1891.       http_info *http;     /* Specific protocol information */
  1892. !     HTParentAnchor *anchor = HTRequest_anchor(request);
  1893.       /*
  1894.       ** Initiate a new http structure and bind to request structure
  1895.       ** This is actually state HTTP_BEGIN, but it can't be in the state
  1896. --- 493,499 ----
  1897.       int status = HT_ERROR;
  1898.       HTNet *net = request->net;      /* Generic protocol information */
  1899.       http_info *http;     /* Specific protocol information */
  1900. !     
  1901.       /*
  1902.       ** Initiate a new http structure and bind to request structure
  1903.       ** This is actually state HTTP_BEGIN, but it can't be in the state
  1904. ***************
  1905. *** 501,516 ****
  1906.       */
  1907.       if (ops == FD_NONE) {
  1908.    if (PROT_TRACE) TTYPrint(TDEST, "HTTP........ Looking for `%s'n",
  1909. !  HTAnchor_physical(anchor));
  1910.    if ((http = (http_info *) calloc(1, sizeof(http_info))) == NULL)
  1911.        outofmem(__FILE__, "HTLoadHTTP");
  1912.    http->state = HTTP_BEGIN;
  1913.    http->next = HTTP_ERROR;
  1914.    net->context = http;
  1915.       } else if (ops == FD_CLOSE) {       /* Interrupted */
  1916. !  HTRequest_addError(request, ERR_FATAL, NO, HTERR_INTERRUPTED,
  1917. !     NULL, 0, "HTLoadHTTP");
  1918. !  HTTPCleanup(request, HT_INTERRUPTED);
  1919.    return HT_OK;
  1920.       } else
  1921.    http = (http_info *) net->context; /* Get existing copy */
  1922. --- 501,521 ----
  1923.       */
  1924.       if (ops == FD_NONE) {
  1925.    if (PROT_TRACE) TTYPrint(TDEST, "HTTP........ Looking for `%s'n",
  1926. !  HTAnchor_physical(request->anchor));
  1927.    if ((http = (http_info *) calloc(1, sizeof(http_info))) == NULL)
  1928.        outofmem(__FILE__, "HTLoadHTTP");
  1929.    http->state = HTTP_BEGIN;
  1930.    http->next = HTTP_ERROR;
  1931.    net->context = http;
  1932.       } else if (ops == FD_CLOSE) {       /* Interrupted */
  1933. ! #if 1
  1934. !  if (HTRequest_isPostWeb(request))
  1935. ! #else
  1936. !  if(HTRequest_isPostWeb(request)&&!HTRequest_isMainDestination(request))
  1937. ! #endif
  1938. !      HTTPCleanup(request, HT_IGNORE);
  1939. !  else
  1940. !      HTTPCleanup(request, HT_INTERRUPTED);
  1941.    return HT_OK;
  1942.       } else
  1943.    http = (http_info *) net->context; /* Get existing copy */
  1944. ***************
  1945. *** 538,544 ****
  1946.        break;
  1947.        
  1948.      case HTTP_NEED_CONNECTION:      /* Now let's set up a connection */
  1949. !      status = HTDoConnect(net, HTAnchor_physical(anchor),
  1950.     HTTP_PORT);
  1951.        if (status == HT_OK) {
  1952.   
  1953. --- 543,549 ----
  1954.        break;
  1955.        
  1956.      case HTTP_NEED_CONNECTION:      /* Now let's set up a connection */
  1957. !      status = HTDoConnect(net, HTAnchor_physical(request->anchor),
  1958.     HTTP_PORT);
  1959.        if (status == HT_OK) {
  1960.   
  1961. ***************
  1962. *** 566,572 ****
  1963.    ** before all destinations are ready. If destination then
  1964.    ** register the input stream and get ready for read
  1965.    */
  1966. !  if (HTRequest_isDestination(request)) {
  1967.        HTEvent_Register(net->sockfd, request, (SockOps) FD_READ,
  1968.         HTLoadHTTP, net->priority);
  1969.        HTRequest_linkDestination(request);
  1970. --- 571,577 ----
  1971.    ** before all destinations are ready. If destination then
  1972.    ** register the input stream and get ready for read
  1973.    */
  1974. !  if (HTRequest_isPostWeb(request)) {
  1975.        HTEvent_Register(net->sockfd, request, (SockOps) FD_READ,
  1976.         HTLoadHTTP, net->priority);
  1977.        HTRequest_linkDestination(request);
  1978. ***************
  1979. *** 574,581 ****
  1980.   
  1981.    /* Set up stream FROM network and corresponding read buffer */
  1982.    net->isoc = HTInputSocket_new(net->sockfd);
  1983. -  net->target = HTTPStatus_new(request, http);
  1984.   
  1985.    http->state = HTTP_NEED_REQUEST;
  1986.        } else if (status == HT_WOULD_BLOCK || status == HT_PERSISTENT)
  1987.    return HT_OK;
  1988. --- 579,587 ----
  1989.   
  1990.    /* Set up stream FROM network and corresponding read buffer */
  1991.    net->isoc = HTInputSocket_new(net->sockfd);
  1992.   
  1993. +  /* @@@ USE STREAM STACK @@@ */
  1994. +  net->target = HTTPStatus_new(request, http);
  1995.    http->state = HTTP_NEED_REQUEST;
  1996.        } else if (status == HT_WOULD_BLOCK || status == HT_PERSISTENT)
  1997.    return HT_OK;
  1998. ***************
  1999. *** 588,599 ****
  2000.        if (ops == FD_WRITE || ops == FD_NONE) {
  2001.    if (HTRequest_isDestination(request)) {