Diff for /Amaya/amaya/query.c between versions 1.189 and 1.190

version 1.189, 1999/05/06 12:26:49 version 1.190, 1999/05/20 15:29:25
Line 156  char *filename; Line 156  char *filename;
     status = fcntl(fd_cachelock, F_SETLK, &lock);      status = fcntl(fd_cachelock, F_SETLK, &lock);
       
   if (status == -1)    if (status == -1)
     {       {
       if (fd_cachelock > 0)        if (fd_cachelock > 0)
         close (fd_cachelock);            close (fd_cachelock);
       fd_cachelock = 0;        fd_cachelock = 0;
     }      }
   return (status);    return (status);
Line 428  AHTReqContext      *me; Line 428  AHTReqContext      *me;
                TtaFreeMemory ((void *) docid_status);                 TtaFreeMemory ((void *) docid_status);
              }               }
          }           }
        if (me->method != METHOD_PUT && HTRequest_outputStream (me->request))         /* JK: no longer needed in libwww 5.2.3
          AHTFWriter_FREE (HTRequest_outputStream (me->request));            if (me->method != METHOD_PUT && HTRequest_outputStream (me->request))
                    AHTFWriter_FREE (HTRequest_outputStream (me->request));
          */
        HTRequest_delete (me->request);         HTRequest_delete (me->request);
                 
        if (me->output && me->output != stdout)         if (me->output && me->output != stdout)
