version 2.20.2.3, 1995/03/09 18:18:26
|
version 2.21, 1994/12/06 14:27:28
|
Line 13
|
Line 13
|
** 05 May 94 Written by Henrik Frystyk, frystyk@dxcern.cern.ch |
** 05 May 94 Written by Henrik Frystyk, frystyk@dxcern.cern.ch |
*/ |
*/ |
|
|
|
#include "sysdep.h" |
|
|
/* Library include files */ |
/* Library include files */ |
#include "tcp.h" |
|
#include "HTUtils.h" |
|
#include "HTString.h" |
|
#include "HTTCP.h" |
#include "HTTCP.h" |
|
#include "HTUtils.h" |
#include "HTError.h" /* Implemented here */ |
#include "HTError.h" /* Implemented here */ |
|
|
/* Globals */ |
/* Globals */ |
Line 36 PUBLIC HTErrorMsgInfo error_info[HTERR_E
|
Line 36 PUBLIC HTErrorMsgInfo error_info[HTERR_E
|
{ 200, "OK", "ok.multi" }, |
{ 200, "OK", "ok.multi" }, |
{ 201, "Created", "created.multi" }, |
{ 201, "Created", "created.multi" }, |
{ 202, "Accepted", "accepted.multi" }, |
{ 202, "Accepted", "accepted.multi" }, |
{ 203, "Provisional Information", "partial.multi" }, |
{ 203, "Partial Information", "partial.multi" }, |
{ 204, "No Response", "no_response.multi" }, |
{ 204, "No Response", "no_response.multi" }, |
{ 205, "Deleted", "deleted.multi" }, |
{ 301, "Moved", "moved.multi" }, |
{ 206, "Modified", "modified.multi" }, |
{ 302, "Found", "found.multi" }, |
{ 301, "Moved Permanently", "moved.multi" }, |
|
{ 302, "Moved Temporarily", "moved.multi" }, |
|
{ 303, "Method", "method.multi" }, |
{ 303, "Method", "method.multi" }, |
{ 304, "Not Modified", "not_modified.multi" }, |
{ 304, "Not Modified Since", "not_modified.multi" }, |
{ 400, "Bad Request", "bad_request.multi" }, |
{ 400, "Invalid Request", "bad_request.multi" }, |
{ 401, "Unauthorized", "unauthorized.multi" }, |
{ 401, "Unauthorized Access Denied", "unauthorized.multi" }, |
{ 402, "Payment Required", "payment.multi" }, |
{ 402, "Payment Required", "payment.multi" }, |
{ 403, "Forbidden", "forbidden.multi" }, |
{ 403, "Access forbidden", "forbidden.multi" }, |
{ 404, "Not Found", "not_found.multi" }, |
{ 404, "No Match Found for", "not_found.multi" }, |
{ 405, "Method Not Allowed", "method.multi" }, |
{ 500, "Can't Access Document", "internal.multi" }, |
{ 406, "None Acceptable", "none.multi" }, |
{ 501, "Command not Implemented", "not_implem.multi" }, |
{ 407, "Proxy Authentication Required", "proxy.multi" }, |
|
{ 408, "Request Timeout", "timeout.multi" }, |
|
{ 500, "Internal Server Error", "internal.multi" }, |
|
{ 501, "Not Implemented", "not_made.multi" }, |
|
{ 502, "Bad Gateway", "bad_gate.multi" }, |
|
{ 503, "Service Unavailable", "unavailable.multi" }, |
|
{ 504, "Gateway Timeout", "timeout.multi" }, |
|
{ 0, "-------------------------", "----------------------------------" }, |
{ 0, "-------------------------", "----------------------------------" }, |
{ 0, "Can't locate remote host", "host.multi" }, |
{ 0, "Can't locate remote host", "host.multi" }, |
{ 0, "No host name found", "host.multi" }, |
{ 0, "No host name found", "host.multi" }, |
Line 95 PUBLIC HTErrorMsgInfo error_info[HTERR_E
|
Line 86 PUBLIC HTErrorMsgInfo error_info[HTERR_E
|
** |
** |
** NOTE: See also HTErrorSysAdd for system errors |
** NOTE: See also HTErrorSysAdd for system errors |
** |
** |
** Returns always HT_ERROR |
** Returns always < 0 |
*/ |
*/ |
PUBLIC int HTErrorAdd ARGS7(HTRequest *, request, |
PUBLIC int HTErrorAdd ARGS7(HTRequest *, request, |
HTErrSeverity, severity, |
HTErrSeverity, severity, |
Line 107 PUBLIC int HTErrorAdd ARGS7(HTRequest *,
|
Line 98 PUBLIC int HTErrorAdd ARGS7(HTRequest *,
|
{ |
{ |
HTErrorInfo *newError; |
HTErrorInfo *newError; |
if (!request) { |
if (!request) { |
if (TRACE) fprintf(TDEST, "HTErrorAdd.. Bad argument!\n"); |
if (TRACE) fprintf(stderr, "HTErrorAdd.. Bad argument!\n"); |
return HT_ERROR; |
return -1; |
} |
} |
if ((newError = (HTErrorInfo *) calloc(1, sizeof(HTErrorInfo))) == NULL) |
if ((newError = (HTErrorInfo *) calloc(1, sizeof(HTErrorInfo))) == NULL) |
outofmem(__FILE__, "HTErrorAdd"); |
outofmem(__FILE__, "HTErrorAdd"); |
Line 136 PUBLIC int HTErrorAdd ARGS7(HTRequest *,
|
Line 127 PUBLIC int HTErrorAdd ARGS7(HTRequest *,
|
newError->handle = pres->handle+1; |
newError->handle = pres->handle+1; |
} |
} |
if (TRACE) { |
if (TRACE) { |
fprintf(TDEST, "Message..... Handle: %d\tCode: %3d\tMessage: `%s\'\tSeverity: %d\tParameter: `%s\'\tWhere: `%s\'\n", |
fprintf(stderr, "Message..... Handle: %d\tCode: %3d\tMessage: `%s\'\tSeverity: %d\tParameter: `%s\'\tWhere: `%s\'\n", |
newError->handle, |
newError->handle, |
error_info[newError->element].code, |
error_info[newError->element].code, |
error_info[newError->element].msg, |
error_info[newError->element].msg, |
Line 145 PUBLIC int HTErrorAdd ARGS7(HTRequest *,
|
Line 136 PUBLIC int HTErrorAdd ARGS7(HTRequest *,
|
newError->where ? newError->where : "Unspecified"); |
newError->where ? newError->where : "Unspecified"); |
} |
} |
HTList_addObject(request->error_stack, (void *) newError); |
HTList_addObject(request->error_stack, (void *) newError); |
return HT_ERROR; |
return (-element); |
} |
} |
|
|
|
|
Line 153 PUBLIC int HTErrorAdd ARGS7(HTRequest *,
|
Line 144 PUBLIC int HTErrorAdd ARGS7(HTRequest *,
|
** |
** |
** Add a system error message to the error list in HTRequest. syscall |
** Add a system error message to the error list in HTRequest. syscall |
** is the name of the system call, e.g. "close". The message put to the |
** is the name of the system call, e.g. "close". The message put to the |
** list is that corresponds to the error number passed. |
** list is that corresponds to the errno. This function also replaces |
|
** HTInetStatus, which is called from within. |
** |
** |
** See also HTErrorAdd. |
** See also HTErrorAdd. |
** |
** |
** Returns always HT_ERROR |
** Returns always < 0 |
*/ |
*/ |
PUBLIC int HTErrorSysAdd ARGS5(HTRequest *, request, |
PUBLIC int HTErrorSysAdd ARGS4(HTRequest *, request, |
HTErrSeverity, severity, |
HTErrSeverity, severity, |
int, errornumber, |
|
BOOL, ignore, |
BOOL, ignore, |
char *, syscall) |
char *, syscall) |
|
|
{ |
{ |
if (!request) { |
if (!request) { |
if (TRACE) fprintf(TDEST, "HTErrorSys.. Bad argument!\n"); |
if (TRACE) fprintf(stderr, "HTErrorSys.. Bad argument!\n"); |
return HT_ERROR; |
return -1; |
} |
} |
|
if (syscall) { |
|
HTInetStatus(syscall); |
|
} else |
|
HTInetStatus("Unspecified System Call"); |
{ |
{ |
char temp[100]; |
char temp[100]; |
char *errmsg = NULL; |
char *errmsg = NULL; |
sprintf(temp, error_info[HTERR_SYSTEM].msg, syscall); |
sprintf(temp, error_info[HTERR_SYSTEM].msg, syscall); |
StrAllocCopy(errmsg, temp); |
StrAllocCopy(errmsg, temp); |
StrAllocCat(errmsg, HTErrnoString(errornumber)); |
StrAllocCat(errmsg, HTErrnoString()); |
HTErrorAdd(request, severity, ignore, HTERR_SYSTEM, (void *) errmsg, |
HTErrorAdd(request, severity, ignore, HTERR_SYSTEM, (void *) errmsg, |
(int) strlen(errmsg), syscall); |
(int) strlen(errmsg), syscall); |
free(errmsg); |
free(errmsg); |
} |
} |
return HT_ERROR; |
return (-HTERR_SYSTEM); |
} |
} |
|
|
|
|
Line 214 PUBLIC void HTErrorIgnore ARGS2(HTReques
|
Line 210 PUBLIC void HTErrorIgnore ARGS2(HTReques
|
HTList *cur; |
HTList *cur; |
HTErrorInfo *pres; |
HTErrorInfo *pres; |
if (!request) { |
if (!request) { |
if (TRACE) fprintf(TDEST, "HTErrorIgnore Bad argument!\n"); |
if (TRACE) fprintf(stderr, "HTErrorIgnore Bad argument!\n"); |
return; |
return; |
} |
} |
cur = request->error_stack; |
cur = request->error_stack; |
Line 228 PUBLIC void HTErrorIgnore ARGS2(HTReques
|
Line 224 PUBLIC void HTErrorIgnore ARGS2(HTReques
|
|
|
if (TRACE) { |
if (TRACE) { |
if (found) { |
if (found) { |
fprintf(TDEST, "Error Ignore Handle: %d\tCode: %3d\tMessage: `%s\tSeverity: %d\tParameter: `%s\'\tWhere: `%s\'\n", |
fprintf(stderr, "Error Ignore Handle: %d\tCode: %3d\tMessage: `%s\tSeverity: %d\tParameter: `%s\'\tWhere: `%s\'\n", |
pres->handle, |
pres->handle, |
error_info[pres->element].code, |
error_info[pres->element].code, |
error_info[pres->element].msg, |
error_info[pres->element].msg, |
Line 236 PUBLIC void HTErrorIgnore ARGS2(HTReques
|
Line 232 PUBLIC void HTErrorIgnore ARGS2(HTReques
|
pres->par ? (char *) pres->par : "Unspecified", |
pres->par ? (char *) pres->par : "Unspecified", |
pres->where ? pres->where : "Unspecified"); |
pres->where ? pres->where : "Unspecified"); |
} else { |
} else { |
fprintf(TDEST, "Error Ignore Bad handle\n"); |
fprintf(stderr, "Error Ignore Bad handle\n"); |
} |
} |
} |
} |
return; |
return; |
Line 253 PUBLIC void HTErrorIgnoreLast ARGS1(HTRe
|
Line 249 PUBLIC void HTErrorIgnoreLast ARGS1(HTRe
|
HTList *cur; |
HTList *cur; |
HTErrorInfo *pres; |
HTErrorInfo *pres; |
if (!request) { |
if (!request) { |
if (TRACE) fprintf(TDEST, "HTErrorIgnore Bad argument!\n"); |
if (TRACE) fprintf(stderr, "HTErrorIgnore Bad argument!\n"); |
return; |
return; |
} |
} |
cur = request->error_stack; |
cur = request->error_stack; |
if (cur && (pres = (HTErrorInfo *) HTList_nextObject(cur)) != NULL) { |
if (cur && (pres = (HTErrorInfo *) HTList_nextObject(cur)) != NULL) { |
if (TRACE) |
if (TRACE) |
fprintf(TDEST, "Error Ignore Code: %3d\tMessage: `%s\tSeverity: %d\tParameter: `%s\'\tWhere: `%s\'\n", |
fprintf(stderr, "Error Ignore Code: %3d\tMessage: `%s\tSeverity: %d\tParameter: `%s\'\tWhere: `%s\'\n", |
error_info[pres->element].code, |
error_info[pres->element].code, |
error_info[pres->element].msg, |
error_info[pres->element].msg, |
pres->severity, |
pres->severity, |
Line 298 PUBLIC CONST char *HTErrorGetPrefix NOAR
|
Line 294 PUBLIC CONST char *HTErrorGetPrefix NOAR
|
** error_stack messages. |
** error_stack messages. |
*/ |
*/ |
|
|
/* *** LOOK IN HTErrMsg.c FOR ACTUAL IMPLEMENTATION OF THIS FUNCTION *** */ |
/* *** LOOK IN HTErrorMsg.c FOR ACTUAL IMPLEMENTATION OF THIS FUNCTION *** */ |
|
|
/* END OF MODULE */ |
/* END OF MODULE */ |
|
|