Diff for /Amaya/amaya/query.c between versions 1.181 and 1.182

version 1.181, 1999/03/26 17:39:57 version 1.182, 1999/04/20 15:52:24
Line 149  char *filename; Line 149  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);
 #endif /* _WINDOWS */  #endif /* _WINDOWS */
 }  }
Line 426  AHTReqContext      *me; Line 425  AHTReqContext      *me;
                TtaFreeMemory ((void *) docid_status);                 TtaFreeMemory ((void *) docid_status);
              }               }
          }           }
          /* JK: no longer needed in libwww 5.2.3
        if (me->method != METHOD_PUT && HTRequest_outputStream (me->request))         if (me->method != METHOD_PUT && HTRequest_outputStream (me->request))
          AHTFWriter_FREE (HTRequest_outputStream (me->request));           AHTFWriter_FREE (HTRequest_outputStream (me->request));
            */
                 
        HTRequest_delete (me->request);         HTRequest_delete (me->request);
                 
Line 728  int                 status; Line 729  int                 status;
           }            }
         ChopURL (me->status_urlName, me->urlName);          ChopURL (me->status_urlName, me->urlName);
   
         /* clean the output stream */  
         if (HTRequest_outputStream (me->request) != NULL) {          /* @@ verify if this is important */
           AHTFWriter_FREE (HTRequest_outputStream (me->request));          /* @@@ new libwww doesn't need this free stream while making
              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 1248  HTList             *c; Line 1253  HTList             *c;
                         HTThroughLine, 1.0, 0.0, 0.0);                          HTThroughLine, 1.0, 0.0, 0.0);
       HTConversion_add (c, "image/xpm",  "www/present",         HTConversion_add (c, "image/xpm",  "www/present", 
                         HTThroughLine, 1.0, 0.0, 0.0);                          HTThroughLine, 1.0, 0.0, 0.0);
         /***
       HTConversion_add (c, "application/postscript",          HTConversion_add (c, "application/postscript",  
                         "www/present", HTThroughLine, 1.0, 0.0, 0.0);                          "www/present", HTThroughLine, 1.0, 0.0, 0.0);
                           ***/
    /* Define here the equivalences between MIME types and file extensions for     /* Define here the equivalences between MIME types and file extensions for
     the types that Amaya can display */      the types that Amaya can display */
   
     /***
      HTPresentation_add(c,"application/postscript", "gv %s",  NULL, 
                         1.0, 0.0, 0.0);
     ***/
   
   
    /* Initialize suffix bindings for local files */     /* Initialize suffix bindings for local files */
    HTBind_init();     HTBind_init();
   
Line 1382  static void         AHTNetInit (void) Line 1394  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 1412  static void         AHTNetInit (void) Line 1421  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 1464  View view; Line 1469  View view;
 #endif /* __STDC__ */  #endif /* __STDC__ */
 {  {
 #ifdef AMAYA_WWW_CACHE  #ifdef AMAYA_WWW_CACHE
   char *strptr;    char *real_dir, *strptr;
   char *cache_dir;    char *cache_dir;
   int cache_size;    int cache_size;
   int cache_expire;    int cache_expire;
   int cache_disconnect;    int cache_disconnect;
   
   if (!HTCacheMode_enabled ())    if (!HTCacheMode_enabled ())
     /* 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 ());    cache_dir = TtaStrdup ( (char *) HTCacheMode_getRoot ());
   cache_size = HTCacheMode_maxSize ();    cache_size = HTCacheMode_maxSize ();
Line 1486  View view; Line 1491  View view;
   clear_cachelock ();    clear_cachelock ();
   HTCacheTerminate ();    HTCacheTerminate ();
   HTCacheMode_setEnabled (NO);    HTCacheMode_setEnabled (NO);
   strptr = TtaGetMemory (strlen (cache_dir) + 20);    /* changes for libwww-cvs */
   strcpy (strptr, cache_dir);    /** old
   strcat (strptr, DIR_STR);      strcpy (strptr, cache_dir);
        strcat (strptr, DIR_STR);
        */
     /* new */
     /* skip the file: prefix */
     real_dir = TtaGetMemory (strlen (cache_dir) + 20);
     if (!strncasecmp (cache_dir, "file:", 5))
       {
         strptr = strchr (cache_dir, ':');
         strptr++;
       }
     strcpy (real_dir, strptr);
   
   RecCleanCache (strptr);    RecCleanCache (real_dir);
   
   HTCacheMode_setExpires (cache_expire);    HTCacheMode_setExpires (cache_expire);
   HTCacheMode_setDisconnected (cache_disconnect);    HTCacheMode_setDisconnected (cache_disconnect);
   HTCacheInit (cache_dir, cache_size);    HTCacheInit (real_dir, cache_size);
   /* set a new concurrent cache lock */    /* set a new concurrent cache lock */
   strcat (strptr, ".lock");    strcat (real_dir, ".lock");
   if (set_cachelock (strptr) == -1)    if (set_cachelock (real_dir) == -1)
     /* couldn't open the .lock file, so, we close the cache to      /* couldn't open the .lock file, so, we close the cache to
        be in the safe side */         be in the safe side */
     {      {
Line 1510  View view; Line 1526  View view;
 #ifdef DEBUG_LIBWWW  #ifdef DEBUG_LIBWWW
   fprintf (stderr, "set a cache lock\n");    fprintf (stderr, "set a cache lock\n");
 #endif /* DEBUG_LIBWWW */  #endif /* DEBUG_LIBWWW */
   TtaFreeMemory (strptr);    /* not needed anymore in the new libwww */
     TtaFreeMemory (real_dir);
   TtaFreeMemory (cache_dir);    TtaFreeMemory (cache_dir);
 #endif /* AMAYA_WWW_CACHE */  #endif /* AMAYA_WWW_CACHE */
 }  }
Line 1693  static void Cacheinit () Line 1710  static void Cacheinit ()
   strcat (cache_dir, CACHE_DIR_NAME);    strcat (cache_dir, CACHE_DIR_NAME);
   
   /* 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");
   if (strptr && *strptr)     if (strptr && *strptr) 
       cache_size = atoi (strptr);        cache_size = atoi (strptr);
   else    else
Line 1885  char               *AppVersion; Line 1902  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 2042  void                QueryInit () Line 2057  void                QueryInit ()
    HTHost_setEventTimeout (tmp_i);     HTHost_setEventTimeout (tmp_i);
   
    HTRequest_setMaxRetry (8);     HTRequest_setMaxRetry (8);
   
 #ifdef CATCH_SIG  #ifdef CATCH_SIG
    signal (SIGPIPE, SIG_IGN);     signal (SIGPIPE, SIG_IGN);
 #endif  #endif
Line 2391  char       *content_type; Line 2407  char       *content_type;
        return HT_ERROR;         return HT_ERROR;
      }       }
   
      /*@@@*/
      ref = strrchr (urlName, '\r');
      if (ref)
        *ref = '\0';
   
      /*@@@*/
    /* we store CSS in subdir named 0; all the other files go to a subidr     /* we store CSS in subdir named 0; all the other files go to a subidr
       named after their own docid */        named after their own docid */
         
Line 2439  char       *content_type; Line 2461  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 2725  void               *context_tcbf; Line 2745  void               *context_tcbf;
    me->block_size =  file_stat.st_size;     me->block_size =  file_stat.st_size;
    /* select the parameters that distinguish a PUT from a GET/POST */     /* select the parameters that distinguish a PUT from a GET/POST */
    me->method = METHOD_PUT;     me->method = METHOD_PUT;
      /*
      HTRequest_setMethod (me->request, METHOD_PUT);
      */
    me->output = stdout;     me->output = stdout;
    /* we are not expecting to receive any input from the server */     /* we are not expecting to receive any input from the server */
    me->outputfile = (char *) NULL;      me->outputfile = (char *) NULL; 
Line 2766  void               *context_tcbf; Line 2789  void               *context_tcbf;
                        HTAtom_for (tmp));                         HTAtom_for (tmp));
    HTRequest_setOutputFormat (me->request,     HTRequest_setOutputFormat (me->request,
                               HTAtom_for (tmp));                                HTAtom_for (tmp));
      /* associate the anchor to the request */
      /*
      HTRequest_setEntityAnchor (me->request, HTAnchor_parent (me->source));
      */
    /* define other request characteristics */     /* define other request characteristics */
 #ifdef _WINDOWS  #ifdef _WINDOWS
    HTRequest_setPreemptive (me->request, NO);     HTRequest_setPreemptive (me->request, NO);
Line 2871  int                 docid; Line 2897  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.181  
changed lines
  Added in v.1.182


Webmaster