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

version 1.232, 2000/02/14 17:06:48 version 1.233, 2000/02/16 17:03:59
Line 26 Line 26
 #define AMAYA_LOST_UPDATE  #define AMAYA_LOST_UPDATE
   
 #ifdef _WINDOWS  #ifdef _WINDOWS
 #      define CACHE_DIR_NAME CUSTEXT("\\libwww-cache\\")  #      define CACHE_DIR_NAME TEXT("\\libwww-cache\\")
 #else  #else
 #      define CACHE_DIR_NAME CUSTEXT("/libwww-cache/")  #      define CACHE_DIR_NAME TEXT("/libwww-cache/")
 #endif  #endif
   
 /* libwww default parameters */  /* libwww default parameters */
Line 117  static int          fd_cachelock; /* ope Line 117  static int          fd_cachelock; /* ope
 /* prototypes */  /* prototypes */
   
 #ifdef __STDC__  #ifdef __STDC__
 static void RecCleanCache (CharUnit* dirname);  static void RecCleanCache (CHAR_T* dirname);
 #ifdef _WINDOWS  #ifdef _WINDOWS
 int WIN_Activate_Request (HTRequest* , HTAlertOpcode, int, const char*, void*, HTAlertPar*);  int WIN_Activate_Request (HTRequest* , HTAlertOpcode, int, const char*, void*, HTAlertPar*);
 #endif /* _WINDOWS */  #endif /* _WINDOWS */
