Changeset 15198
- Timestamp:
- 2008-04-17T13:52:05+12:00 (16 years ago)
- Location:
- gsdl/trunk/src/oaiservr
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
gsdl/trunk/src/oaiservr/abstractlistaction.cpp
r11733 r15198 6 6 bool abstractlistaction::validateAction(recptproto *protocol, oaiargs ¶ms, int &numArgs) 7 7 { 8 // Remove any parameters that aren't valid for this action 9 text_tmap::const_iterator param_iterator = params.begin(); 10 while (param_iterator != params.end()) 11 { 12 if (param_iterator->first != "verb" && 13 param_iterator->first != "from" && 14 param_iterator->first != "until" && 15 param_iterator->first != "set" && 16 param_iterator->first != "resumptionToken" && 17 param_iterator->first != "metadataPrefix") 18 { 19 params.erase(param_iterator->first); 20 } 21 22 param_iterator++; 23 } 24 8 25 text_t from = params["from"]; 9 26 text_t until = params["until"]; … … 19 36 if(from.size() != 10){ 20 37 this->errorType = "badArgument"; 21 return false;38 params.erase("from"); 22 39 } 23 40 else{ 24 41 if(from[4] != '-' || from[7] != '-'){ 25 42 this->errorType = "badArgument"; 26 return false;43 params.erase("from"); 27 44 } 28 45 } … … 34 51 if(until.size() != 10){ 35 52 this->errorType = "badArgument"; 36 return false;53 params.erase("until"); 37 54 } 38 55 else{ 39 56 if(until[4] != '-' || until[7] != '-'){ 40 57 this->errorType = "badArgument"; 41 return false;58 params.erase("until"); 42 59 } 43 60 } 44 61 ++numArgs; // Increase valid args count 62 } 63 64 if (this->errorType == "badArgument") 65 { 66 return false; 45 67 } 46 68 -
gsdl/trunk/src/oaiservr/identityaction.cpp
r15193 r15198 4 4 bool identityaction::validateAction(recptproto *protocol, oaiargs ¶ms) 5 5 { 6 int params_size = params.getSize(); 7 8 // Remove any parameters that aren't valid for this action 9 text_tmap::const_iterator param_iterator = params.begin(); 10 while (param_iterator != params.end()) 11 { 12 if (param_iterator->first != "verb") 13 { 14 params.erase(param_iterator->first); 15 } 16 17 param_iterator++; 18 } 19 6 20 //"Verb=Identify" should be the only parameter - if there are others, throw an error. 7 21 // Don't need to check that the param we have is "Verb=Identify", as it has to be to get to here. 8 9 if(params.getSize() != 1){ 22 if(params_size != 1){ 10 23 this->errorType = "badArgument"; 11 24 return false; -
gsdl/trunk/src/oaiservr/listidsaction.cpp
r8310 r15198 7 7 bool listidsaction::validateAction(recptproto *protocol, oaiargs ¶ms) 8 8 { 9 int params_size = params.getSize(); 9 10 int numArgs = 1; // For "verb" arg 10 11 … … 15 16 // In OAI v1.1 metadataPrefix is not allowed. 16 17 if (this->configuration->getOAIVersion() <= 110){ 17 if(numArgs != params .getSize()){18 if(numArgs != params_size){ 18 19 this->errorType = "badArgument"; 19 20 return false; … … 27 28 } 28 29 else { // If it isn't empty, increase the valid args count and compare this to the total num of args 29 if (++numArgs != params .getSize()){30 if (++numArgs != params_size){ 30 31 this->errorType = "badArgument"; 31 32 return false; -
gsdl/trunk/src/oaiservr/listrecsaction.cpp
r9608 r15198 6 6 bool listrecsaction::validateAction(recptproto *protocol, oaiargs ¶ms) 7 7 { 8 int params_size = params.getSize(); 9 8 10 text_t meta = params["metadataPrefix"]; 9 11 int numArgs = 1; // 1st arg (Verb=ListRecords) must be present for us to be here … … 26 28 // The number of valid args should be exactly equal to the number of args actually there. 27 29 // If not, throw a 'badArgument' error. 28 if (numArgs != params .getSize()) {30 if (numArgs != params_size) { 29 31 this->errorType = "badArgument"; 30 32 return false; -
gsdl/trunk/src/oaiservr/listsetsaction.cpp
r11311 r15198 11 11 12 12 bool listsetsaction::validateAction(recptproto *protocol, oaiargs ¶ms) 13 { if(params.getSize() != 1){ 13 { 14 int params_size = params.getSize(); 15 16 // Remove any parameters that aren't valid for this action 17 text_tmap::const_iterator param_iterator = params.begin(); 18 while (param_iterator != params.end()) 19 { 20 if (param_iterator->first != "verb") 21 { 22 params.erase(param_iterator->first); 23 } 24 25 param_iterator++; 26 } 27 28 if(params_size != 1){ 14 29 this->errorType = "badArgument"; 15 30 return false; -
gsdl/trunk/src/oaiservr/metaformatsaction.cpp
r9608 r15198 5 5 bool metaformatsaction::validateAction(recptproto *protocol, oaiargs ¶ms) 6 6 { 7 int params_size = params.getSize(); 8 9 // Remove any parameters that aren't valid for this action 10 text_tmap::const_iterator param_iterator = params.begin(); 11 while (param_iterator != params.end()) 12 { 13 if (param_iterator->first != "verb" && 14 param_iterator->first != "identifier") 15 { 16 params.erase(param_iterator->first); 17 } 18 19 param_iterator++; 20 } 21 7 22 int numArgs = 1; // the number of expected arguments 8 23 … … 15 30 // If the total number of params isn't equal to the number of valid 16 31 // args (i.e. we have an arg but it isn't the identifier), throw an error 17 if((params .getSize()!= numArgs)){32 if((params_size != numArgs)){ 18 33 this->errorType = "badArgument"; 19 34 return false; -
gsdl/trunk/src/oaiservr/recordaction.cpp
r11311 r15198 29 29 30 30 bool recordaction::validateAction(recptproto *protocol, oaiargs ¶ms) 31 { text_t meta = params["metadataPrefix"]; 31 { 32 int params_size = params.getSize(); 33 34 // Remove any parameters that aren't valid for this action 35 text_tmap::const_iterator param_iterator = params.begin(); 36 while (param_iterator != params.end()) 37 { 38 if (param_iterator->first != "verb" && 39 param_iterator->first != "identifier" && 40 param_iterator->first != "metadataPrefix") 41 { 42 params.erase(param_iterator->first); 43 } 44 45 param_iterator++; 46 } 47 48 text_t meta = params["metadataPrefix"]; 32 49 text_t gsdlId = params["identifier"]; 33 50 text_t gsdlCollect; … … 37 54 // The identifier and metadataPrefix args MUST be supplied, and are the only 38 55 // args allowed (excluding verb arg). If we don't have them, throw an error. 39 if(gsdlId == "" || meta == "" || params .getSize()!= 3){56 if(gsdlId == "" || meta == "" || params_size != 3){ 40 57 this->errorType = "badArgument"; 41 58 return false;
Note:
See TracChangeset
for help on using the changeset viewer.