version 1.296, 2002/04/24 14:46:39
|
version 1.297, 2002/05/31 10:48:42
|
Line 126 int WIN_Activate_Request (HTRequest* , H
|
Line 126 int WIN_Activate_Request (HTRequest* , H
|
#endif /* _WINDOWS */ |
#endif /* _WINDOWS */ |
|
|
|
|
|
#ifdef DAV |
|
#include "davlib.h" |
|
#include "davlib_f.h" |
|
#include "davlibCommon_f.h" |
|
#endif |
|
|
#ifdef AMAYA_WWW_CACHE |
#ifdef AMAYA_WWW_CACHE |
/*************************************************************** |
/*************************************************************** |
lock functions, used to avoid concurrent use of the cache |
lock functions, used to avoid concurrent use of the cache |
Line 468 char *HTTP_headers (AHTHeaders *me, AH
|
Line 474 char *HTTP_headers (AHTHeaders *me, AH
|
AHTReqContext_new |
AHTReqContext_new |
create a new Amaya Context Object and update the global Amaya |
create a new Amaya Context Object and update the global Amaya |
request status. |
request status. |
----------------------------------------------------------------------*/ |
|
static AHTReqContext *AHTReqContext_new (int docid) |
---------------------------------------------------------------------- |
|
MKP: this function is now used in davlib.c file for the WebDAV requests |
|
** static AHTReqContext *AHTReqContext_new (int docid) ** |
|
---------------------------------------------------------------------- */ |
|
AHTReqContext *AHTReqContext_new (int docid) |
{ |
{ |
AHTReqContext *me; |
AHTReqContext *me; |
AHTDocId_Status *docid_status; |
AHTDocId_Status *docid_status; |
Line 514 static AHTReqContext *AHTReqContext_new
|
Line 524 static AHTReqContext *AHTReqContext_new
|
else |
else |
docid_status->counter++; |
docid_status->counter++; |
|
|
|
#ifdef DAV /* clean the DAV request context */ |
|
me->dav_context = NULL; /* it should be create only when doing a DAV request */ |
|
#endif |
|
|
Amaya->open_requests++; |
Amaya->open_requests++; |
|
|
#ifdef DEBUG_LIBWWW |
#ifdef DEBUG_LIBWWW |
Line 537 ThotBool AHTReqContext_delete (AHTReqCo
|
Line 551 ThotBool AHTReqContext_delete (AHTReqCo
|
#ifdef DEBUG_LIBWWW |
#ifdef DEBUG_LIBWWW |
fprintf (stderr, "AHTReqContext_delete: Deleting object %p\n", me); |
fprintf (stderr, "AHTReqContext_delete: Deleting object %p\n", me); |
#endif |
#endif |
|
|
|
#ifdef DAV /* if there is a DAV context object, delete it */ |
|
if (me->dav_context) AHTDAVContext_delete(me->dav_context); |
|
#endif /* DAV */ |
|
|
if (Amaya->reqlist) |
if (Amaya->reqlist) |
HTList_removeObject (Amaya->reqlist, (void *) me); |
HTList_removeObject (Amaya->reqlist, (void *) me); |
|
|
Line 972 static int redirection_handler (HTReques
|
Line 991 static int redirection_handler (HTReques
|
HTRequest_setError (request, NULL); |
HTRequest_setError (request, NULL); |
/* clear the authentication credentials, as they get regenerated */ |
/* clear the authentication credentials, as they get regenerated */ |
HTRequest_deleteCredentialsAll (request); |
HTRequest_deleteCredentialsAll (request); |
|
|
|
#ifdef DAV |
|
/* remove the old If header */ |
|
DAVRemoveIfHeader (me); |
|
|
|
/* search lock information for the new url */ |
|
if (me->method == METHOD_POST || me->method == METHOD_PUT) |
|
DAVAddIfHeader (me,me->urlName); |
|
#endif |
|
|
if (me->method == METHOD_POST || me->method == METHOD_PUT) |
if (me->method == METHOD_POST || me->method == METHOD_PUT) |
{ |
{ |
Line 1026 static int precondition_handler (HTReque
|
Line 1054 static int precondition_handler (HTReque
|
|
|
if (force_put) |
if (force_put) |
{ |
{ |
|
#ifdef DAV |
|
BOOL noIf = NO; |
|
|
|
/* MKP: if the old request has preconditions, * |
|
* then, we supose that these preconditions * |
|
* caused the 412 Precondition Failed status * |
|
* code, otherwise we supose that the cause * |
|
* was an eventual If header. */ |
|
if (HTRequest_preconditions(me->request)!=HT_NO_MATCH) |
|
noIf = NO; |
|
else |
|
noIf = YES; |
|
#endif /* DAV */ |
|
|
|
|
/* start a new PUT request without preconditions */ |
/* start a new PUT request without preconditions */ |
/* @@ do we need to kill the request? */ |
/* @@ do we need to kill the request? */ |
if (me->output && me->output != stdout) |
if (me->output && me->output != stdout) |
Line 1057 static int precondition_handler (HTReque
|
Line 1100 static int precondition_handler (HTReque
|
/* turn off preconditions */ |
/* turn off preconditions */ |
HTRequest_setPreconditions(me->request, HT_NO_MATCH); |
HTRequest_setPreconditions(me->request, HT_NO_MATCH); |
me->reqStatus = HT_NEW; |
me->reqStatus = HT_NEW; |
|
|
|
|
|
#ifdef DAV |
|
/* MKP: add an If header only if there wasn't preconditions */ |
|
if (noIf!=YES) DAVAddIfHeader (me,HTAnchor_address(me->dest)); |
|
#endif /* DAV */ |
|
|
|
|
/* make the request */ |
/* make the request */ |
status = HTPutDocumentAnchor (HTAnchor_parent (me->source), |
status = HTPutDocumentAnchor (HTAnchor_parent (me->source), |
me->dest, me->request); |
me->dest, me->request); |
Line 1130 static int check_handler (HTRequest * re
|
Line 1181 static int check_handler (HTRequest * re
|
*/ |
*/ |
if (me->mode & AMAYA_FLUSH_REQUEST) |
if (me->mode & AMAYA_FLUSH_REQUEST) |
HTRequest_setFlush(me->request, YES); |
HTRequest_setFlush(me->request, YES); |
|
|
|
#ifdef DAV |
|
/* MKP: try to add an if header */ |
|
DAVAddIfHeader (me,me->urlName); |
|
#endif |
|
|
|
|
/* turn on the special preconditions, to avoid having this |
/* turn on the special preconditions, to avoid having this |
ressource appear before we do the PUT */ |
ressource appear before we do the PUT */ |
Line 1162 static int check_handler (HTRequest * re
|
Line 1219 static int check_handler (HTRequest * re
|
HTRequest_setOutputFormat (me->request, WWW_SOURCE); |
HTRequest_setOutputFormat (me->request, WWW_SOURCE); |
HTRequest_setContext (me->request, me); |
HTRequest_setContext (me->request, me); |
HTRequest_setPreemptive (me->request, NO); |
HTRequest_setPreemptive (me->request, NO); |
|
|
|
#ifdef DAV |
|
/* MKP: try to add an if header */ |
|
DAVAddIfHeader (me,HTAnchor_address(me->dest)); |
|
#endif |
|
|
/* |
/* |
** Make sure that the first request is flushed immediately and not |
** Make sure that the first request is flushed immediately and not |
** buffered in the output buffer |
** buffered in the output buffer |
Line 1231 static int terminate_handler (HTRequest
|
Line 1294 static int terminate_handler (HTRequest
|
#endif /* AMAYA_WWW_CACHE */ |
#endif /* AMAYA_WWW_CACHE */ |
|| me->reqStatus == HT_ABORT) |
|| me->reqStatus == HT_ABORT) |
error_flag = FALSE; |
error_flag = FALSE; |
|
#ifdef DAV |
|
else if (status == HT_LOCKED |
|
|| status == HT_FAILED_DEPENDENCY |
|
|| status == HT_MULTI_STATUS) { |
|
/* WebDAV return codes - they are handled in |
|
* specific filters. We don't need to deal |
|
* with them anymore |
|
*/ |
|
error_flag = FALSE; |
|
} |
|
#endif |
else |
else |
error_flag = TRUE; |
error_flag = TRUE; |
|
|
Line 1383 int AHTLoadTerminate_handler (HTRequest
|
Line 1457 int AHTLoadTerminate_handler (HTRequest
|
if (PROT_TRACE) |
if (PROT_TRACE) |
HTTrace ("Load End.... OK BUT NO DATA: `%s\'\n", |
HTTrace ("Load End.... OK BUT NO DATA: `%s\'\n", |
me->status_urlName); |
me->status_urlName); |
TtaSetStatus (me->docid, 1, |
#ifdef DAV |
|
if (me->method==METHOD_UNLOCK) { |
|
/* MKP: NEED set a good status message */ |
|
TtaSetStatus (me->docid, 1, |
|
TtaGetMessage (AMAYA, AM_UNLOCK_SUCCEED), |
|
NULL); |
|
} |
|
else |
|
#endif |
|
TtaSetStatus (me->docid, 1, |
TtaGetMessage (AMAYA, AM_LOADED_NO_DATA), |
TtaGetMessage (AMAYA, AM_LOADED_NO_DATA), |
me->status_urlName); |
me->status_urlName); |
break; |
break; |
Line 2952 int GetObjectWWW (int docid, char *urlNa
|
Line 3035 int GetObjectWWW (int docid, char *urlNa
|
if (formdata && ! (mode & AMAYA_FILE_POST)) |
if (formdata && ! (mode & AMAYA_FILE_POST)) |
me->formdata = PrepareFormdata (formdata); |
me->formdata = PrepareFormdata (formdata); |
|
|
|
|
|
#ifdef DAV |
|
/* try to add an If header for POST requests and for GET forms */ |
|
if (HTRequest_method(me->request) == METHOD_POST || |
|
(HTRequest_method(me->request) == METHOD_GET && me->formdata)) |
|
DAVAddIfHeader (me,HTAnchor_address((HTAnchor*)me->anchor)); |
|
#endif |
|
|
|
|
/* do the request */ |
/* do the request */ |
if (mode & AMAYA_FORM_POST) |
if (mode & AMAYA_FORM_POST) |
{ |
{ |
Line 3357 int PutObjectWWW (int docid, char *fileN
|
Line 3449 int PutObjectWWW (int docid, char *fileN
|
ChopURL (me->status_urlName, me->urlName); |
ChopURL (me->status_urlName, me->urlName); |
TtaSetStatus (me->docid, 1, TtaGetMessage (AMAYA, AM_REMOTE_SAVING), me->status_urlName); |
TtaSetStatus (me->docid, 1, TtaGetMessage (AMAYA, AM_REMOTE_SAVING), me->status_urlName); |
|
|
|
|
|
#ifdef DAV |
|
/* MKP: for a PUT request, try to add an if header |
|
* for a HEAD request, leave this for check_handler */ |
|
if ( !(lost_update_check && (!UsePreconditions || !etag)) ) |
|
DAVAddIfHeader (me,HTAnchor_address(me->dest)); |
|
#endif |
|
|
|
|
/* make the request */ |
/* make the request */ |
if (lost_update_check && (!UsePreconditions || !etag)) |
if (lost_update_check && (!UsePreconditions || !etag)) |
status = HTHeadAnchor (me->dest, me->request); |
status = HTHeadAnchor (me->dest, me->request); |