Changeset 16717 for gsdl/trunk/runtime-src/src
- Timestamp:
- 2008-08-12T12:37:34+12:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gsdl/trunk/runtime-src/src/oaiservr/listsetsaction.cpp
r16708 r16717 12 12 bool listsetsaction::validateAction(recptproto *protocol, oaiargs ¶ms) 13 13 { 14 int params_size = params.getSize(); 15 16 // Remove any parameters that aren't valid for this action 14 // ---------------------------------------------------------------------------- 15 // 1. Check for invalid arguments 16 // ---------------------------------------------------------------------------- 17 bool invalid_argument_supplied = false; 17 18 text_tmap::const_iterator param_iterator = params.begin(); 18 19 while (param_iterator != params.end()) 19 20 { 20 if (param_iterator->first != "verb" && param_iterator->first != "resumptionToken") 21 { 21 // Check for arguments that aren't valid for this action 22 if (param_iterator->first != "verb" && 23 param_iterator->first != "resumptionToken") 24 { 25 // We've found an invalid argument 26 invalid_argument_supplied = true; 27 28 // Delete the invalid argument from the list so it doesn't end up in the <request> tag that is returned 22 29 params.erase(param_iterator->first); 23 30 } … … 26 33 } 27 34 28 if (params_size != params.getSize()) { 35 // If we found an invalid argument it's an error, so don't go any further 36 if (invalid_argument_supplied) 37 { 29 38 this->errorType = "badArgument"; 30 39 return false; 31 40 } 32 41 33 if (params["resumptionToken"] != "") { 42 // ---------------------------------------------------------------------------- 43 // 2. Handle any exclusive arguments 44 // ---------------------------------------------------------------------------- 45 46 // The resumptionToken argument is exclusive 47 if (params["resumptionToken"] != "") 48 { 49 // This argument is exclusive, so no other arguments are allowed (except "verb" of course) 50 if (params.getSize() != 2) 51 { 52 this->errorType = "badArgument"; 53 return false; 54 } 55 56 // Check the resumption token is valid 34 57 ResumptionToken token(params["resumptionToken"]); 35 // TO DO: Resumption token validation checking (the token.isValid() function is useless for ListSets) 36 // if (!token.isValid()) { 37 // this->errorType = "badResumptionToken"; 38 // return false; 39 // } 40 } 41 58 if (true) // TO DO: Fix this (the token.isValid() function is useless for ListSets) 59 { 60 // Everything is fine, and we don't continue further because this is an exclusive argument 61 this->errorType = ""; 62 return true; 63 } 64 else 65 { 66 // There was an error with the resumption token 67 this->errorType = "badResumptionToken"; 68 return false; 69 } 70 } 71 72 // ---------------------------------------------------------------------------- 73 // 3. Handle any required arguments 74 // ---------------------------------------------------------------------------- 75 76 // None! 77 78 // ---------------------------------------------------------------------------- 79 // 4. Check any remaining arguments 80 // ---------------------------------------------------------------------------- 81 82 // None! 83 84 // If we've reached here everything must be fine 85 this->errorType = ""; 42 86 return true; 43 87 }
Note:
See TracChangeset
for help on using the changeset viewer.