version 1.135, 1998/09/17 10:40:07
|
version 1.136, 1998/09/17 15:15:24
|
Line 557 HTRequest *request;
|
Line 557 HTRequest *request;
|
if (!me) |
if (!me) |
return HT_ERROR; |
return HT_ERROR; |
|
|
if (me->method == METHOD_PUT) |
|
return HT_OK; |
|
|
|
#ifdef DEBUG_LIBWWW |
#ifdef DEBUG_LIBWWW |
fprintf(stderr, "AHTOpen_file: start for object : %p\n", me); |
fprintf(stderr, "AHTOpen_file: start for object : %p\n", me); |
#endif /* DEBUG_LIBWWW */ |
#endif /* DEBUG_LIBWWW */ |
Line 573 HTRequest *request;
|
Line 570 HTRequest *request;
|
return HT_OK; |
return HT_OK; |
} |
} |
|
|
|
if (me->method == METHOD_PUT) |
|
{ |
|
me->reqStatus = HT_WAITING; |
|
return HT_OK; |
|
} |
|
|
if (HTRequest_outputStream (me->request)) |
if (HTRequest_outputStream (me->request)) |
{ |
{ |
|
|
Line 898 int status;
|
Line 901 int status;
|
(me->method == METHOD_PUT))) |
(me->method == METHOD_PUT))) |
{ |
{ |
PrintTerminateStatus (me, status); |
PrintTerminateStatus (me, status); |
|
|
} |
} |
|
|
ProcessTerminateRequest (request, response, context, status); |
ProcessTerminateRequest (request, response, context, status); |
Line 1135 static void AHTProtocolInit (voi
|
Line 1137 static void AHTProtocolInit (voi
|
HTTransport_add("buffered_tcp", HT_TP_SINGLE, HTReader_new, |
HTTransport_add("buffered_tcp", HT_TP_SINGLE, HTReader_new, |
HTBufferWriter_new); |
HTBufferWriter_new); |
HTProtocol_add ("http", "buffered_tcp", HTTP_PORT, NO, HTLoadHTTP, NULL); |
HTProtocol_add ("http", "buffered_tcp", HTTP_PORT, NO, HTLoadHTTP, NULL); |
|
#ifdef _WINDOWS |
|
HTProtocol_add ("file", "local", 0, YES, HTLoadFile, NULL); |
|
#else |
HTProtocol_add ("file", "local", 0, NO, HTLoadFile, NULL); |
HTProtocol_add ("file", "local", 0, NO, HTLoadFile, NULL); |
|
#endif _WINDOWS |
#ifdef AMAYA_WWW_CACHE |
#ifdef AMAYA_WWW_CACHE |
HTProtocol_add("cache", "local", 0, YES, HTLoadCache, NULL); |
HTProtocol_add("cache", "local", 0, YES, HTLoadCache, NULL); |
#endif /* AMAYA_WWW_CACHE */ |
#endif /* AMAYA_WWW_CACHE */ |
Line 1760 void QueryInit ()
|
Line 1766 void QueryInit ()
|
#endif |
#endif |
} |
} |
|
|
#ifndef _WINDOWS |
|
/*---------------------------------------------------------------------- |
/*---------------------------------------------------------------------- |
LoopForStop |
LoopForStop |
a copy of the Thop event loop so we can handle the stop button in Unix. |
a copy of the Thop event loop so we can handle the stop button in Unix |
|
and preemptive requests under Windows |
----------------------------------------------------------------------*/ |
----------------------------------------------------------------------*/ |
#ifdef __STDC__ |
#ifdef __STDC__ |
static int LoopForStop (AHTReqContext * me) |
static int LoopForStop (AHTReqContext * me) |
Line 1771 static int LoopForStop (AHTReqC
|
Line 1777 static int LoopForStop (AHTReqC
|
static int LoopForStop (AHTReqContext * me) |
static int LoopForStop (AHTReqContext * me) |
#endif |
#endif |
{ |
{ |
|
#ifdef _WINDOWS |
|
MSG msg; |
|
unsigned long libwww_msg; |
|
HWND old_active_window, libwww_window; |
|
int status_req = HT_OK; |
|
|
|
old_active_window = GetActiveWindow (); |
|
libwww_window = HTEventList_getWinHandle (&libwww_msg); |
|
|
|
while (GetMessage (&msg, libwww_window, 0, 0) |
|
&& me->reqStatus != HT_END && me->reqStatus != HT_ERR |
|
&& me->reqStatus != HT_ABORT && AmayaIsAlive ()) |
|
{ |
|
if (msg.message != WM_QUIT) |
|
{ |
|
TranslateMessage (&msg); |
|
DispatchMessage (&msg); |
|
} |
|
else |
|
break; |
|
|
|
} |
|
if (!AmayaIsAlive ()) |
|
/* Amaya was killed by one of the callback handlers */ |
|
exit (0); |
|
#else /* _WINDOWS */ |
extern ThotAppContext app_cont; |
extern ThotAppContext app_cont; |
XEvent ev; |
XEvent ev; |
XtInputMask status; |
XtInputMask status; |
Line 1797 static int LoopForStop (AHTReqC
|
Line 1828 static int LoopForStop (AHTReqC
|
TtaHandleOneEvent (&ev); |
TtaHandleOneEvent (&ev); |
} |
} |
} |
} |
|
#endif /* _WINDOWS */ |
switch (me->reqStatus) { |
switch (me->reqStatus) { |
case HT_ERR: |
case HT_ERR: |
case HT_ABORT: |
case HT_ABORT: |
Line 1813 static int LoopForStop (AHTReqC
|
Line 1844 static int LoopForStop (AHTReqC
|
} |
} |
return (status_req); |
return (status_req); |
} |
} |
#endif /* _WINDOWS */ |
|
|
|
/*---------------------------------------------------------------------- |
/*---------------------------------------------------------------------- |
QueryClose |
QueryClose |
Line 2166 char *content_type;
|
Line 2196 char *content_type;
|
me->outputfile = outputfile; |
me->outputfile = outputfile; |
me->urlName = urlName; |
me->urlName = urlName; |
/* force windows SYNC requests to always be non preemptive */ |
/* force windows SYNC requests to always be non preemptive */ |
/* @@@ verify this */ |
|
HTRequest_setPreemptive (me->request, YES); |
HTRequest_setPreemptive (me->request, YES); |
} |
} |
#else /* !_WINDOWS */ |
#else /* !_WINDOWS */ |
Line 2175 char *content_type;
|
Line 2204 char *content_type;
|
me->urlName = urlName; |
me->urlName = urlName; |
} |
} |
/*** |
/*** |
Change for taking into account the stop button: |
In order to take into account the stop button, |
The requests will be always asynchronous, however, if mode=AMAYA_SYNC, |
the requests will be always asynchronous, however, if mode=AMAYA_SYNC, |
we will loop until the document has been received or a stop signal |
we will loop until the document has been received or a stop signal |
generated |
generated |
****/ |
****/ |
Line 2259 char *content_type;
|
Line 2288 char *content_type;
|
InvokeGetObjectWWW_callback (docid, urlName, outputfile, |
InvokeGetObjectWWW_callback (docid, urlName, outputfile, |
terminate_cbf, context_tcbf, HT_ERROR); |
terminate_cbf, context_tcbf, HT_ERROR); |
/* terminate_handler wasn't called */ |
/* terminate_handler wasn't called */ |
if (mode & AMAYA_SYNC || mode & AMAYA_ISYNC) |
AHTReqContext_delete (me); |
AHTReqContext_delete (me); |
|
} |
} |
else |
else |
/* end treatment for SYNC requests */ |
/* end treatment for SYNC requests */ |
if ((mode & AMAYA_SYNC) || (mode & AMAYA_ISYNC)) |
if ((mode & AMAYA_SYNC) || (mode & AMAYA_ISYNC)) |
{ |
{ |
#ifndef _WINDOWS |
/* wait here untilt the asynchronous request finishes */ |
/* part of the UNIX stop button handler */ |
|
status = LoopForStop (me); |
status = LoopForStop (me); |
#endif /* _!WINDOWS */ |
/* if status returns HT_ERROR, should we invoke the callback? */ |
/* if status returns HT_ERROR, maybe we should invoke the callback |
|
too */ |
|
/* @@@ this doesn't seem correct ... me->request may not exist ... */ |
/* @@@ this doesn't seem correct ... me->request may not exist ... */ |
if (!HTRequest_kill (me->request)) |
if (!HTRequest_kill (me->request)) |
AHTReqContext_delete (me); |
AHTReqContext_delete (me); |
} |
} |
|
|
/* an interface problem!!! */ |
/* an interface problem!!! */ |
return (status == YES ? 0 : -1); |
return (status == YES ? 0 : -1); |
} |
} |
|
|
/*---------------------------------------------------------------------- |
/*---------------------------------------------------------------------- |
Line 2432 void *context_tcbf;
|
Line 2457 void *context_tcbf;
|
|
|
/* define other request characteristics */ |
/* define other request characteristics */ |
#ifdef _WINDOWS |
#ifdef _WINDOWS |
HTRequest_setPreemptive (me->request, YES); |
HTRequest_setPreemptive (me->request, NO); |
#else |
#else |
HTRequest_setPreemptive (me->request, NO); |
HTRequest_setPreemptive (me->request, NO); |
#endif /* _WINDOWS */ |
#endif /* _WINDOWS */ |
|
|
if (mode & AMAYA_NOCACHE) |
/* don't use the cache while saving a document */ |
HTRequest_setReloadMode (me->request, HT_CACHE_FLUSH); |
HTRequest_setReloadMode (me->request, HT_CACHE_FLUSH); |
|
|
/* prepare the URLname that will be displayed in teh status bar */ |
/* prepare the URLname that will be displayed in teh status bar */ |
ChopURL (me->status_urlName, me->urlName); |
ChopURL (me->status_urlName, me->urlName); |
Line 2451 void *context_tcbf;
|
Line 2476 void *context_tcbf;
|
{ |
{ |
/* part of the stop button handler */ |
/* part of the stop button handler */ |
if ((mode & AMAYA_SYNC) || (mode & AMAYA_ISYNC)) |
if ((mode & AMAYA_SYNC) || (mode & AMAYA_ISYNC)) |
{ |
status = LoopForStop (me); |
#ifndef _WINDOWS |
|
status = LoopForStop (me); |
|
#endif /* _WINDOWS */ |
|
if (!HTRequest_kill (me->request)) |
|
AHTReqContext_delete (me); |
|
} |
|
} |
} |
else |
if (!HTRequest_kill (me->request)) |
{ |
AHTReqContext_delete (me); |
if (! HTRequest_kill (me->request)) |
|
AHTReqContext_delete (me); |
|
} |
|
|
|
TtaHandlePendingEvents (); |
TtaHandlePendingEvents (); |
|
|
return (status == YES ? 0 : -1); |
return (status == YES ? 0 : -1); |