Diff for /Amaya/amaya/query.c between versions 1.67 and 1.68

version 1.67, 1997/06/23 15:29:49 version 1.68, 1997/06/23 16:18:12
Line 24 Line 24
 #define CATCH_SIG  #define CATCH_SIG
 #endif  #endif
   
   
 /* local structures coming from libwww and which are  /* local structures coming from libwww and which are
    not found in any .h file     not found in any .h file
  */   */
   
 struct _HTStream  struct _HTStream
   {    {
      const HTStreamClass *isa;       const HTStreamClass *isa;
Line 491  int                 status; Line 491  int                 status;
         /* Start request with new credentials */          /* Start request with new credentials */
         me->reqStatus = HT_NEW; /* reset the status */          me->reqStatus = HT_NEW; /* reset the status */
   
         if (me->output) {  #ifdef _WINDOWS                 
             fclose (me->output);      if (me->output)     {
             me->output = NULL;                   fclose (me->output)     ;
                   me->output = NULL; 
         }          }
         /* Free the associated stream */      /* Free the associated stream */
         (*request->output_stream->isa->_free) (request->output_stream);          (*request->output_stream->isa->_free) (request->output_stream);
           
   #endif
   
         if (me->method == METHOD_PUT || me->method == METHOD_POST)      /* PUT, POST etc. */          if (me->method == METHOD_PUT || me->method == METHOD_POST)      /* PUT, POST etc. */
             status = HTLoadAbsolute (me->urlName, request);             status = HTLoadAbsolute (me->urlName, request);
         else          else
             HTLoadAnchor (new_anchor, request);             HTLoadAnchor (new_anchor, request);
      }       }
    else     else
        {       {
            HTRequest_addError (request, ERR_FATAL, NO, HTERR_MAX_REDIRECT,          HTRequest_addError (request, ERR_FATAL, NO, HTERR_MAX_REDIRECT,
                                NULL, 0, "HTRedirectFilter");                              NULL, 0, "HTRedirectFilter");
            TtaSetStatus (me->docid, 1, TtaGetMessage (AMAYA, AM_REDIRECTIONS_LIMIT),          TtaSetStatus (me->docid, 1, TtaGetMessage (AMAYA, AM_REDIRECTIONS_LIMIT),
                          NULL);                        NULL);
            if (me->error_html)          if (me->error_html)
                DocNetworkStatus[me->docid] |= AMAYA_NET_ERROR; /* so we can show the error message */             DocNetworkStatus[me->docid] |= AMAYA_NET_ERROR; /* so we can show the error message */
        }       }
      
    /*     /*
    **  By returning HT_ERROR we make sure that this is the last handler to be        **  By returning HT_ERROR we make sure that this is the last handler to be
    **  called. We do this as we don't want any other filter to delete the         **  called. We do this as we don't want any other filter to delete the 
    **  request object now when we have just started a new one ourselves        **  request object now when we have just started a new one ourselves
    */      */
    return HT_ERROR;     return HT_ERROR;
 }  }
   
Line 584  int                 status; Line 587  int                 status;
                          me->reqStatus = HT_ERR;        /* we don't want to print the error */                           me->reqStatus = HT_ERR;        /* we don't want to print the error */
                  }              /* if error_stack */                   }              /* if error_stack */
           }                     /* if != HT_ABORT */            }                     /* if != HT_ABORT */
       fclose (me->output);        fclose (me->output); 
       /* JK: tracking a bug */  
       me->output = NULL;  
    }     }
    else     else
      {       {
Line 1436  boolean error_html; Line 1437  boolean error_html;
    if (TtaFileExist (outputfile))     if (TtaFileExist (outputfile))
       TtaFileUnlink (outputfile);        TtaFileUnlink (outputfile);
   
      /* try to open the outputfile */
   #  ifndef _WINDOWS
      if ((tmp_fp = fopen (outputfile, "w")) == NULL)
        {
           outputfile[0] = EOS;    /* file could not be opened */
           TtaSetStatus (docid, 1, TtaGetMessage (AMAYA, AM_CANNOT_CREATE_FILE), outputfile);
           TtaFreeMemory (ref);
           if (error_html)
             DocNetworkStatus[docid] |= AMAYA_NET_ERROR; /* so we can show the error message */
   
           return (HT_ERROR);
        }
   #  endif /* _WINDOWS */
   
    /* the terminate_handler closes the above open fp */     /* the terminate_handler closes the above open fp */
    /* Not anymore, we do that in the AHTCallback_bridge, as all     /* Not anymore, we do that in the AHTCallback_bridge, as all
       requests are now asynchronous */        requests are now asynchronous */
Line 1444  boolean error_html; Line 1459  boolean error_html;
    me = AHTReqContext_new (docid);     me = AHTReqContext_new (docid);
    if (me == NULL)     if (me == NULL)
      {       {
   #ifndef _WINDOWS
           fclose (tmp_fp);
   #endif /* !WINDOWS */
         outputfile[0] = EOS;          outputfile[0] = EOS;
         /* need an error message here */          /* need an error message here */
         TtaFreeMemory (ref);          TtaFreeMemory (ref);
Line 1483  boolean error_html; Line 1501  boolean error_html;
    me->context_icbf = context_icbf;     me->context_icbf = context_icbf;
    me->terminate_cbf = terminate_cbf;     me->terminate_cbf = terminate_cbf;
    me->context_tcbf = context_tcbf;     me->context_tcbf = context_tcbf;
      me->output = tmp_fp;
   
   #ifndef _WINDOWS
      HTRequest_setOutputStream (me->request, AHTFWriter_new (me->request, me->output, YES));
   #endif
   
    /*for the async. request modes, we need to have our     /*for the async. request modes, we need to have our
       own copy of outputfile and urlname        own copy of outputfile and urlname
Line 1580  boolean error_html; Line 1603  boolean error_html;
      {       {
         /* in case of error, free all allocated memory and exit */          /* in case of error, free all allocated memory and exit */
   
           if (me->output)
               fclose (me->output);
   
         if ((mode & AMAYA_ASYNC) || (mode & AMAYA_IASYNC))          if ((mode & AMAYA_ASYNC) || (mode & AMAYA_IASYNC))
           {            {
             if(me->outputfile)              if(me->outputfile)

Removed from v.1.67  
changed lines
  Added in v.1.68


Webmaster