version 1.29, 2003/11/07 19:18:46
|
version 1.30, 2003/11/12 02:21:59
|
|
|
} | } |
| |
| |
void HTTPAuthenticatorDelegator::_sendError( |
void HTTPAuthenticatorDelegator::_sendHttpError( |
Uint32 queueId, | Uint32 queueId, |
const String errorMessage) |
const String& status, |
|
const String& cimError, |
|
const String& pegasusError) |
{ | { |
PEG_METHOD_ENTER(TRC_HTTP, | PEG_METHOD_ENTER(TRC_HTTP, |
"HTTPAuthenticatorDelegator::_sendError"); |
"HTTPAuthenticatorDelegator::_sendHttpError"); |
| |
// | // |
// build error response message | // build error response message |
// | // |
| |
Array<Sint8> message; | Array<Sint8> message; |
// |
message = XmlWriter::formatHttpErrorRspMessage( |
//ATTN: Need an ErrorResponseHeader() in XmlWriter |
status, |
// |
cimError, |
//message = XmlWriter::formatErrorResponseHeader(errorMessage); |
pegasusError); |
| |
_sendResponse(queueId, message); | _sendResponse(queueId, message); |
| |
|
|
if (methodName != "M-POST" && methodName != "POST") | if (methodName != "M-POST" && methodName != "POST") |
{ | { |
// Only POST and M-POST are implemented by this server | // Only POST and M-POST are implemented by this server |
Array<Sint8> message; |
_sendHttpError(queueId, |
message = XmlWriter::formatHttpErrorRspMessage( |
|
HTTP_STATUS_NOTIMPLEMENTED); | HTTP_STATUS_NOTIMPLEMENTED); |
_sendResponse(queueId, message); |
|
} | } |
else if ((httpMethod == HTTP_METHOD_M_POST) && | else if ((httpMethod == HTTP_METHOD_M_POST) && |
(httpVersion == "HTTP/1.0")) | (httpVersion == "HTTP/1.0")) |
|
|
// | // |
// M-POST method is not valid with version 1.0 | // M-POST method is not valid with version 1.0 |
// | // |
Array<Sint8> message; |
_sendHttpError(queueId, |
message = XmlWriter::formatHttpErrorRspMessage( |
|
HTTP_STATUS_BADREQUEST); | HTTP_STATUS_BADREQUEST); |
_sendResponse(queueId, message); |
|
} | } |
else | else |
{ | { |
|
|
} | } |
else | else |
{ | { |
_sendError(queueId, "Invalid Request"); |
_sendHttpError(queueId, |
|
HTTP_STATUS_BADREQUEST, |
|
String::EMPTY, |
|
"Authorization header error"); |
} | } |
| |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
|
|
} | } |
catch (CannotOpenFile &cof) | catch (CannotOpenFile &cof) |
{ | { |
Array<Sint8> errMsg; |
_sendHttpError(queueId, |
errMsg = XmlWriter::formatHttpErrorRspMessage( |
|
HTTP_STATUS_INTERNALSERVERERROR); | HTTP_STATUS_INTERNALSERVERERROR); |
_sendResponse(queueId, errMsg); |
|
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
return; | return; |
| |
|
|
} | } |
else | else |
{ | { |
_sendError(queueId, "Invalid Request"); |
_sendHttpError(queueId, |
|
HTTP_STATUS_BADREQUEST, |
|
String::EMPTY, |
|
"Authorization header error"); |
} | } |
| |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
|
|
} | } |
else | else |
{ | { |
_sendError(queueId, "Invalid Request"); |
_sendHttpError(queueId, |
|
HTTP_STATUS_BADREQUEST, |
|
String::EMPTY, |
|
"Authorization header error"); |
} | } |
| |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
|
|
catch(exception & e) | catch(exception & e) |
{ | { |
delete httpMessage; | delete httpMessage; |
Array<Sint8> message; |
_sendHttpError(queueId, |
message = XmlWriter::formatHttpErrorRspMessage(HTTP_STATUS_REQUEST_TOO_LARGE); |
HTTP_STATUS_REQUEST_TOO_LARGE); |
_sendResponse(queueId, message); |
|
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
deleteMessage = false; | deleteMessage = false; |
return; | return; |
|
|
// without the CIMError header since this request must not be | // without the CIMError header since this request must not be |
// processed as a CIM request. | // processed as a CIM request. |
| |
Array<Sint8> message; |
_sendHttpError(queueId, |
message = XmlWriter::formatHttpErrorRspMessage( |
|
HTTP_STATUS_BADREQUEST); | HTTP_STATUS_BADREQUEST); |
_sendResponse(queueId, message); |
|
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
return; | return; |
} // bad request | } // bad request |
|
|
} | } |
else | else |
{ | { |
_sendError(queueId, "Invalid Request"); |
_sendHttpError(queueId, |
|
HTTP_STATUS_BADREQUEST, |
|
String::EMPTY, |
|
"Authorization header error"); |
} | } |
} | } |
} // M-POST and POST processing | } // M-POST and POST processing |