This is a POST data encoding and decoding function #pragma Warning (Disable: 4786) #include #include #include #include
Here ignore the legality verification if (* p == ' ') RS = '; ELSE IF (* p ==%') { P; if (p == end) return ret; char C1 = * p - '0'; if (c1> 9) C1 - = 7; p; if (p == end) return return; CHAR C2 = * P - '0'; IF (C2> 9) C2 - = 7; RS = ((C1 << 4) | C2);} Else RS = * P;} Ret.First = true; return ret;} const pair post_decode (const string & sc) { Return Post_Decode (Scr.Begin (), Scr.End ());} // Decoding the entire POST Const Pair > post_decodes (const string :: const_iterator & begin, const string :: const_iterator & End; {pair > ret; ret.first = false; map & hs = ret.second; string :: const_iterator p = begin, p1 = begin, p2 = begin For (; p! = End; p) {if (* p == '=') {p2 = p;} else if (* p == '&') {if (p1> = p2) / / ERROR RETURN RET; Const Pair _key = post_decode (p1, p2); if (! _key.first || _key.second.empty ()) Return Ret; P2; Const Pair _val = post_decode (p2, p); IF (! _val.first) return ret; p1 = p; p1; hs [_key.second] = _val.second;}} = f (p2! = begin) {IF (p1> = p2) // error Return Ret;