Diff for /Amaya/amaya/query.c between versions 1.233 and 1.234

version 1.233, 2000/02/16 17:03:59 version 1.234, 2000/02/21 18:14:34
Line 1356  HTList             *c; Line 1356  HTList             *c;
       
   lang_list = TtaGetEnvString ("ACCEPT_LANGUAGES");    lang_list = TtaGetEnvString ("ACCEPT_LANGUAGES");
   s[2] = EOS;    s[2] = EOS;
   if (lang_list && *lang_list != CUS_EOS)    if (lang_list && *lang_list != WC_EOS)
     {      {
       /* add the default language first  */        /* add the default language first  */
       HTLanguage_add (c, "*", -1.0);        HTLanguage_add (c, "*", -1.0);
Line 1408  HTList             *c; Line 1408  HTList             *c;
                         }                          }
             if (lg >= 2) {              if (lg >= 2) {
                if (still)                 if (still)
                   cus2iso_strncpy  (s, &ptr[1], 2);                    wc2iso_strncpy  (s, &ptr[1], 2);
                else                 else
                    cus2iso_strncpy (s, lang_list, 2);                     wc2iso_strncpy (s, lang_list, 2);
                count--;                 count--;
                HTLanguage_add (c, s, quality);                 HTLanguage_add (c, s, quality);
                quality += 0.1;                 quality += 0.1;
Line 1508  static void         AHTProtocolInit (voi Line 1508  static void         AHTProtocolInit (voi
   
    /* initialize pipelining */     /* initialize pipelining */
   strptr = TtaGetEnvString ("ENABLE_PIPELINING");    strptr = TtaGetEnvString ("ENABLE_PIPELINING");
   if (strptr && *strptr && StringCaseCompare (strptr, CUSTEXT("yes")))    if (strptr && *strptr && ustrcasecmp (strptr, TEXT("yes")))
     HTTP_setConnectionMode (HTTP_11_NO_PIPELINING);      HTTP_setConnectionMode (HTTP_11_NO_PIPELINING);
 }  }
   
Line 1682  CHAR_T*   dirname; Line 1682  CHAR_T*   dirname;
   CHAR_T*       ptr;    CHAR_T*       ptr;
   
   /* create a t_dir name to start searching for files */    /* create a t_dir name to start searching for files */
   if ((StringLength (dirname) + 10) > MAX_LENGTH)    if ((ustrlen (dirname) + 10) > MAX_LENGTH)
     /* ERROR: directory name is too big */      /* ERROR: directory name is too big */
     return;      return;
   
   StringCopy (t_dir, dirname);    ustrcpy (t_dir, dirname);
   /* save the end of the dirname. We'll use it to make    /* save the end of the dirname. We'll use it to make
      a complete pathname when erasing files */       a complete pathname when erasing files */
   ptr = &t_dir[StringLength (t_dir)];    ptr = &t_dir[ustrlen (t_dir)];
   StringConcat (t_dir, CUSTEXT("*"));    ustrcat (t_dir, TEXT("*"));
   
   hFindFile = FindFirstFile (t_dir, &ffd);    hFindFile = FindFirstFile (t_dir, &ffd);
           
Line 1809  int i; Line 1809  int i;
   
   /* activate cache? */    /* activate cache? */
   strptr = TtaGetEnvString ("ENABLE_CACHE");    strptr = TtaGetEnvString ("ENABLE_CACHE");
   if (strptr && *strptr && StringCaseCompare (strptr, CUSTEXT("yes")))    if (strptr && *strptr && ustrcasecmp (strptr, TEXT("yes")))
     cache_enabled = NO;      cache_enabled = NO;
   else    else
     cache_enabled = YES;      cache_enabled = YES;
   
   /* cache protected documents? */    /* cache protected documents? */
   strptr = TtaGetEnvString ("CACHE_PROTECTED_DOCS");    strptr = TtaGetEnvString ("CACHE_PROTECTED_DOCS");
   if (strptr && *strptr && !StringCaseCompare (strptr, CUSTEXT("yes")))    if (strptr && *strptr && !ustrcasecmp (strptr, TEXT("yes")))
     HTCacheMode_setProtected (YES);      HTCacheMode_setProtected (YES);
   else    else
     HTCacheMode_setProtected (NO);      HTCacheMode_setProtected (NO);
Line 1825  int i; Line 1825  int i;
   strptr = TtaGetEnvString ("CACHE_DIR");    strptr = TtaGetEnvString ("CACHE_DIR");
   if (strptr && *strptr)     if (strptr && *strptr) 
     {      {
       real_dir = TtaAllocCUString (StringLength (strptr) + StringLength (CACHE_DIR_NAME) + 20);        real_dir = TtaAllocString (ustrlen (strptr) + ustrlen (CACHE_DIR_NAME) + 20);
       StringCopy (real_dir, strptr);        ustrcpy (real_dir, strptr);
           if (*(real_dir + StringLength (real_dir) - 1) != CUS_DIR_SEP)            if (*(real_dir + ustrlen (real_dir) - 1) != WC_DIR_SEP)
             StringConcat (real_dir, CUS_DIR_STR);              ustrcat (real_dir, WC_DIR_STR);
     }      }
   else    else
     {      {
       real_dir = TtaAllocCUString (StringLength (TempFileDirectory) + StringLength (CACHE_DIR_NAME) + 20);        real_dir = TtaAllocString (ustrlen (TempFileDirectory) + ustrlen (CACHE_DIR_NAME) + 20);
       usprintf (real_dir, TEXT("%s%s"), TempFileDirectory, CACHE_DIR_NAME);        usprintf (real_dir, TEXT("%s%s"), TempFileDirectory, CACHE_DIR_NAME);
     }      }
   
   /* compatiblity with previous versions of Amaya: does real_dir    /* compatiblity with previous versions of Amaya: does real_dir
      include CACHE_DIR_NAME? If not, add it */       include CACHE_DIR_NAME? If not, add it */
   strptr = StringSubstring (real_dir, CACHE_DIR_NAME);    strptr = ustrstr (real_dir, CACHE_DIR_NAME);
   if (!strptr)    if (!strptr)
     StringConcat (real_dir, CACHE_DIR_NAME);      ustrcat (real_dir, CACHE_DIR_NAME);
   else    else
     {      {
       i = StringLength (CACHE_DIR_NAME);        i = ustrlen (CACHE_DIR_NAME);
           if (strptr[i] != CUS_EOS)            if (strptr[i] != WC_EOS)
           StringConcat (real_dir, CACHE_DIR_NAME);            ustrcat (real_dir, CACHE_DIR_NAME);
     }      }
   
   /* convert the local cache dir into a file URL, as expected by    /* convert the local cache dir into a file URL, as expected by
      libwww */       libwww */
     
   cus2iso_strcpy (www_realDir, real_dir);    wc2iso_strcpy (www_realDir, real_dir);
   
   cache_dir = HTLocalToWWW (www_realDir, "file:");    cache_dir = HTLocalToWWW (www_realDir, "file:");
   
Line 1869  int i; Line 1869  int i;
   if (cache_enabled)     if (cache_enabled) 
     {      {
       /* how to remove the lock? force remove it? */        /* how to remove the lock? force remove it? */
       cache_lockfile = TtaAllocCUString (StringLength (real_dir) + 20);        cache_lockfile = TtaAllocString (ustrlen (real_dir) + 20);
       StringCopy (cache_lockfile, real_dir);        ustrcpy (cache_lockfile, real_dir);
       StringConcat (cache_lockfile, CUSTEXT(".lock"));        ustrcat (cache_lockfile, TEXT(".lock"));
       cache_locked = FALSE;        cache_locked = FALSE;
       if (TtaFileExist (cache_lockfile) && !(cache_locked = test_cachelock (cache_lockfile)))        if (TtaFileExist (cache_lockfile) && !(cache_locked = test_cachelock (cache_lockfile)))
         {          {
Line 1881  int i; Line 1881  int i;
           /* remove the lock and clean the cache (the clean cache             /* remove the lock and clean the cache (the clean cache 
              will remove all, making the following call unnecessary */               will remove all, making the following call unnecessary */
           /* little trick to win some memory */            /* little trick to win some memory */
           strptr = StrRChr (cache_lockfile, CUSTEXT('.'));            strptr = ustrrchr (cache_lockfile, TEXT('.'));
           *strptr = CUS_EOS;            *strptr = WC_EOS;
           RecCleanCache (cache_lockfile);            RecCleanCache (cache_lockfile);
           *strptr = CUSTEXT('.');            *strptr = TEXT('.');
         }          }
   
       if (!cache_locked)         if (!cache_locked) 
Line 1970  static void ProxyInit () Line 1970  static void ProxyInit ()
   strptr = TtaGetEnvString ("HTTP_PROXY");    strptr = TtaGetEnvString ("HTTP_PROXY");
   if (strptr && *strptr)    if (strptr && *strptr)
     {      {
       tmp = (char*) TtaGetMemory (StringLength (strptr) + 1);        tmp = (char*) TtaGetMemory (ustrlen (strptr) + 1);
       cus2iso_strcpy (tmp, strptr);        wc2iso_strcpy (tmp, strptr);
   
       /* does the proxy env string has an "http://" prefix? */        /* does the proxy env string has an "http://" prefix? */
       if (!StringNCaseCompare (strptr, CUSTEXT("http://"), 7))         if (!ustrncasecmp (strptr, TEXT("http://"), 7)) 
         HTProxy_add ("http", tmp);          HTProxy_add ("http", tmp);
       else         else 
         {          {
Line 1991  static void ProxyInit () Line 1991  static void ProxyInit ()
   strptr = TtaGetEnvString ("PROXYDOMAIN");    strptr = TtaGetEnvString ("PROXYDOMAIN");
   if (strptr && *strptr)     if (strptr && *strptr) 
     {      {
       strptrA = (char*) TtaGetMemory (StringLength (strptr) + 1);        strptrA = (char*) TtaGetMemory (ustrlen (strptr) + 1);
       cus2iso_strcpy (strptrA, strptr);        wc2iso_strcpy (strptrA, strptr);
       /* as HTNextField changes the ptr we pass as an argument, we'll        /* as HTNextField changes the ptr we pass as an argument, we'll
          work with another variable, so that we can free the strptrA           work with another variable, so that we can free the strptrA
          block later on */           block later on */
Line 2041  static void SafePut_init () Line 2041  static void SafePut_init ()
   if (strptr && *strptr)    if (strptr && *strptr)
     {      {
       /* Get copy we can mutilate */        /* Get copy we can mutilate */
       strptrA = (char*) TtaGetMemory (StringLength (strptr) + 1);        strptrA = (char*) TtaGetMemory (ustrlen (strptr) + 1);
       cus2iso_strcpy (strptrA, strptr);        wc2iso_strcpy (strptrA, strptr);
       ptr2 = strptrA;        ptr2 = strptrA;
       /* convert to lowercase */        /* convert to lowercase */
       ptr = strptrA;        ptr = strptrA;
Line 2115  static ThotBool SafePut_query (char *url Line 2115  static ThotBool SafePut_query (char *url
   creates the Amaya client profile for libwww.    creates the Amaya client profile for libwww.
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static void         AHTProfile_newAmaya (char* AppName, char* AppVersion)  static void         AHTProfile_newAmaya (CHAR_T* AppName, CHAR_T* AppVersion)
 #else  /* __STDC__ */  #else  /* __STDC__ */
 static void         AHTProfile_newAmaya (AppName, AppVersion)  static void         AHTProfile_newAmaya (AppName, AppVersion)
 char* AppName;  char* AppName;
Line 2123  char* AppVersion; Line 2123  char* AppVersion;
 #endif /* __STDC__ */  #endif /* __STDC__ */
 {  {
    CHAR_T* strptr;     CHAR_T* strptr;
   #  ifdef _I18N_
      unsigned char mbAppName[MAX_LENGTH], mbAppVersion[MAX_LENGTH];
   #  else  /* !_I18N_ */
      char* mbAppName    = AppName;
      char* mbAppVersion = AppVersion;
   #  endif /* !_I18N_ */
   
    /* If the Library is not already initialized then do it */     /* If the Library is not already initialized then do it */
    if (!HTLib_isInitialized ())     if (!HTLib_isInitialized ()) {
       HTLibInit (AppName, AppVersion);  #     ifdef _I18N_
         /* Here we suppose that libwww works with multibyte character string (MBCS).
            AppName and AppVersion are wide character strings (WCS). The following 
                    code transform each of AppName and AppVersion (WCSs) int mbAppName and
            mbAppName (MBCSs).
            If the libwww will support WCSs, than you have to remove the code related 
            to _I18N_ (rounded by #ifdef _I18N_ #endif) and pass to HTLibInit
            AppName instead of mbAppName and AppVersion instead of mbAppVersion */
         wcstombs (mbAppName, AppName, MAX_LENGTH);
         wcstombs (mbAppVersion, AppVersion, MAX_LENGTH);
   #     endif /* _I18N_ */
         HTLibInit (mbAppName, mbAppVersion);
      } 
   
    if (!converters)     if (!converters)
       converters = HTList_new ();        converters = HTList_new ();
Line 2166  char* AppVersion; Line 2184  char* AppVersion;
    HTAA_newModule ("basic", HTBasic_generate, HTBasic_parse, NULL, HTBasic_delete);     HTAA_newModule ("basic", HTBasic_generate, HTBasic_parse, NULL, HTBasic_delete);
    /* activate MDA by defaul */     /* activate MDA by defaul */
    strptr = TtaGetEnvString ("ENABLE_MDA");     strptr = TtaGetEnvString ("ENABLE_MDA");
    if (!strptr || (strptr && *strptr && StringCaseCompare (strptr, CUSTEXT("no"))))     if (!strptr || (strptr && *strptr && ustrcasecmp (strptr, TEXT("no"))))
      HTAA_newModule ("digest", HTDigest_generate, HTDigest_parse, HTDigest_updateInfo, HTDigest_delete);       HTAA_newModule ("digest", HTDigest_generate, HTDigest_parse, HTDigest_updateInfo, HTDigest_delete);
   
    /* Get any proxy settings */     /* Get any proxy settings */
Line 2574  char *value; Line 2592  char *value;
   ---------------------------------------------------------------------*/    ---------------------------------------------------------------------*/
   
 #ifdef __STDC__  #ifdef __STDC__
 static ThotBool QGetFileSize (char *fileName, unsigned long *file_size)  static ThotBool QGetFileSize (CHAR_T* fileName, unsigned long *file_size)
 #else  #else
 static ThotBool QGetFileSize (fileName, file_size)  static ThotBool QGetFileSize (fileName, file_size)
 char *fileName;  CHAR_T*        fileName;
 unsigned long *file_size;  unsigned long* file_size;
 #endif /* __STDC__ */  #endif /* __STDC__ */
 {  {
   int fd;    int fd;
Line 2589  unsigned long *file_size; Line 2607  unsigned long *file_size;
   
   /* verify the file's size */    /* verify the file's size */
 #ifndef _WINDOWS  #ifndef _WINDOWS
   if ((fd = open (fileName, O_RDONLY)) == -1)    if ((fd = uopen (fileName, O_RDONLY)) == -1)
 #else   #else 
     if ((fd = uopen (fileName, _O_RDONLY | _O_BINARY)) == -1)      if ((fd = uopen (fileName, _O_RDONLY | _O_BINARY)) == -1)
 #endif /* _WINDOWS */  #endif /* _WINDOWS */
Line 2861  STRING        content_type; Line 2879  STRING        content_type;
          me->outputfile = TtaGetMemory (l + 2);           me->outputfile = TtaGetMemory (l + 2);
        else         else
          me->outputfile = TtaGetMemory (MAX_LENGTH + 2);           me->outputfile = TtaGetMemory (MAX_LENGTH + 2);
        strcpy (me->outputfile, outputfile);         ustrcpy (me->outputfile, outputfile);
        l = ustrlen (urlName);         l = ustrlen (urlName);
        if (l > MAX_LENGTH)         if (l > MAX_LENGTH)
          me->urlName = TtaGetMemory (l + 2);           me->urlName = TtaGetMemory (l + 2);
        else         else
          me->urlName = TtaGetMemory (MAX_LENGTH + 2);           me->urlName = TtaGetMemory (MAX_LENGTH + 2);
        strcpy (me->urlName, urlName);         ustrcpy (me->urlName, urlName);
 #ifdef _WINDOWS  #ifdef _WINDOWS
      /* force windows ASYNC requests to always be non preemptive */       /* force windows ASYNC requests to always be non preemptive */
      HTRequest_setPreemptive (me->request, NO);       HTRequest_setPreemptive (me->request, NO);
Line 3153  void               *context_tcbf; Line 3171  void               *context_tcbf;
        ptr1 = TtaGetEnvString ("DEFAULTNAME");         ptr1 = TtaGetEnvString ("DEFAULTNAME");
        if (ptr1 && *ptr1)          if (ptr1 && *ptr1) 
          {           {
            ptr2 = StringSubstring (urlName, ptr1);             ptr2 = ustrstr (urlName, ptr1);
            if (ptr2)              if (ptr2) 
              {               {
                me->default_put_name = TtaStrdup (urlName);                 me->default_put_name = TtaStrdup (urlName);
                me->default_put_name[strlen (me->default_put_name)                 me->default_put_name[strlen (me->default_put_name) - strlen (ptr1)] = EOS;
                                    - strlen (ptr1)] = EOS;  
                HTRequest_setDefaultPutName (me->request, me->default_put_name);                 HTRequest_setDefaultPutName (me->request, me->default_put_name);
              }               }
          }           }
Line 3210  void               *context_tcbf; Line 3227  void               *context_tcbf;
    /* .. and we give the same type to the source anchor */     /* .. and we give the same type to the source anchor */
    /* we go thru setOutputFormat, rather than change the parent's     /* we go thru setOutputFormat, rather than change the parent's
       anchor, as that's the place that libwww expects it to be */        anchor, as that's the place that libwww expects it to be */
    HTAnchor_setFormat (HTAnchor_parent (me->source),     HTAnchor_setFormat (HTAnchor_parent (me->source), HTAtom_for (tmp));
                        HTAtom_for (tmp));  
   
    HTRequest_setOutputFormat (me->request,     HTRequest_setOutputFormat (me->request, HTAtom_for (tmp));
                               HTAtom_for (tmp));  
   
 #if 0 /* JK: code ready, but we're not going to use it yet */  #if 0 /* JK: code ready, but we're not going to use it yet */
    /*     /*

Removed from v.1.233  
changed lines
  Added in v.1.234


Webmaster