Line 730  int                 status; Line 731  int                 status;
           }            }
         ChopURL (me->status_urlName, me->urlName);          ChopURL (me->status_urlName, me->urlName);
   
         /* clean the output stream */          /* @@ verify if this is important */
         if (HTRequest_outputStream (me->request) != NULL) {          /* @@@ new libwww doesn't need this free stream while making
           AHTFWriter_FREE (HTRequest_outputStream (me->request));             a PUT. Is it the case everywhere or just for PUT? */
           if (me->method != METHOD_PUT 
               && me->request->orig_output_stream != NULL) {
             AHTFWriter_FREE (me->request->orig_output_stream);
           if (me->output != stdout) { /* Are we writing to a file? */            if (me->output != stdout) { /* Are we writing to a file? */
 #ifdef DEBUG_LIBWWW  #ifdef DEBUG_LIBWWW
             fprintf (stderr, "redirection_handler: New URL is  %s, closing "              fprintf (stderr, "redirection_handler: New URL is  %s, closing "
Line 1332  HTList             *c; Line 1336  HTList             *c;
    ** action taken     ** action taken
    */     */
    HTConversion_add (c, "*/*", "www/present", HTSaveLocally,     HTConversion_add (c, "*/*", "www/present", HTSaveLocally,
                      0.3, 0.0, 0.0);                       0.3, 0.0, 0.0);  
      
 }  }
   
   
Line 1384  static void         AHTNetInit (void) Line 1387  static void         AHTNetInit (void)
 **      Not done automaticly - may be done by application!  **      Not done automaticly - may be done by application!
 */  */
   
 #ifdef AMAYA_WWW_CACHE    
   HTNet_addBefore (HTCacheFilter, "http://*", NULL, HT_FILTER_MIDDLE);  
 #endif /* AMAYA_WWW_CACHE */  
   HTNet_addBefore (HTCredentialsFilter, "http://*", NULL, HT_FILTER_LATE);    HTNet_addBefore (HTCredentialsFilter, "http://*", NULL, HT_FILTER_LATE);
   HTNet_addBefore (HTProxyFilter, NULL, NULL, HT_FILTER_LATE);    HTNet_addBefore (HTProxyFilter, NULL, NULL, HT_FILTER_LATE);
   HTHost_setActivateRequestCallback (AHTOpen_file);    HTHost_setActivateRequestCallback (AHTOpen_file);
Line 1414  static void         AHTNetInit (void) Line 1414  static void         AHTNetInit (void)
                  HT_FILTER_MIDDLE);                   HT_FILTER_MIDDLE);
   HTNet_addAfter (HTUseProxyFilter, "http://*", NULL, HT_USE_PROXY,    HTNet_addAfter (HTUseProxyFilter, "http://*", NULL, HT_USE_PROXY,
                   HT_FILTER_MIDDLE);                    HT_FILTER_MIDDLE);
 #ifdef AMAYA_WWW_CACHE  
   HTNet_addAfter (HTCacheUpdateFilter, "http://*", NULL, HT_NOT_MODIFIED,   
                   HT_FILTER_MIDDLE);  
 #endif /* AMAYA_WWW_CACHE */  
 #ifdef AMAYA_LOST_UPDATE  #ifdef AMAYA_LOST_UPDATE
   HTNet_addAfter (precondition_handler, NULL, NULL, HT_PRECONDITION_FAILED,    HTNet_addAfter (precondition_handler, NULL, NULL, HT_PRECONDITION_FAILED,
                   HT_FILTER_MIDDLE);                    HT_FILTER_MIDDLE);
Line 1468  View view; Line 1464  View view;
 #ifdef AMAYA_WWW_CACHE  #ifdef AMAYA_WWW_CACHE
   char *real_dir;    char *real_dir;
   char *cache_dir;    char *cache_dir;
   char *strptr;    char *tmp;
   int cache_size;    int cache_size;
   int cache_expire;    int cache_expire;
   int cache_disconnect;    int cache_disconnect;
   int i;  
   boolean error;    boolean error;
   STRING ptr;    STRING ptr;
   
Line 1480  View view; Line 1475  View view;
     /* don't do anything if we're not using a cache */      /* don't do anything if we're not using a cache */
     return;      return;
   /* temporarily close down the cache, purge it, then restart */    /* temporarily close down the cache, purge it, then restart */
   cache_dir = TtaStrdup ( (char *) HTCacheMode_getRoot ());    tmp = (char *) HTCacheMode_getRoot ();
     /* don't do anything if we don't have a valid cache dir */
     if (!tmp || *tmp == EOS)
             return;
     cache_dir = TtaStrdup (tmp);
   cache_size = HTCacheMode_maxSize ();    cache_size = HTCacheMode_maxSize ();
   cache_expire = HTCacheMode_expires ();    cache_expire = HTCacheMode_expires ();
   cache_disconnect = HTCacheMode_disconnected ();    cache_disconnect = HTCacheMode_disconnected ();
   
   /* get something we can work on :) */    /* get something we can work on :) */
   real_dir = TtaGetMemory (strlen (cache_dir) + 20);    tmp = HTWWWToLocal (cache_dir, "file:", NULL);
 #ifdef _WINDOWS    real_dir = TtaGetMemory (strlen (tmp) + 20);
   if (!_strnicmp (cache_dir, "file:", 5))    strcpy (real_dir, tmp);
 #else    HT_FREE (tmp);
     if (!strncasecmp (cache_dir, "file:", 5))  
 #endif /* _WINDOWS */  
       {  
         strptr = strchr (cache_dir, ':');  
         strptr++;  
         strptr++;  
       }  
   
   /* convert libwww's internal's cache dir name to one  
      corresponding to the filesystem */  
   i = 0;  
   while (cache_dir[i] != EOS)  
     {  
       if (cache_dir[i] == '/')  
         real_dir[i] = DIR_SEP;  
       else  
         real_dir[i] = cache_dir[i];  
       i++;  
     }  
   real_dir[i] = EOS;  
   
   /* safeguard... abort the operation if cache_dir doesn't end with    /* safeguard... abort the operation if cache_dir doesn't end with
      CACHE_DIR_NAME */       CACHE_DIR_NAME */
Line 1754  int i; Line 1733  int i;
   
     
   cache_dir = TtaGetMemory (strlen (real_dir) + 10);    cache_dir = TtaGetMemory (strlen (real_dir) + 10);
   strcpy (cache_dir, real_dir);    sprintf (cache_dir, "file:%s", real_dir);
   
   /* get the cache size (or use a default one) */    /* get the cache size (or use a default one) */
   strptr = (char *) TtaGetEnvString ("CACHE_SIZE");    strptr = (char *) TtaGetEnvString ("CACHE_SIZE");
Line 1972  char               *AppVersion; Line 1951  char               *AppVersion;
   
    /* Register the default set of transfer encoders and decoders */     /* Register the default set of transfer encoders and decoders */
    HTTransferEncoderInit (transfer_encodings);     HTTransferEncoderInit (transfer_encodings);
    /* ignore all other encoding formats (or libwww will send them     HTFormat_setTransferCoding (transfer_encodings);
      /* Register the default set of content encoders and decoders */
      HTContentEncoderInit (content_encodings);
      /* ignore all other encoding formats (or libwww will send them 
       thru a blackhole otherwise */        thru a blackhole otherwise */
    HTCoding_add (content_encodings, "*", NULL, HTIdentityCoding, 1.0);     HTCoding_add (content_encodings, "*", NULL, HTIdentityCoding, 1.0);
   
    HTFormat_setTransferCoding(transfer_encodings);  
      
    /* Register the default set of content encoders and decoders */  
    HTContentEncoderInit(content_encodings);  
    if (HTList_count(content_encodings) > 0)     if (HTList_count(content_encodings) > 0)
      HTFormat_setContentCoding(content_encodings);       HTFormat_setContentCoding(content_encodings);
    else      else 
Line 2080  void                QueryInit () Line 2057  void                QueryInit ()
    HTTimer_registerSetTimerCallback ((void *) AMAYA_SetTimer);     HTTimer_registerSetTimerCallback ((void *) AMAYA_SetTimer);
    HTTimer_registerDeleteTimerCallback ((void *) AMAYA_DeleteTimer);     HTTimer_registerDeleteTimerCallback ((void *) AMAYA_DeleteTimer);
 #endif /* !_WINDOWS */  #endif /* !_WINDOWS */
      
      /*** @@@@
    WWW_TraceFlag = 0;     WWW_TraceFlag = 0;
      ***/
 #ifdef DEBUG_LIBWWW  #ifdef DEBUG_LIBWWW
   /* forwards error messages to our own function */    /* forwards error messages to our own function */
    WWW_TraceFlag = THD_TRACE;     WWW_TraceFlag = THD_TRACE;
Line 2526  char       *content_type; Line 2505  char       *content_type;
      {       {
        me->method = METHOD_POST;         me->method = METHOD_POST;
        HTRequest_setMethod (me->request, METHOD_POST);         HTRequest_setMethod (me->request, METHOD_POST);
        /* don't use the cache for post requests */  
        HTRequest_setReloadMode (me->request, HT_CACHE_FLUSH);  
      }       }
    else      else 
      {       {
Line 2853  void               *context_tcbf; Line 2830  void               *context_tcbf;
                        HTAtom_for (tmp));                         HTAtom_for (tmp));
    HTRequest_setOutputFormat (me->request,     HTRequest_setOutputFormat (me->request,
                               HTAtom_for (tmp));                                HTAtom_for (tmp));
   
    /* define other request characteristics */     /* define other request characteristics */
 #ifdef _WINDOWS  #ifdef _WINDOWS
    HTRequest_setPreemptive (me->request, NO);     HTRequest_setPreemptive (me->request, NO);
Line 2958  int                 docid; Line 2934  int                 docid;
      }       }
 }  }
   
   /* @@@ the docid parameter isn't used... clean it up */
 /*----------------------------------------------------------------------  /*----------------------------------------------------------------------
   StopAllRequests    StopAllRequests
   stops (kills) all active requests. We use the docid     stops (kills) all active requests. We use the docid 

Removed from v.1.189  
changed lines
  Added in v.1.190


Webmaster