(file) Return to HTTPOptions.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

  1 karl  1.8 //%2003////////////////////////////////////////////////////////////////////////
  2 mike  1.2 //
  3 karl  1.8 // Copyright (c) 2000, 2001, 2002  BMC Software, Hewlett-Packard Development
  4           // Company, L. P., IBM Corp., The Open Group, Tivoli Systems.
  5           // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L. P.;
  6           // IBM Corp.; EMC Corporation, The Open Group.
  7 mike  1.2 //
  8           // Permission is hereby granted, free of charge, to any person obtaining a copy
  9 kumpf 1.7 // of this software and associated documentation files (the "Software"), to
 10           // deal in the Software without restriction, including without limitation the
 11           // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 12 mike  1.2 // sell copies of the Software, and to permit persons to whom the Software is
 13           // furnished to do so, subject to the following conditions:
 14           // 
 15 kumpf 1.7 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 16 mike  1.2 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 17           // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 18 kumpf 1.7 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 19           // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 20           // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 21 mike  1.2 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 22           // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 23           //
 24           //==============================================================================
 25           //
 26           // Author: Mike Brasher (k.schopmeyer@opengroup.org)
 27           //
 28           // Modified By:
 29           //
 30           //%/////////////////////////////////////////////////////////////////////////////
 31           
 32 kumpf 1.5 #include <Pegasus/Common/Config.h>
 33           #include <Pegasus/Common/Constants.h>
 34 mike  1.2 #include <Pegasus/Common/HTTPAcceptor.h>
 35           #include <Pegasus/Common/FileSystem.h>
 36           #include <Pegasus/Common/HTTPConnection.h>
 37           #include <Pegasus/Common/HTTPMessage.h>
 38           
 39           #include "HTTPOptions.h"
 40           
 41           PEGASUS_NAMESPACE_BEGIN
 42           
 43           PEGASUS_USING_PEGASUS;
 44           PEGASUS_USING_STD;
 45           
 46           HTTPOptions::HTTPOptions()
 47 kumpf 1.5     : MessageQueue(PEGASUS_QUEUENAME_HTTPOPTIONS)
 48 mike  1.2 {
 49 mday  1.3 #error  "this class does not appear to be used" // <<< Sat Feb  9 17:33:07 2002 mdd >>>
 50 mike  1.2 }
 51           
 52           HTTPOptions::~HTTPOptions()
 53           {
 54           
 55           }
 56           
 57 mday  1.4 void HTTPOptions::handleEnqueue(Message *message)
 58           {
 59              if (message)
 60              {
 61                 if (message->getType() == HTTP_MESSAGE)
 62                 {
 63           	 handleHTTPMessage((HTTPMessage*)message);
 64                 }
 65           
 66                 //delete message;
 67              }
 68           }
 69           
 70 mike  1.2 void HTTPOptions::handleEnqueue()
 71           {
 72           
 73 mday  1.4    Message* message = dequeue();
 74              handleEnqueue(message);
 75              
 76 mike  1.2 }
 77           
 78           void HTTPOptions::handleHTTPMessage(HTTPMessage* httpMessage)
 79           {
 80            
 81 mday  1.4    // Save queueId:
 82 mike  1.2 
 83 mday  1.4    Uint32 queueId = httpMessage->queueId;
 84 mike  1.2 
 85 mday  1.4    // Parse the HTTP message:
 86              String startLine;
 87              Array<HTTPHeader> headers;
 88              Sint8* content;
 89              Uint32 contentLength;
 90 mike  1.2 
 91 mday  1.4    httpMessage->parse(startLine, headers, content, contentLength);
 92 mike  1.2     
 93 mday  1.4    // Parse the request line:
 94 mike  1.2 
 95 mday  1.4    String methodName;
 96              String requestUri;
 97              String httpVersion;
 98           
 99              HTTPMessage::parseRequestLine(
100                 startLine, methodName, requestUri, httpVersion);
101           
102              // Process M-POST and POST messages:
103           
104              if (methodName == "M-POST" || methodName == "POST")
105              {
106                 // Search for "CIMOperation" header:
107           
108                 String cimOperation;
109                 httpMessage->message.append('\0');
110           
111                 //SocketMessage* socketMessage = (SocketMessage*)httpMessage;
112           
113                 if (HTTPMessage::lookupHeader(
114 kumpf 1.6 	     headers, "CIMOperation", cimOperation, true))
115 mday  1.4       {
116           	 //_operationMessageQueue->enqueue(socketMessage);
117           	 _operationMessageQueue->enqueue(httpMessage);
118                 }
119                 else if (HTTPMessage::lookupHeader(
120 kumpf 1.6 		  headers, "CIMExport", cimOperation, true))
121 mday  1.4       {
122           	 //_exportMessageQueue->enqueue(socketMessage);
123           	 _exportMessageQueue->enqueue(httpMessage);
124                 }
125                 else
126                 {
127           	 // ATTN: error discarded at this time!
128           	 return;
129                 }
130 mike  1.2 
131 mday  1.4    }
132              // ATTN: KS Add the else here for Post, etc.  Also go to OPTIONS here.
133 mike  1.2 }
134           
135           
136           PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2