Line 148  static ThotBool SafePut_query (/* char * Line 148  static ThotBool SafePut_query (/* char *
   filename and fd_cachelock will take its value.    filename and fd_cachelock will take its value.
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static int set_cachelock (CharUnit* filename)  static int set_cachelock (CHAR_T* filename)
 #else          #else        
 static int set_cachelock (filename)  static int set_cachelock (filename)
 CharUniut* filename;  CharUniut* filename;
Line 217  int *fd; Line 217  int *fd;
   returns the pid of the process who has the lock    returns the pid of the process who has the lock
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static int test_cachelock (CharUnit* filename)  static int test_cachelock (CHAR_T* filename)
 #else  #else
 static int test_cachelock (filename)  static int test_cachelock (filename)
 CharUnit*  filename;  CHAR_T*  filename;
 #endif /* __STDC__ */  #endif /* __STDC__ */
 {  {
 #ifdef _WINDOWS  #ifdef _WINDOWS
Line 332  PicType contentType; Line 332  PicType contentType;
      ** Amaya could not detect the type, so        ** Amaya could not detect the type, so 
      ** we try to use the filename's suffix to do so.       ** we try to use the filename's suffix to do so.
      */       */
      filename = AmayaParseUrl (urlName, _EMPTYSTR_, AMAYA_PARSE_PATH | AMAYA_PARSE_PUNCTUATION);       filename = AmayaParseUrl (urlName, TEXT(""), AMAYA_PARSE_PATH | AMAYA_PARSE_PUNCTUATION);
      HTBind_getFormat (WideChar2ISO (filename), &atom, &enc, &cte, &lang, &quality);       HTBind_getFormat (filename, &atom, &enc, &cte, &lang, &quality);
      TtaFreeMemory (filename);       TtaFreeMemory (filename);
      if (atom ==  WWW_UNKNOWN)       if (atom ==  WWW_UNKNOWN)
          /*           /*
Line 480  AHTReqContext      *me; Line 480  AHTReqContext      *me;
          {           {
            if (me->outputfile && me->outputfile[0] != EOS)             if (me->outputfile && me->outputfile[0] != EOS)
              {               {
                TtaFileUnlink (ISO2WideChar (me->outputfile));                 TtaFileUnlink (me->outputfile);
                me->outputfile[0] = EOS;                 me->outputfile[0] = EOS;
              }               }
          }           }
Line 639  HTRequest           *request; Line 639  HTRequest           *request;
 #ifdef DEBUG_LIBWWW  #ifdef DEBUG_LIBWWW
       fprintf(stderr, "AHTOpen_file: couldn't open output stream for url %s\n", me->urlName);        fprintf(stderr, "AHTOpen_file: couldn't open output stream for url %s\n", me->urlName);
 #endif  #endif
       TtaSetStatus (me->docid, 1,         TtaSetStatus (me->docid, 1, TtaGetMessage (AMAYA, AM_CANNOT_CREATE_FILE), me->outputfile);
                     TtaGetMessage (AMAYA, AM_CANNOT_CREATE_FILE),  
                     ISO2WideChar (me->outputfile));  
       me->reqStatus = HT_ERR;        me->reqStatus = HT_ERR;
       return (HT_ERROR);        return (HT_ERROR);
     }      }
Line 733  int                 status; Line 731  int                 status;
        */         */
   
        /* only do a redirect using a network protocol understood by Amaya */         /* only do a redirect using a network protocol understood by Amaya */
         if (IsValidProtocol (ISO2WideChar (new_anchor->parent->address)))          if (IsValidProtocol (new_anchor->parent->address))
           {            {
             /* if it's a valid URL, we try to normalize it */              /* if it's a valid URL, we try to normalize it */
             /* We use the pre-redirection anchor as a base name */              /* We use the pre-redirection anchor as a base name */
             /* @@ how to obtain this address here? */              /* @@ how to obtain this address here? */
             dst = ISO2WideChar (new_anchor->parent->address);              dst = new_anchor->parent->address;
             escape_src = EscapeURL (ISO2WideChar (me->urlName));              escape_src = EscapeURL (me->urlName);
             if (escape_src)              if (escape_src)
               {                {
                 ref = AmayaParseUrl (dst, escape_src, AMAYA_PARSE_ALL);                  ref = AmayaParseUrl (dst, escape_src, AMAYA_PARSE_ALL);
Line 795  int                 status; Line 793  int                 status;
           }            }
   
         /* tell the user what we're doing */          /* tell the user what we're doing */
         TtaSetStatus (me->docid, 1, TtaGetMessage (AMAYA, AM_RED_FETCHING),          TtaSetStatus (me->docid, 1, TtaGetMessage (AMAYA, AM_RED_FETCHING), me->status_urlName);
                       ISO2WideChar (me->status_urlName));  
   
         /*          /*
         ** launch the request          ** launch the request
Line 1177  int                 status; Line 1174  int                 status;
                         
            /* Content-Type can be specified by an httpd  server's admin.             /* Content-Type can be specified by an httpd  server's admin.
               To be on the safe side, we normalize its case */                To be on the safe side, we normalize its case */
            ConvertToLowerCase (ISO2WideChar (me->content_type));             ConvertToLowerCase (me->content_type);
                         
 #ifdef DEBUG_LIBWWW  #ifdef DEBUG_LIBWWW
            fprintf (stderr, "content type is: %s\n", me->content_type);             fprintf (stderr, "content type is: %s\n", me->content_type);
Line 1187  int                 status; Line 1184  int                 status;
   
    /* to avoid a hangup while downloading css files */     /* to avoid a hangup while downloading css files */
    if (AmayaAlive_flag && (me->mode & AMAYA_LOAD_CSS))     if (AmayaAlive_flag && (me->mode & AMAYA_LOAD_CSS))
      TtaSetStatus (me->docid, 1,        TtaSetStatus (me->docid, 1, TtaGetMessage (AMAYA, AM_ELEMENT_LOADED), me->status_urlName);
                    TtaGetMessage (AMAYA, AM_ELEMENT_LOADED),  
                    ISO2WideChar (me->status_urlName));  
         
   /* don't remove or Xt will hang up during the PUT */    /* don't remove or Xt will hang up during the PUT */
    if (AmayaIsAlive ()  && ((me->method == METHOD_POST) ||     if (AmayaIsAlive ()  && ((me->method == METHOD_POST) ||
Line 1241  int                 status; Line 1236  int                 status;
            if (docid_status != NULL && docid_status->counter > 1)             if (docid_status != NULL && docid_status->counter > 1)
              TtaSetStatus (me->docid, 1,                TtaSetStatus (me->docid, 1, 
                            TtaGetMessage (AMAYA, AM_ELEMENT_LOADED),                             TtaGetMessage (AMAYA, AM_ELEMENT_LOADED),
                            ISO2WideChar (me->status_urlName));                             me->status_urlName);
                break;                 break;
                                 
      case HT_NO_DATA:       case HT_NO_DATA:
Line 1250  int                 status; Line 1245  int                 status;
                   me->status_urlName);                    me->status_urlName);
        TtaSetStatus (me->docid, 1,          TtaSetStatus (me->docid, 1, 
                      TtaGetMessage (AMAYA, AM_LOADED_NO_DATA),                       TtaGetMessage (AMAYA, AM_LOADED_NO_DATA),
                      ISO2WideChar (me->status_urlName));                       me->status_urlName);
        break;         break;
                 
      case HT_INTERRUPTED:       case HT_INTERRUPTED:
Line 1268  int                 status; Line 1263  int                 status;
                   HTResponse_retryTime (response));                    HTResponse_retryTime (response));
        TtaSetStatus (me->docid, 1,          TtaSetStatus (me->docid, 1, 
                      TtaGetMessage (AMAYA, AM_NOT_AVAILABLE_RETRY),                       TtaGetMessage (AMAYA, AM_NOT_AVAILABLE_RETRY),
                      ISO2WideChar (me->status_urlName));                       me->status_urlName);
        break;         break;
   
      case HT_ERROR:       case HT_ERROR:
Line 1283  int                 status; Line 1278  int                 status;
                   me->status_urlName ? me->status_urlName :"<UNKNOWN>");                    me->status_urlName ? me->status_urlName :"<UNKNOWN>");
        TtaSetStatus (me->docid, 1,         TtaSetStatus (me->docid, 1,
                      TtaGetMessage (AMAYA, AM_CANNOT_LOAD),                       TtaGetMessage (AMAYA, AM_CANNOT_LOAD),
                      me->status_urlName ? ISO2WideChar (me->status_urlName) : TEXT("<UNKNOWN>"));                       me->status_urlName ? me->status_urlName : TEXT("<UNKNOWN>"));
        break;         break;
      default:       default:
        if (PROT_TRACE)         if (PROT_TRACE)
Line 1349  static void         AHTAcceptLanguagesIn Line 1344  static void         AHTAcceptLanguagesIn
 HTList             *c;  HTList             *c;
 #endif /* __STDC__ */  #endif /* __STDC__ */
 {  {
   CharUnit*         ptr;    CHAR_T*         ptr;
   CharUnit*         lang_list;    CHAR_T*         lang_list;
   char              s[3];    char              s[3];
   int               count, lg;    int               count, lg;
   double            quality;    double            quality;
Line 1368  HTList             *c; Line 1363  HTList             *c;
       /* how many languages do we have? */        /* how many languages do we have? */
       ptr = lang_list;        ptr = lang_list;
       count = 0;        count = 0;
       while (*ptr != CUS_EOS) {        while (*ptr != WC_EOS) {
             while (*ptr != CUS_EOS && (*ptr < CUSTEXT('A') || (*ptr > CUSTEXT('Z') && *ptr < CUSTEXT('a')) || *ptr > CUSTEXT('z')))              while (*ptr != WC_EOS && (*ptr < TEXT('A') || (*ptr > TEXT('Z') && *ptr < TEXT('a')) || *ptr > TEXT('z')))
                   /* skip the whole separator */                    /* skip the whole separator */
                   ptr++;                    ptr++;
             lg = 0;              lg = 0;
             while ((*ptr >= CUSTEXT('A') && *ptr <= CUSTEXT('Z')) || (*ptr >= CUSTEXT('a') && *ptr <= CUSTEXT('z')) || *ptr == CUSTEXT('-')) {              while ((*ptr >= TEXT('A') && *ptr <= TEXT('Z')) || (*ptr >= TEXT('a') && *ptr <= TEXT('z')) || *ptr == TEXT('-')) {
                   /* it's a new language */                    /* it's a new language */
                   ptr++;                    ptr++;
                   lg++;                    lg++;
                         }                          }
             if (lg >= 2)              if (lg >= 2)
                count++;                 count++;
             if (*ptr != CUS_EOS)              if (*ptr != WC_EOS)
                ptr++;                 ptr++;
           }            }
   
Line 1396  HTList             *c; Line 1391  HTList             *c;
       ptr--;        ptr--;
       still = TRUE;        still = TRUE;
       while (count) {        while (count) {
             while (still && (*ptr < CUSTEXT('A') || (*ptr > CUSTEXT('Z') && *ptr < CUSTEXT('a')) || *ptr > CUSTEXT('z')))              while (still && (*ptr < TEXT('A') || (*ptr > TEXT('Z') && *ptr < TEXT('a')) || *ptr > TEXT('z')))
                   /* skip the whole separator */                    /* skip the whole separator */
                   if (ptr > lang_list)                    if (ptr > lang_list)
                      ptr--;                       ptr--;
                   else                    else
                       still = FALSE;                        still = FALSE;
             lg = 0;              lg = 0;
             while (still && ((*ptr >= CUSTEXT('A') && *ptr <= CUSTEXT('Z')) || (*ptr >= CUSTEXT('a') && *ptr <= CUSTEXT('z')) || *ptr == CUSTEXT('-'))) {              while (still && ((*ptr >= TEXT('A') && *ptr <= TEXT('Z')) || (*ptr >= TEXT('a') && *ptr <= TEXT('z')) || *ptr == TEXT('-'))) {
                   /* it's a new language */                    /* it's a new language */
                   if (ptr > lang_list)                    if (ptr > lang_list)
                      ptr--;                       ptr--;
Line 1489  HTList             *c; Line 1484  HTList             *c;
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 static void         AHTProtocolInit (void)  static void         AHTProtocolInit (void)
 {  {
   CharUnit* strptr;    CHAR_T* strptr;
   
   /*     /* 
      NB. Preemptive == YES means Blocking requests       NB. Preemptive == YES means Blocking requests
Line 1612  View view; Line 1607  View view;
   /* don't do anything if we don't have a valid cache dir */    /* don't do anything if we don't have a valid cache dir */
   if (!tmp || *tmp == EOS)    if (!tmp || *tmp == EOS)
           return;            return;
   cache_dir = TtaStrdup (ISO2WideChar (tmp));    cache_dir = TtaStrdup (tmp);
   HT_FREE (tmp);    HT_FREE (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 :) */
   tmp = ISO2WideChar (HTWWWToLocal (WideChar2ISO (cache_dir), "file:", NULL));    tmp = HTWWWToLocal (cache_dir, "file:", NULL);
   real_dir = TtaAllocString (ustrlen (tmp) + 20);    real_dir = TtaAllocString (ustrlen (tmp) + 20);
   ustrcpy (real_dir, tmp);    ustrcpy (real_dir, tmp);
   HT_FREE (tmp);    HT_FREE (tmp);
Line 1645  View view; Line 1640  View view;
   
   HTCacheMode_setExpires (cache_expire);    HTCacheMode_setExpires (cache_expire);
   HTCacheMode_setDisconnected (cache_disconnect);    HTCacheMode_setDisconnected (cache_disconnect);
   HTCacheInit (WideChar2ISO (cache_dir), cache_size);    HTCacheInit (cache_dir, cache_size);
   /* set a new concurrent cache lock */    /* set a new concurrent cache lock */
   ustrcat (real_dir, TEXT(".lock"));    ustrcat (real_dir, TEXT(".lock"));
   if (set_cachelock (real_dir) == -1)    if (set_cachelock (real_dir) == -1)
Line 1672  View view; Line 1667  View view;
   Clears an existing cache directory    Clears an existing cache directory
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 #ifdef __STDC__  #ifdef __STDC__
 static void RecCleanCache (CharUnit* dirname)  static void RecCleanCache (CHAR_T* dirname)
 #else  #else
 static void RecCleanCache (dirname)  static void RecCleanCache (dirname)
 CharUnit*   dirname;  CHAR_T*   dirname;
 #endif /* __STDC__ */  #endif /* __STDC__ */
   
 #ifdef _WINDOWS  #ifdef _WINDOWS
Line 1683  CharUnit*   dirname; Line 1678  CharUnit*   dirname;
   HANDLE          hFindFile;    HANDLE          hFindFile;
   ThotBool        status;    ThotBool        status;
   WIN32_FIND_DATA ffd;    WIN32_FIND_DATA ffd;
   CharUnit        t_dir [MAX_LENGTH];    CHAR_T        t_dir [MAX_LENGTH];
   CharUnit*       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 ((StringLength (dirname) + 10) > MAX_LENGTH)
Line 1709  CharUnit*   dirname; Line 1704  CharUnit*   dirname;
       if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)        if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
         {          {
           /* it's a directory, erase it recursively */            /* it's a directory, erase it recursively */
           if (StringCompare (ffd.cFileName, CUSTEXT("..")) && StringCompare (ffd.cFileName, TEXT(".")))            if (ustrcmp (ffd.cFileName, TEXT("..")) && ustrcmp (ffd.cFileName, TEXT(".")))
             {              {
               StringCopy (ptr, ffd.cFileName);                ustrcpy (ptr, ffd.cFileName);
               StringConcat (ptr, CUS_DIR_STR);                ustrcat (ptr, WC_DIR_STR);
               RecCleanCache (t_dir);                RecCleanCache (t_dir);
               urmdir (t_dir);                urmdir (t_dir);
             }              }
Line 1720  CharUnit*   dirname; Line 1715  CharUnit*   dirname;
         else          else
           {            {
             /* it's a file, erase it */              /* it's a file, erase it */
             StringCopy (ptr, ffd.cFileName);              ustrcpy (ptr, ffd.cFileName);
             TtaFileUnlink (t_dir);              TtaFileUnlink (t_dir);
           }            }
       status = FindNextFile (hFindFile, &ffd);        status = FindNextFile (hFindFile, &ffd);
Line 1799  static void Cacheinit () Line 1794  static void Cacheinit ()
    HTCacheMode_setEnabled (NO);     HTCacheMode_setEnabled (NO);
   
 #else /* AMAYA_WWW_CACHE */  #else /* AMAYA_WWW_CACHE */
   CharUnit* strptr;    CHAR_T* strptr;
   CharUnit* real_dir = NULL;    CHAR_T* real_dir = NULL;
   CharUnit* cache_lockfile;    CHAR_T* cache_lockfile;
   char      www_realDir[MAX_LENGTH];    char      www_realDir[MAX_LENGTH];
   char*     cache_dir = NULL;    char*     cache_dir = NULL;
   int       cache_size;    int       cache_size;
Line 1838  int i; Line 1833  int i;
   else    else
     {      {
       real_dir = TtaAllocCUString (StringLength (TempFileDirectory) + StringLength (CACHE_DIR_NAME) + 20);        real_dir = TtaAllocCUString (StringLength (TempFileDirectory) + StringLength (CACHE_DIR_NAME) + 20);
       cus_sprintf (real_dir, CUSTEXT("%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
Line 1863  int i; Line 1858  int i;
   /* get the cache size (or use a default one) */    /* get the cache size (or use a default one) */
   strptr = TtaGetEnvString ("CACHE_SIZE");    strptr = TtaGetEnvString ("CACHE_SIZE");
   if (strptr && *strptr)     if (strptr && *strptr) 
     cache_size = custoi (strptr);      cache_size = wctoi (strptr);
   else    else
     cache_size = DEFAULT_CACHE_SIZE;      cache_size = DEFAULT_CACHE_SIZE;
   
Line 1965  static void ProxyInit (void) Line 1960  static void ProxyInit (void)
 static void ProxyInit ()  static void ProxyInit ()
 #endif /* __STDC__ */  #endif /* __STDC__ */
 {  {
   CharUnit* strptr;    CHAR_T*   strptr;
   char*     name;    char*     name;
   ThotBool  proxy_is_onlyproxy;    ThotBool  proxy_is_onlyproxy;
   char*     tmp = NULL;    char*     tmp = NULL;
Line 2036  static void SafePut_init (void) Line 2031  static void SafePut_init (void)
 static void SafePut_init ()  static void SafePut_init ()
 #endif /* __STDC__ */  #endif /* __STDC__ */
 {  {
   CharUnit* strptr;    CHAR_T* strptr;
   CharUnit* str = NULL;    CHAR_T* str = NULL;
   char*     ptr, *strptrA, *ptr2;    char*     ptr, *strptrA, *ptr2;
   char*     domain;    char*     domain;
   
Line 2127  char* AppName; Line 2122  char* AppName;
 char* AppVersion;  char* AppVersion;
 #endif /* __STDC__ */  #endif /* __STDC__ */
 {  {
    CharUnit* strptr;     CHAR_T* strptr;
   
    /* 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 ())
Line 2291  void                QueryInit () Line 2286  void                QueryInit ()
 void                QueryInit ()  void                QueryInit ()
 #endif  #endif
 {  {
   CharUnit* strptr;    CHAR_T* strptr;
   int tmp_i;    int tmp_i;
   long tmp_l;    long tmp_l;
   
Line 2338  void                QueryInit () Line 2333  void                QueryInit ()
    /* Maximum number of simultaneous open sockets */     /* Maximum number of simultaneous open sockets */
    strptr = TtaGetEnvString ("MAX_SOCKET");     strptr = TtaGetEnvString ("MAX_SOCKET");
    if (strptr && *strptr)      if (strptr && *strptr) 
      tmp_i = custoi (strptr);       tmp_i = wctoi (strptr);
    else     else
      tmp_i = DEFAULT_MAX_SOCKET;       tmp_i = DEFAULT_MAX_SOCKET;
    HTNet_setMaxSocket (tmp_i);     HTNet_setMaxSocket (tmp_i);
Line 2347  void                QueryInit () Line 2342  void                QueryInit ()
    /* dns timeout */     /* dns timeout */
    strptr = TtaGetEnvString ("DNS_TIMEOUT");     strptr = TtaGetEnvString ("DNS_TIMEOUT");
    if (strptr && *strptr)      if (strptr && *strptr) 
      tmp_i = custoi (strptr);       tmp_i = wctoi (strptr);
    else     else
      tmp_i = DEFAULT_DNS_TIMEOUT;       tmp_i = DEFAULT_DNS_TIMEOUT;
    HTDNS_setTimeout (tmp_i);     HTDNS_setTimeout (tmp_i);
Line 2363  void                QueryInit () Line 2358  void                QueryInit ()
    /* default timeout in ms */     /* default timeout in ms */
    strptr = TtaGetEnvString ("NET_EVENT_TIMEOUT");     strptr = TtaGetEnvString ("NET_EVENT_TIMEOUT");
    if (strptr && *strptr)      if (strptr && *strptr) 
      tmp_i = custoi (strptr);       tmp_i = wctoi (strptr);
    else     else
      tmp_i = DEFAULT_NET_EVENT_TIMEOUT;       tmp_i = DEFAULT_NET_EVENT_TIMEOUT;
    HTHost_setEventTimeout (tmp_i);     HTHost_setEventTimeout (tmp_i);
Line 2544  STRING string; Line 2539  STRING string;
      change       change
      */       */
   
   tmp_string_ptr = tmp_string = WideChar2ISO (TtaStrdup (string));    tmp_string_ptr = tmp_string = TtaStrdup (string);
   formdata = HTAssocList_new();    formdata = HTAssocList_new();
       
   while (*tmp_string)    while (*tmp_string)
Line 2786  STRING        content_type; Line 2781  STRING        content_type;
    esc_url = EscapeURL (urlName);     esc_url = EscapeURL (urlName);
    if (esc_url)      if (esc_url) 
      {       {
        ref = AmayaParseUrl (esc_url, _EMPTYSTR_, AMAYA_PARSE_ALL);         ref = AmayaParseUrl (esc_url, TEXT(""), AMAYA_PARSE_ALL);
        TtaFreeMemory (esc_url);         TtaFreeMemory (esc_url);
      }       }
    else     else
Line 2866  STRING        content_type; Line 2861  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, WideChar2ISO (outputfile));         strcpy (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, WideChar2ISO (urlName));         strcpy (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 2881  STRING        content_type; Line 2876  STRING        content_type;
    else      else 
 #ifdef _WINDOWS  #ifdef _WINDOWS
      {       {
        me->outputfile = WideChar2ISO (outputfile);         me->outputfile = outputfile;
        me->urlName = WideChar2ISO (urlName);         me->urlName = urlName;
        /* force windows SYNC requests to always be non preemptive */         /* force windows SYNC requests to always be non preemptive */
        HTRequest_setPreemptive (me->request, YES);         HTRequest_setPreemptive (me->request, YES);
      }       }
Line 2912  STRING        content_type; Line 2907  STRING        content_type;
    ChopURL (me->status_urlName, me->urlName);     ChopURL (me->status_urlName, me->urlName);
    TtaSetStatus (me->docid, 1,      TtaSetStatus (me->docid, 1, 
                  TtaGetMessage (AMAYA, AM_FETCHING),                   TtaGetMessage (AMAYA, AM_FETCHING),
                  ISO2WideChar (me->status_urlName));                   me->status_urlName);
   
    me->anchor = (HTParentAnchor *) HTAnchor_findAddress (WideChar2ISO (ref));     me->anchor = (HTParentAnchor *) HTAnchor_findAddress (ref);
    TtaFreeMemory (ref);     TtaFreeMemory (ref);
         
    TtaGetEnvBoolean ("CACHE_DISCONNECTED_MODE", &bool_tmp);     TtaGetEnvBoolean ("CACHE_DISCONNECTED_MODE", &bool_tmp);
Line 2953  STRING        content_type; Line 2948  STRING        content_type;
        /* @@@ a very ugly patch :)))         /* @@@ a very ugly patch :)))
         I'm copying here some of the functionality I use in the PUT          I'm copying here some of the functionality I use in the PUT
        I need to put the common parts in another module */         I need to put the common parts in another module */
        QGetFileSize (WideChar2ISO (formdata), &filesize);         QGetFileSize (formdata, &filesize);
        filesize = filesize + strlen ("w3c_annotate=");         filesize = filesize + strlen ("w3c_annotate=");
        me->block_size = filesize;         me->block_size = filesize;
   
        fileURL = HTParse (WideChar2ISO (formdata), "file:/", PARSE_ALL);         fileURL = HTParse (formdata, "file:/", PARSE_ALL);
        me->source = HTAnchor_findAddress (fileURL);         me->source = HTAnchor_findAddress (fileURL);
        HT_FREE (fileURL);         HT_FREE (fileURL);
   
Line 2977  STRING        content_type; Line 2972  STRING        content_type;
   
          me->document = TtaGetMemory (me->block_size            me->document = TtaGetMemory (me->block_size 
                                       + strlen ("w3c_annotate=") + 1);                                        + strlen ("w3c_annotate=") + 1);
          fp = fopen (WideChar2ISO (formdata), "r");           fp = fopen (formdata, "r");
          i = 0;           i = 0;
          strcpy (me->document, "w3c_annotate=");           strcpy (me->document, "w3c_annotate=");
          c = getc (fp);           c = getc (fp);
Line 3154  void               *context_tcbf; Line 3149  void               *context_tcbf;
    */     */
    if (DocumentMeta[docid]->put_default_name)     if (DocumentMeta[docid]->put_default_name)
      {       {
        CharUnit *ptr1, *ptr2;         CHAR_T *ptr1, *ptr2;
        ptr1 = TtaGetEnvString ("DEFAULTNAME");         ptr1 = TtaGetEnvString ("DEFAULTNAME");
        if (ptr1 && *ptr1)          if (ptr1 && *ptr1) 
          {           {
Line 3175  void               *context_tcbf; Line 3170  void               *context_tcbf;
    me->terminate_cbf = terminate_cbf;     me->terminate_cbf = terminate_cbf;
    me->context_tcbf = context_tcbf;     me->context_tcbf = context_tcbf;
    esc_url = EscapeURL (urlName);     esc_url = EscapeURL (urlName);
    me->urlName = TtaStrdup (WideChar2ISO (esc_url));     me->urlName = TtaStrdup (esc_url);
    TtaFreeMemory (esc_url);     TtaFreeMemory (esc_url);
    me->block_size =  file_size;     me->block_size =  file_size;
    /* select the parameters that distinguish a PUT from a GET/POST */     /* select the parameters that distinguish a PUT from a GET/POST */
Line 3189  void               *context_tcbf; Line 3184  void               *context_tcbf;
       so we sidestep it */        so we sidestep it */
    fileURL = NULL;     fileURL = NULL;
    StrAllocCopy (fileURL, "file:");     StrAllocCopy (fileURL, "file:");
    StrAllocCat (fileURL, WideChar2ISO (fileName));     StrAllocCat (fileURL, fileName);
 #else  #else
    fileURL = HTParse (fileName, "file:/", PARSE_ALL);     fileURL = HTParse (fileName, "file:/", PARSE_ALL);
 #endif /* _WINDOWS */  #endif /* _WINDOWS */
Line 3206  void               *context_tcbf; Line 3201  void               *context_tcbf;
    /* we try to use any content-type previosuly associated     /* we try to use any content-type previosuly associated
       with the parent. If it doesn't exist, we try to guess it        with the parent. If it doesn't exist, we try to guess it
       from the URL */        from the URL */
    tmp = ISO2WideChar (HTAtom_name (HTAnchor_format (dest_anc_parent)));     tmp = HTAtom_name (HTAnchor_format (dest_anc_parent));
    if (!tmp || !ustrcmp (tmp, TEXT("www/unknown")))     if (!tmp || !ustrcmp (tmp, TEXT("www/unknown")))
      {       {
        HTAnchor_setFormat (dest_anc_parent, AHTGuessAtom_for (ISO2WideChar (me->urlName), contentType));         HTAnchor_setFormat (dest_anc_parent, AHTGuessAtom_for (me->urlName, contentType));
        tmp = ISO2WideChar (HTAtom_name (HTAnchor_format (dest_anc_parent)));         tmp = HTAtom_name (HTAnchor_format (dest_anc_parent));
      }       }
    /* .. 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 (WideChar2ISO (tmp)));                         HTAtom_for (tmp));
   
    HTRequest_setOutputFormat (me->request,     HTRequest_setOutputFormat (me->request,
                               HTAtom_for (WideChar2ISO (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 */
    /*     /*
Line 3228  void               *context_tcbf; Line 3223  void               *context_tcbf;
    /* we try to use any charset previosuly associated     /* we try to use any charset previosuly associated
       with the parent. If it doesn't exist, we try to guess it        with the parent. If it doesn't exist, we try to guess it
       from the metadata */        from the metadata */
    tmp = ISO2WideChar (HTAtom_name (HTAnchor_charset (dest_anc_parent)));     tmp = HTAtom_name (HTAnchor_charset (dest_anc_parent));
    if (!tmp)     if (!tmp)
      {       {
        HTAnchor_setCharset (dest_anc_parent, HTAtom_for ("iso-8859-3"));         HTAnchor_setCharset (dest_anc_parent, HTAtom_for ("iso-8859-3"));
        tmp = ISO2WideChar (HTAtom_name (HTAnchor_charset (dest_anc_parent)));         tmp = HTAtom_name (HTAnchor_charset (dest_anc_parent));
      }       }
    /* .. and we give the same charset to the source anchor */     /* .. and we give the same charset to the source anchor */
    /* we go thru setCharSet, rather than change the parent's     /* we go thru setCharSet, 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_setCharset (HTAnchor_parent (me->source),     HTAnchor_setCharset (HTAnchor_parent (me->source),
                         HTAtom_for (WideChar2ISO (tmp)));                          HTAtom_for (tmp));
 #endif /* CHARSET */  #endif /* CHARSET */
   
    /*     /*
Line 3298  void               *context_tcbf; Line 3293  void               *context_tcbf;
   
    /* prepare the URLname that will be displayed in the status bar */     /* prepare the URLname that will be displayed in the status bar */
    ChopURL (me->status_urlName, me->urlName);     ChopURL (me->status_urlName, me->urlName);
    TtaSetStatus (me->docid, 1, TtaGetMessage (AMAYA, AM_REMOTE_SAVING), ISO2WideChar (me->status_urlName));     TtaSetStatus (me->docid, 1, TtaGetMessage (AMAYA, AM_REMOTE_SAVING), me->status_urlName);
   
    /* make the request */     /* make the request */
    if (lost_update_check && (!UsePreconditions || !etag))     if (lost_update_check && (!UsePreconditions || !etag))
Line 3378  int                 docid; Line 3373  int                 docid;
           processing easier */            processing easier */
        UserAborted_flag = TRUE;         UserAborted_flag = TRUE;
        /* abort all outstanding libwww UI dialogues */         /* abort all outstanding libwww UI dialogues */
        CallbackDialogue (BaseDialog + FormAnswer,  STRING_DATA, (CharUnit*) 0);         CallbackDialogue (BaseDialog + FormAnswer,  STRING_DATA, (CHAR_T*) 0);
        CallbackDialogue (BaseDialog + ConfirmForm, INTEGER_DATA, (CharUnit*) 0);         CallbackDialogue (BaseDialog + ConfirmForm, INTEGER_DATA, (CHAR_T*) 0);
        /* expire all outstanding timers */         /* expire all outstanding timers */
        HTTimer_expireAll ();         HTTimer_expireAll ();
        /* HTNet_killAll (); */         /* HTNet_killAll (); */
Line 3414  int                 docid; Line 3409  int                 docid;
                    else                     else
                      {                       {
                        if (me->terminate_cbf)                         if (me->terminate_cbf)
                          (*me->terminate_cbf) (me->docid, -1, ISO2WideChar (me->urlName),                           (*me->terminate_cbf) (me->docid, -1, me->urlName,
                                                ISO2WideChar (me->outputfile),                                                 me->outputfile,
                                                ISO2WideChar (me->content_type),                                                  me->content_type, 
                                                me->context_tcbf);                                                 me->context_tcbf);
   
                        if (async_flag)                          if (async_flag) 

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


Webmaster