version 1.4, 1996/12/02 15:02:59
|
version 1.5, 1996/12/06 17:52:37
|
Line 1
|
Line 1
|
/* -- Copyright (c) 1994-1995 Inria/CNRS All rights reserved. -- */ |
/*** |
|
*** Copyright (c) 1996 INRIA, All rights reserved |
|
***/ |
|
|
/* Amaya includes */ |
/* Amaya includes */ |
|
|
Line 104 static void AHTAlertInit ();
|
Line 106 static void AHTAlertInit ();
|
|
|
#ifdef CATCH_SIG |
#ifdef CATCH_SIG |
|
|
/*+------------------------------------------------------------------+ */ |
/*---------------------------------------------------------------------- |
/*| SetSignal: This function sets up signal handlers. This might not | */ |
SetSignal: This function sets up signal handlers. This might not |
/*| be necessary to call if the application has its own handlers. | */ |
be necessary to call if the application has its own handlers. |
/*+------------------------------------------------------------------+ */ |
----------------------------------------------------------------------*/ |
#ifdef __STDC__ |
#ifdef __STDC__ |
static void SetSignal (void) |
static void SetSignal (void) |
#else |
#else |
Line 128 static void SetSignal ()
|
Line 130 static void SetSignal ()
|
} |
} |
#endif /* CATCH_SIG */ |
#endif /* CATCH_SIG */ |
|
|
/* ---------------------------------------------------------------------- */ |
/*---------------------------------------------------------------------- |
/* Create a new Amaya Context Object |
Create a new Amaya Context Object |
** ---------------------------- |
|
*/ |
----------------------------------------------------------------------*/ |
/* ---------------------------------------------------------------------- */ |
|
#ifdef __STDC__ |
#ifdef __STDC__ |
static AHTReqContext *AHTReqContext_new (int docid) |
static AHTReqContext *AHTReqContext_new (int docid) |
#else |
#else |
Line 200 int docid;
|
Line 201 int docid;
|
return me; |
return me; |
} |
} |
|
|
/*+--------------------------------------------------------------------+ */ |
/*---------------------------------------------------------------------- |
/*| Delete an Amaya Context Object | */ |
Delete an Amaya Context Object |
/*+--------------------------------------------------------------------+ */ |
----------------------------------------------------------------------*/ |
|
|
#ifdef __STDC__ |
#ifdef __STDC__ |
BOOL AHTReqContext_delete (AHTReqContext * me) |
BOOL AHTReqContext_delete (AHTReqContext * me) |
Line 285 HTStream *target;
|
Line 286 HTStream *target;
|
} |
} |
|
|
|
|
/*+--------------------------------------------------------------------+ */ |
/*---------------------------------------------------------------------- |
/*| Gets the status associated to a docid | */ |
Gets the status associated to a docid |
/*+--------------------------------------------------------------------+ */ |
----------------------------------------------------------------------*/ |
#ifdef __STDC__ |
#ifdef __STDC__ |
AHTDocId_Status *GetDocIdStatus (int docid, HTList * documents) |
AHTDocId_Status *GetDocIdStatus (int docid, HTList * documents) |
#else |
#else |
Line 312 HTList *documents;
|
Line 313 HTList *documents;
|
|
|
} |
} |
|
|
/*+--------------------------------------------------------------------+ */ |
/*---------------------------------------------------------------------- |
/*| This function deletes the whole list of active threads. | */ |
This function deletes the whole list of active threads. |
/*+--------------------------------------------------------------------+ */ |
----------------------------------------------------------------------*/ |
#ifdef __STDC__ |
#ifdef __STDC__ |
static void Thread_deleteAll (void) |
static void Thread_deleteAll (void) |
#else |
#else |
Line 352 static void Thread_deleteAll ()
|
Line 353 static void Thread_deleteAll ()
|
} |
} |
} |
} |
|
|
/*+--------------------------------------------------------------------+ */ |
/*---------------------------------------------------------------------- |
/*| authentication_handler | */ |
authentication_handler |
/*| This function is registered to handle access authentication, | */ |
This function is registered to handle access authentication, |
/*| for example for HTTP | */ |
for example for HTTP |
/*+--------------------------------------------------------------------+ */ |
----------------------------------------------------------------------*/ |
#ifdef __STDC__ |
#ifdef __STDC__ |
static int authentication_handler (HTRequest * request, void *context, int status) |
static int authentication_handler (HTRequest * request, void *context, int status) |
#else |
#else |
Line 422 int status;
|
Line 423 int status;
|
} |
} |
|
|
|
|
/* ---------------------------------------------------------------------- */ |
/*---------------------------------------------------------------------- |
/* redirection_handler |
redirection_handler |
** ------------------- |
|
** This function is registered to handle permanent and temporary |
** This function is registered to handle permanent and temporary |
** redirections |
** redirections |
*/ |
|
/* |
|
[x] Verfiy Put, Post |
[x] Verfiy Put, Post |
[ ] Verify if NormalizeURL is not redundant |
[ ] Verify if NormalizeURL is not redundant |
[ ] Errors, should be done here or in terminate handler?? |
[ ] Errors, should be done here or in terminate handler?? |
*/ |
|
/* ---------------------------------------------------------------------- */ |
----------------------------------------------------------------------*/ |
#ifdef __STDC__ |
#ifdef __STDC__ |
static int redirection_handler (HTRequest * request, HTResponse *response, void *param, int status) |
static int redirection_handler (HTRequest * request, HTResponse *response, void *param, int status) |
#else |
#else |
Line 531 int status;
|
Line 531 int status;
|
return HT_ERROR; |
return HT_ERROR; |
} |
} |
|
|
/* ---------------------------------------------------------------------- */ |
/*---------------------------------------------------------------------- |
/* terminate_handler |
terminate_handler |
** ----------------- |
|
** This function is registered to handle the result of the request |
** This function is registered to handle the result of the request |
*/ |
|
/* ---------------------------------------------------------------------- */ |
----------------------------------------------------------------------*/ |
#if __STDC__ |
#if __STDC__ |
static int terminate_handler (HTRequest * request, HTResponse *response, void *context, int status) |
static int terminate_handler (HTRequest * request, HTResponse *response, void *context, int status) |
#else |
#else |
Line 555 int status;
|
Line 554 int status;
|
|
|
/* output any errors from the server */ |
/* output any errors from the server */ |
|
|
/************************* |
/*** |
** me->output = output file which will receive an html file |
** me->output = output file which will receive an html file |
** me->error_html = yes, output HTML errors in the screen |
** me->error_html = yes, output HTML errors in the screen |
** request->error_stack == if there are any errors, they will be here |
** request->error_stack == if there are any errors, they will be here |
Line 655 int status;
|
Line 654 int status;
|
return HT_OK; |
return HT_OK; |
} |
} |
|
|
/*-------------------------------------------------------------------*/ |
/*---------------------------------------------------------------------- |
/* Application "AFTER" Callback */ |
Application "AFTER" Callback |
/* ----------------------------- */ |
This function uses all the functionaly that the app part of |
/* This function uses all the functionaly that the app part of */ |
the Library gives for handling AFTER a request. |
/* the Library gives for handling AFTER a request. */ |
----------------------------------------------------------------------*/ |
/*-------------------------------------------------------------------*/ |
|
|
|
#ifdef __STDC__ |
#ifdef __STDC__ |
static int AHTLoadTerminate_handler (HTRequest * request, HTResponse *response, void *param, int status) |
static int AHTLoadTerminate_handler (HTRequest * request, HTResponse *response, void *param, int status) |
Line 804 static int AHTSaveFilter (HTReq
|
Line 802 static int AHTSaveFilter (HTReq
|
} |
} |
|
|
|
|
/*------------------------------------------------------------------------ */ |
/*---------------------------------------------------------------------- |
/* BINDINGS BETWEEN A SOURCE MEDIA TYPE AND A DEST MEDIA TYPE (CONVERSION) */ |
BINDINGS BETWEEN A SOURCE MEDIA TYPE AND A DEST MEDIA TYPE (CONVERSION) |
/* ----------------------------------------------------------------------- */ |
----------------------------------------------------------------------*/ |
|
|
static void AHTConverterInit (HTList * c) |
static void AHTConverterInit (HTList * c) |
{ |
{ |
Line 879 static void AHTConverterInit (HT
|
Line 877 static void AHTConverterInit (HT
|
} |
} |
|
|
/* REGISTER BEFORE AND AFTER FILTERS |
/* REGISTER BEFORE AND AFTER FILTERS |
** --------------------------------- |
|
** We register a commonly used set of BEFORE and AFTER filters. |
** We register a commonly used set of BEFORE and AFTER filters. |
** Not done automaticly - may be done by application! |
** Not done automaticly - may be done by application! |
*/ |
*/ |
|
|
/* REGISTER ALL AMAYA SUPPORTED PROTOCOLS |
/* REGISTER ALL AMAYA SUPPORTED PROTOCOLS |
** ------------------------------------------- |
|
*/ |
*/ |
static void AHTProtocolInit (void) |
static void AHTProtocolInit (void) |
{ |
{ |
Line 911 static void AHTNetInit (void)
|
Line 907 static void AHTNetInit (void)
|
{ |
{ |
|
|
/* Register BEFORE filters |
/* Register BEFORE filters |
** ----------------------- |
|
** The BEFORE filters handle proxies, caches, rule files etc. |
** The BEFORE filters handle proxies, caches, rule files etc. |
** The filters are called in the order by which the are registered |
** The filters are called in the order by which the are registered |
** Not done automaticly - may be done by application! |
** Not done automaticly - may be done by application! |
Line 925 static void AHTNetInit (void)
|
Line 920 static void AHTNetInit (void)
|
/*#endif */ |
/*#endif */ |
|
|
/* register AFTER filters |
/* register AFTER filters |
** ---------------------- |
|
** The AFTER filters handle error messages, logging, redirection, |
** The AFTER filters handle error messages, logging, redirection, |
** authentication etc. |
** authentication etc. |
** The filters are called in the order by which the are registered |
** The filters are called in the order by which the are registered |
Line 1002 static void AHTProfile_newAmaya
|
Line 996 static void AHTProfile_newAmaya
|
HTAlert_setInteractive (YES); |
HTAlert_setInteractive (YES); |
} |
} |
|
|
/* ------------------------------------------------------------------------- */ |
/*---------------------------------------------------------------------- |
|
----------------------------------------------------------------------*/ |
|
|
#ifdef __STDC__ |
#ifdef __STDC__ |
static void AHTProfile_delete (void) |
static void AHTProfile_delete (void) |
Line 1024 static void AHTProfile_delete ()
|
Line 1019 static void AHTProfile_delete ()
|
} |
} |
|
|
/* REGISTER CALLBACKS FOR THE ALERT MANAGER |
/* REGISTER CALLBACKS FOR THE ALERT MANAGER |
** ---------------------------------------- |
|
** We register a set of alert messages |
** We register a set of alert messages |
*/ |
*/ |
|
|
|
/*---------------------------------------------------------------------- |
|
----------------------------------------------------------------------*/ |
|
|
#ifdef __STDC__ |
#ifdef __STDC__ |
static void AHTAlertInit (void) |
static void AHTAlertInit (void) |
#else |
#else |
Line 1049 static void AHTAlertInit ()
|
Line 1046 static void AHTAlertInit ()
|
|
|
} |
} |
|
|
/* ---------------------------------------------------------------------- */ |
/*---------------------------------------------------------------------- |
/* ---------------------------------------------------------------------- */ |
----------------------------------------------------------------------*/ |
#ifdef __STDC__ |
#ifdef __STDC__ |
void QueryInit () |
void QueryInit () |
#else |
#else |
Line 1120 void QueryInit ()
|
Line 1117 void QueryInit ()
|
} |
} |
|
|
|
|
/* ---------------------------------------------------------------------- */ |
/*---------------------------------------------------------------------- |
/* ---------------------------------------------------------------------- */ |
----------------------------------------------------------------------*/ |
void QueryClose () |
void QueryClose () |
{ |
{ |
/** HTConversion_deleteAll(converters); **/ |
/** HTConversion_deleteAll(converters); **/ |
Line 1140 void QueryClose ()
|
Line 1137 void QueryClose ()
|
} |
} |
|
|
|
|
/* ---------------------------------------------------------------------- */ |
/*---------------------------------------------------------------------- |
/* | GetObjectWWW loads the file designated by urlName in a temporary | */ |
GetObjectWWW loads the file designated by urlName in a temporary |
/* | file. | */ |
file. |
/* | | */ |
|
/* | 4 file retrieval modes are proposed: | */ |
4 file retrieval modes are proposed: |
/* | AMAYA_SYNC : blocking mode | */ |
AMAYA_SYNC : blocking mode |
/* | AMAYA_ISYNC : incremental, blocking mode | */ |
AMAYA_ISYNC : incremental, blocking mode |
/* | AMAYA_ASYNC : non-blocking mode | */ |
AMAYA_ASYNC : non-blocking mode |
/* | AMAYA_IASYNC : incremental, non-blocking mode | */ |
AMAYA_IASYNC : incremental, non-blocking mode |
/* | | */ |
|
/* | In the incremental mode, each time a package arrives, it will be | */ |
In the incremental mode, each time a package arrives, it will be |
/* | stored in the temporary file. In addition, if an | */ |
stored in the temporary file. In addition, if an |
/* | incremental_callback function is defined, this function will be | */ |
incremental_callback function is defined, this function will be |
/* | called and handled a copy of the newly received data package. | */ |
called and handled a copy of the newly received data package. |
/* | Finally, if a terminate_callback function is defined, it will be | */ |
Finally, if a terminate_callback function is defined, it will be |
/* | invoked when the request terminates. The caller of this function |
invoked when the request terminates. The caller of this function |
can define two different contexts to be passed to the callback |
can define two different contexts to be passed to the callback |
functions. |
functions. |
|
|
Line 1191 void QueryClose ()
|
Line 1188 void QueryClose ()
|
Returns: |
Returns: |
HT_ERROR |
HT_ERROR |
HT_OK |
HT_OK |
*/ |
|
/* ---------------------------------------------------------------------- */ |
----------------------------------------------------------------------*/ |
#ifdef __STDC__ |
#ifdef __STDC__ |
int GetObjectWWW (int docid, char *urlName, char *postString, |
int GetObjectWWW (int docid, char *urlName, char *postString, |
char *outputfile, int mode, |
char *outputfile, int mode, |
Line 1473 generated
|
Line 1470 generated
|
return (status); |
return (status); |
} |
} |
|
|
/* ---------------------------------------------------------------------- */ |
/*---------------------------------------------------------------------- |
/* | PutObjectWWW uploads a file into a URL | */ |
PutObjectWWW uploads a file into a URL |
/* | | */ |
|
/* | 2 upload modes are proposed: | */ |
2 upload modes are proposed: |
/* | AMAYA_SYNC : blocking mode | */ |
AMAYA_SYNC : blocking mode |
/* | AMAYA_ASYNC : non-blocking mode | */ |
AMAYA_ASYNC : non-blocking mode |
/* | | */ |
|
/* |
|
When the function is called with the SYNC mode, the function will |
When the function is called with the SYNC mode, the function will |
return only when the file has been uploaded. |
return only when the file has been uploaded. |
The ASYNC mode will immediately return after setting up the |
The ASYNC mode will immediately return after setting up the |
Line 1512 generated
|
Line 1509 generated
|
Returns: |
Returns: |
HT_ERROR |
HT_ERROR |
HT_OK |
HT_OK |
*/ |
|
/* ---------------------------------------------------------------------- */ |
----------------------------------------------------------------------*/ |
#ifdef __STDC__ |
#ifdef __STDC__ |
int PutObjectWWW (int docid, char *fileName, char *urlName, int mode, |
int PutObjectWWW (int docid, char *fileName, char *urlName, int mode, |
TTcbf * terminate_cbf, void *context_tcbf) |
TTcbf * terminate_cbf, void *context_tcbf) |
Line 1607 void *context_tcbf;
|
Line 1604 void *context_tcbf;
|
} |
} |
|
|
|
|
|
/*---------------------------------------------------------------------- |
|
----------------------------------------------------------------------*/ |
|
|
#ifdef __STDC__ |
#ifdef __STDC__ |
int UploadMemWWW (int docid, HTMethod method, |
int UploadMemWWW (int docid, HTMethod method, |
char *urlName, char *mem_ptr, unsigned long block_size, |
char *urlName, char *mem_ptr, unsigned long block_size, |
Line 1680 char *outputfile;
|
Line 1680 char *outputfile;
|
HTAnchor_setFormat ( (HTParentAnchor *) me->anchor, HTAtom_for ("text/html") ); /* test */ |
HTAnchor_setFormat ( (HTParentAnchor *) me->anchor, HTAtom_for ("text/html") ); /* test */ |
HTAnchor_setLength ( (HTParentAnchor *) me->anchor, me->block_size); |
HTAnchor_setLength ( (HTParentAnchor *) me->anchor, me->block_size); |
HTRequest_setEntityAnchor (me->request, me->anchor); |
HTRequest_setEntityAnchor (me->request, me->anchor); |
/**** |
/* |
HTRequest_addAfter (me->request, AHTSaveFilter, NULL, NULL, HT_ALL, |
HTRequest_addAfter (me->request, AHTSaveFilter, NULL, NULL, HT_ALL, |
HT_FILTER_FIRST, NO); |
HT_FILTER_FIRST, NO); |
****/ |
*/ |
status = HTLoadAbsolute (urlName, me->request); |
status = HTLoadAbsolute (urlName, me->request); |
|
|
if (status == HT_ERROR || me->reqStatus == HT_END |
if (status == HT_ERROR || me->reqStatus == HT_END |
Line 1725 char *outputfile;
|
Line 1725 char *outputfile;
|
} |
} |
|
|
|
|
/* ---------------------------------------------------------------------- */ |
/*---------------------------------------------------------------------- |
/* Stop Request stops (kills) all active requests associated with a docid */ |
Stop Request stops (kills) all active requests associated with a docid |
/* ---------------------------------------------------------------------- */ |
----------------------------------------------------------------------*/ |
#ifdef __STDC__ |
#ifdef __STDC__ |
void StopRequest (int docid) |
void StopRequest (int docid) |
#else |
#else |
Line 1799 int docid;
|
Line 1799 int docid;
|
} /* StopRequest */ |
} /* StopRequest */ |
|
|
|
|
|
/*---------------------------------------------------------------------- |
|
----------------------------------------------------------------------*/ |
|
|
#ifdef __STDC__ |
#ifdef __STDC__ |
static int LoopForStop (AHTReqContext * me) |
static int LoopForStop (AHTReqContext * me) |