version 1.98, 1997/12/09 14:50:12
|
version 1.99, 1998/01/26 17:27:01
|
Line 302 AHTReqContext *me;
|
Line 302 AHTReqContext *me;
|
TtaFreeMemory ((void *) docid_status); |
TtaFreeMemory ((void *) docid_status); |
} |
} |
} |
} |
|
/* is this necessary??? */ |
if (HTRequest_outputStream (me->request)) |
if (HTRequest_outputStream (me->request)) |
AHTFWriter_FREE (me->request->output_stream); |
AHTFWriter_FREE (me->request->output_stream); |
|
|
HTRequest_delete (me->request); |
HTRequest_delete (me->request); |
|
|
if (me->output && me->output != stdout) |
if (me->output && me->output != stdout) |
Line 328 AHTReqContext *me;
|
Line 327 AHTReqContext *me;
|
# endif /* WWW_XWINDOWS */ |
# endif /* WWW_XWINDOWS */ |
# endif /* !_WINDOWS */ |
# endif /* !_WINDOWS */ |
|
|
|
if (me->reqStatus == HT_ABORT) |
|
{ |
|
if (me->outputfile && me->outputfile[0] != EOS) |
|
{ |
|
TtaFileUnlink (me->outputfile); |
|
me->outputfile[0] = EOS; |
|
} |
|
} |
|
|
if ((me->mode & AMAYA_ASYNC) || (me->mode & AMAYA_IASYNC)) |
if ((me->mode & AMAYA_ASYNC) || (me->mode & AMAYA_IASYNC)) |
/* for the ASYNC mode, free the memory we allocated in GetObjectWWW |
/* for the ASYNC mode, free the memory we allocated in GetObjectWWW |
or in PutObjectWWW */ |
or in PutObjectWWW */ |
Line 336 AHTReqContext *me;
|
Line 344 AHTReqContext *me;
|
TtaFreeMemory (me->urlName); |
TtaFreeMemory (me->urlName); |
if (me->outputfile) |
if (me->outputfile) |
TtaFreeMemory (me->outputfile); |
TtaFreeMemory (me->outputfile); |
|
if (me->content_type) |
|
TtaFreeMemory (me->content_type); |
} |
} |
|
|
|
if (me->mode & AMAYA_FORM_POST) |
|
TtaFreeMemory (me->mem_ptr); |
|
|
TtaFreeMemory ((void *) me); |
TtaFreeMemory ((void *) me); |
|
|
Amaya->open_requests--; |
Amaya->open_requests--; |
Line 785 int status;
|
Line 798 int status;
|
} |
} |
|
|
/* 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) || |
(me->method == METHOD_PUT))) |
(me->method == METHOD_PUT))) |
{ |
{ |
Line 793 int status;
|
Line 805 int status;
|
|
|
} |
} |
|
|
#ifdef _WINDOWS |
|
/* Try to add this to AHTEventrg.c */ |
|
ProcessTerminateRequest (me); |
ProcessTerminateRequest (me); |
/* kill the windows request here, of course */ |
|
#endif /* WINDOWS */ |
|
|
|
return HT_OK; |
return HT_OK; |
} |
} |
Line 1394 void QueryClose ()
|
Line 1402 void QueryClose ()
|
AHTProfile_delete (); |
AHTProfile_delete (); |
} |
} |
|
|
|
|
|
/*---------------------------------------------------------------------- |
|
InvokeGetObjectWWW_callback |
|
A simple function to invoke a callback function whenever there's an error |
|
in GetObjectWWW |
|
---------------------------------------------------------------------*/ |
|
|
|
#ifdef _STDC |
|
void InvokeGetObjectWWW_callback (int docid, char *urlName, char *outputfile, TTcbf *terminate_cbf, void *context_cbf) |
|
#else |
|
void InvokeGetObjectWWW_callback (docid, urlName, outputfile, terminate_cbf, context_tcbf) |
|
int docid; |
|
char *urlName; |
|
char *outputfile; |
|
TTcbf *terminate_cbf; |
|
void *context_tcbf; |
|
#endif /* _STDC */ |
|
{ |
|
if (!terminate_cbf) |
|
return; |
|
|
|
(*terminate_cbf) (docid, -1, urlName, outputfile, |
|
NULL, context_tcbf); |
|
} |
|
|
|
|
|
|
/*---------------------------------------------------------------------- |
/*---------------------------------------------------------------------- |
GetObjectWWW |
GetObjectWWW |
this function requests a resource designated by a URLname into a |
this function requests a resource designated by a URLname into a |
Line 1486 char *content_type;
|
Line 1521 char *content_type;
|
if (error_html) |
if (error_html) |
/* so we can show the error message */ |
/* so we can show the error message */ |
DocNetworkStatus[docid] |= AMAYA_NET_ERROR; |
DocNetworkStatus[docid] |= AMAYA_NET_ERROR; |
|
InvokeGetObjectWWW_callback (docid, urlName, outputfile, terminate_cbf, |
|
context_tcbf); |
return HT_ERROR; |
return HT_ERROR; |
|
|
} |
} |
|
|
/* do we support this protocol? */ |
/* do we support this protocol? */ |
Line 1499 char *content_type;
|
Line 1535 char *content_type;
|
if (error_html) |
if (error_html) |
/* so we can show the error message */ |
/* so we can show the error message */ |
DocNetworkStatus[docid] |= AMAYA_NET_ERROR; |
DocNetworkStatus[docid] |= AMAYA_NET_ERROR; |
|
InvokeGetObjectWWW_callback (docid, urlName, outputfile, terminate_cbf, |
|
context_tcbf); |
return HT_ERROR; |
return HT_ERROR; |
} |
} |
|
|
Line 1518 char *content_type;
|
Line 1556 char *content_type;
|
if (error_html) |
if (error_html) |
/* so we can show the error message */ |
/* so we can show the error message */ |
DocNetworkStatus[docid] |= AMAYA_NET_ERROR; |
DocNetworkStatus[docid] |= AMAYA_NET_ERROR; |
|
InvokeGetObjectWWW_callback (docid, urlName, outputfile, terminate_cbf, |
|
context_tcbf); |
return HT_ERROR; |
return HT_ERROR; |
} |
} |
/* verify if that file name existed */ |
/* verify if that file name existed */ |
Line 1531 char *content_type;
|
Line 1570 char *content_type;
|
outputfile[0] = EOS; |
outputfile[0] = EOS; |
/* need an error message here */ |
/* need an error message here */ |
TtaFreeMemory (ref); |
TtaFreeMemory (ref); |
return (HT_ERROR); |
InvokeGetObjectWWW_callback (docid, urlName, outputfile, terminate_cbf, |
|
context_tcbf); |
|
return HT_ERROR; |
} |
} |
|
|
/* Specific initializations for POST and GET */ |
/* Specific initializations for POST and GET */ |
if (mode & AMAYA_FORM_POST) { |
if (mode & AMAYA_FORM_POST) { |
me->method = METHOD_POST; |
me->method = METHOD_POST; |
if (postString) { |
if (postString) { |
me->mem_ptr = postString; |
|
me->block_size = strlen (postString); |
me->block_size = strlen (postString); |
|
me->mem_ptr = TtaStrdup (postString); |
} else { |
} else { |
me->mem_ptr = ""; |
me->mem_ptr = ""; |
me->block_size = 0; |
me->block_size = 0; |
Line 1566 char *content_type;
|
Line 1607 char *content_type;
|
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->content_type = content_type; |
|
|
|
/* 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 1583 char *content_type;
|
Line 1623 char *content_type;
|
strncpy (tmp, urlName, MAX_LENGTH); |
strncpy (tmp, urlName, MAX_LENGTH); |
tmp[MAX_LENGTH] = EOS; |
tmp[MAX_LENGTH] = EOS; |
me->urlName = tmp; |
me->urlName = tmp; |
|
me->content_type = TtaGetMemory (MAX_LENGTH + 1); |
|
me->content_type[MAX_LENGTH] = EOS; |
# ifdef _WINDOWS |
# ifdef _WINDOWS |
HTRequest_setPreemptive (me->request, NO); |
HTRequest_setPreemptive (me->request, NO); |
} else { |
} else { |
Line 1590 char *content_type;
|
Line 1632 char *content_type;
|
me->urlName = urlName; |
me->urlName = urlName; |
HTRequest_setPreemptive (me->request, YES); |
HTRequest_setPreemptive (me->request, YES); |
} |
} |
# else /* _WINDOWS */ |
# else /* !_WINDOWS */ |
} else { |
} else { |
me->outputfile = outputfile; |
me->outputfile = outputfile; |
me->urlName = urlName; |
me->urlName = urlName; |
|
me->content_type = content_type; |
} |
} |
/*** |
/*** |
Change for taking into account the stop button: |
Change for taking into account the stop button: |
Line 1622 char *content_type;
|
Line 1665 char *content_type;
|
status = HTLoadAbsolute (urlName, me->request); |
status = HTLoadAbsolute (urlName, me->request); |
} else |
} else |
status = HTLoadAnchor ((HTAnchor *) me->anchor, me->request); |
status = HTLoadAnchor ((HTAnchor *) me->anchor, me->request); |
|
|
|
if (status == HT_ERROR && me->reqStatus == HT_NEW) |
|
{ |
|
InvokeGetObjectWWW_callback (docid, urlName, outputfile, terminate_cbf, |
|
context_tcbf); |
|
} |
|
|
#ifndef _WINDOWS |
#ifndef _WINDOWS |
if (status == HT_ERROR || |
if (status == HT_ERROR || |
Line 1638 char *content_type;
|
Line 1687 char *content_type;
|
me->output = NULL; |
me->output = NULL; |
} |
} |
|
|
if (me->reqStatus == HT_ERR) { |
if (me->reqStatus == HT_ERR) { |
status = HT_ERROR; |
status = HT_ERROR; |
/* show an error message on the status bar */ |
/* show an error message on the status bar */ |
DocNetworkStatus[me->docid] |= AMAYA_NET_ERROR; |
DocNetworkStatus[me->docid] |= AMAYA_NET_ERROR; |
Line 1655 char *content_type;
|
Line 1704 char *content_type;
|
AHTReqContext_delete (me); |
AHTReqContext_delete (me); |
} |
} |
} |
} |
|
|
#else /* !_WINDOWS */ |
#else /* !_WINDOWS */ |
|
|
if (status == HT_ERROR || |
if (status == HT_ERROR || |
Line 2015 int docid;
|
Line 2063 int docid;
|
HTRequest_kill (me->request); |
HTRequest_kill (me->request); |
|
|
#ifndef _WINDOWS |
#ifndef _WINDOWS |
if ((me->mode & AMAYA_IASYNC) || (me->mode & AMAYA_ASYNC)) |
if (!(me->mode & AMAYA_ASYNC_SAFE_STOP) |
|
&& ((me->mode & AMAYA_IASYNC) || |
|
(me->mode & AMAYA_ASYNC))) |
{ |
{ |
/* delete the Amaya request context */ |
/* delete the Amaya request context */ |
AHTReqContext_delete (me); |
AHTReqContext_delete (me); |
Line 2083 int docid;
|
Line 2133 int docid;
|
HTRequest_kill (me->request); |
HTRequest_kill (me->request); |
|
|
#ifndef _WINDOWS |
#ifndef _WINDOWS |
if ((me->mode & AMAYA_IASYNC) || (me->mode & AMAYA_ASYNC)) |
if (!(me->mode & AMAYA_ASYNC_SAFE_STOP) |
|
&& ((me->mode & AMAYA_IASYNC) |
|
|| (me->mode & AMAYA_ASYNC))) |
{ |
{ |
AHTReqContext_delete (me); |
AHTReqContext_delete (me); |
cur = Amaya->reqlist; |
cur = Amaya->reqlist; |