version 1.376, 2008/08/19 15:01:57
|
version 1.377, 2008/09/22 12:24:15
|
Line 3271 int GetObjectWWW (int docid, int refdoc,
|
Line 3271 int GetObjectWWW (int docid, int refdoc,
|
me->request); |
me->request); |
status = posted ? YES : NO; |
status = posted ? YES : NO; |
} |
} |
#ifdef ANNOTATIONS |
|
else if (mode & AMAYA_FILE_POST) |
else if (mode & AMAYA_FILE_POST) |
{ |
{ |
unsigned long filesize; |
unsigned long filesize; |
Line 3321 int GetObjectWWW (int docid, int refdoc,
|
Line 3320 int GetObjectWWW (int docid, int refdoc,
|
(HTAnchor *) me->anchor, |
(HTAnchor *) me->anchor, |
me->request); |
me->request); |
} |
} |
#endif /* ANNOTATIONS */ |
|
else if (formdata) |
else if (formdata) |
status = HTGetFormAnchor(me->formdata, (HTAnchor *) me->anchor, |
status = HTGetFormAnchor(me->formdata, (HTAnchor *) me->anchor, |
me->request); |
me->request); |
Line 3420 int PutObjectWWW (int docid, char *fileN
|
Line 3418 int PutObjectWWW (int docid, char *fileN
|
char *esc_url; |
char *esc_url; |
int UsePreconditions; |
int UsePreconditions; |
char url_name[MAX_LENGTH]; |
char url_name[MAX_LENGTH]; |
char *resource_name; |
char *resource_name, *localfilename; |
char *tmp2; |
char *tmp2; |
char file_name[MAX_LENGTH]; |
char file_name[MAX_LENGTH]; |
ThotBool lost_update_check = TRUE; |
ThotBool lost_update_check = TRUE; |
Line 3458 int PutObjectWWW (int docid, char *fileN
|
Line 3456 int PutObjectWWW (int docid, char *fileN
|
|
|
/* get the size of the file */ |
/* get the size of the file */ |
if (!AM_GetFileSize (fileName, &file_size) || file_size == 0L) |
if (!AM_GetFileSize (fileName, &file_size) || file_size == 0L) |
{ |
/* file was empty */ |
/* file was empty */ |
return (HT_ERROR); |
/*errmsg here */ |
|
return (HT_ERROR); |
|
} |
|
|
|
/* prepare the request context */ |
/* prepare the request context */ |
if (THD_TRACE) |
if (THD_TRACE) |
Line 3476 int PutObjectWWW (int docid, char *fileN
|
Line 3471 int PutObjectWWW (int docid, char *fileN
|
return (HT_ERROR); |
return (HT_ERROR); |
} |
} |
|
|
/* |
/* Set up the original URL name */ |
** Set up the original URL name |
|
*/ |
|
|
|
/* are we using content-location? */ |
/* are we using content-location? */ |
if (DocumentMeta[docid]->content_location) |
if (DocumentMeta[docid]->content_location) |
resource_name = DocumentMeta[docid]->content_location; |
resource_name = DocumentMeta[docid]->content_location; |
Line 3545 int PutObjectWWW (int docid, char *fileN
|
Line 3537 int PutObjectWWW (int docid, char *fileN
|
me->outputfile = (char *) NULL; |
me->outputfile = (char *) NULL; |
} |
} |
|
|
#ifdef _WX |
localfilename = TtaGetRealFileName (fileName); |
char * localfilename = TtaGetRealFileName (fileName); |
|
/* @@IV 18/08/2004 eencode spaces in the local filename */ |
/* @@IV 18/08/2004 eencode spaces in the local filename */ |
fileURL = EscapeURL (localfilename); |
fileURL = EscapeURL (localfilename); |
TtaFreeMemory(localfilename); |
TtaFreeMemory(localfilename); |
#else /* _WX */ |
|
/* @@IV 18/08/2004 eencode spaces in the local filename */ |
|
fileURL = EscapeURL (fileName); |
|
#endif /* _WX */ |
|
if (fileURL) |
if (fileURL) |
{ |
{ |
strcpy (file_name, fileURL); |
strcpy (file_name, fileURL); |
Line 3581 int PutObjectWWW (int docid, char *fileN
|
Line 3568 int PutObjectWWW (int docid, char *fileN
|
in the following lines */ |
in the following lines */ |
dest_anc_parent = HTAnchor_parent (me->dest); |
dest_anc_parent = HTAnchor_parent (me->dest); |
|
|
/* |
/* Set the Content-Type of the file we are uploading */ |
** Set the Content-Type of the file we are uploading |
|
*/ |
|
/* we try to use any content-type previosuly associated |
/* we try to use any content-type previosuly associated |
with the parent. If it doesn't exist, we try to guess it |
with the parent. If it doesn't exist, we try to guess it |
from the URL */ |
from the URL */ |
/* @@ JK: trying to use the content type we stored */ |
/* @@ JK: trying to use the content type we stored */ |
/* |
|
tmp2 = HTAtom_name (HTAnchor_format (dest_anc_parent)); |
|
*/ |
|
tmp2 = NULL; |
tmp2 = NULL; |
if (!tmp2 || !strcmp (tmp2, "www/unknown")) |
if (!tmp2 || !strcmp (tmp2, "www/unknown")) |
{ |
{ |
Line 3611 int PutObjectWWW (int docid, char *fileN
|
Line 3593 int PutObjectWWW (int docid, char *fileN
|
/* we go thru setOutputFormat, rather than change the parent's |
/* we go thru setOutputFormat, rather than change the parent's |
anchor, as that's the place that libwww expects it to be */ |
anchor, as that's the place that libwww expects it to be */ |
HTAnchor_setFormat (HTAnchor_parent (me->source), HTAtom_for (tmp2)); |
HTAnchor_setFormat (HTAnchor_parent (me->source), HTAtom_for (tmp2)); |
|
|
HTRequest_setOutputFormat (me->request, HTAtom_for (tmp2)); |
HTRequest_setOutputFormat (me->request, HTAtom_for (tmp2)); |
|
|
/* |
/* Set the Charset of the file we are uploading */ |
** Set the Charset of the file we are uploading |
|
*/ |
|
/* we set the charset as indicated in the document's metadata |
/* we set the charset as indicated in the document's metadata |
structure (and only if it exists) */ |
structure (and only if it exists) */ |
charset = TtaGetDocumentCharset (docid); |
charset = TtaGetDocumentCharset (docid); |
Line 3637 int PutObjectWWW (int docid, char *fileN
|
Line 3616 int PutObjectWWW (int docid, char *fileN
|
} |
} |
} |
} |
|
|
/* |
/* define other request characteristics */ |
** define other request characteristics |
|
*/ |
|
HTRequest_setPreemptive (me->request, NO); |
HTRequest_setPreemptive (me->request, NO); |
|
|
/* |
/* 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 |
|
*/ |
|
if (mode & AMAYA_FLUSH_REQUEST) |
if (mode & AMAYA_FLUSH_REQUEST) |
HTRequest_setFlush(me->request, YES); |
HTRequest_setFlush(me->request, YES); |
|
|
Line 3685 int PutObjectWWW (int docid, char *fileN
|
Line 3660 int PutObjectWWW (int docid, char *fileN
|
|
|
#if 0 |
#if 0 |
/* Throw away any reponse body */ |
/* Throw away any reponse body */ |
/* |
|
HTRequest_setOutputStream (me->request, HTBlackHole()); |
|
*/ |
|
HTRequest_setOutputStream (me->request, NULL); |
HTRequest_setOutputStream (me->request, NULL); |
#endif |
#endif |
|
|
Line 3696 int PutObjectWWW (int docid, char *fileN
|
Line 3668 int PutObjectWWW (int docid, char *fileN
|
TtaSetStatus (me->docid, 1, TtaGetMessage (AMAYA, AM_REMOTE_SAVING), |
TtaSetStatus (me->docid, 1, TtaGetMessage (AMAYA, AM_REMOTE_SAVING), |
me->status_urlName); |
me->status_urlName); |
|
|
|
|
#ifdef DAV |
#ifdef DAV |
/* MKP: for a PUT request, try to add an "If" header (lock information) |
/* MKP: for a PUT request, try to add an "If" header (lock information) |
* for a HEAD request, leave this for check_handler */ |
* for a HEAD request, leave this for check_handler */ |
Line 3725 int PutObjectWWW (int docid, char *fileN
|
Line 3696 int PutObjectWWW (int docid, char *fileN
|
return (status == YES ? 0 : -1); |
return (status == YES ? 0 : -1); |
} |
} |
|
|
|
|
/*---------------------------------------------------------------------- |
/*---------------------------------------------------------------------- |
StopRequest |
StopRequest |
stops (kills) all active requests associated with a docid |
stops (kills) all active requests associated with a docid |