|
|
| version 1.262, 2024/12/11 02:30:24 | version 1.263, 2025/10/05 19:41:27 |
|---|---|
| Line 690 static void _trim(Request& r, MethodPara | Line 690 static void _trim(Request& r, MethodPara |
| Base64Options base64_encode_options(Request& r, HashStringValue* options) { | Base64Options base64_encode_options(Request& r, HashStringValue* options) { |
| Base64Options result; | Base64Options result; |
| if(options) { | if(options) { |
| int valid_options=0; | |
| for(HashStringValue::Iterator i(*options); i; i.next()) { | for(HashStringValue::Iterator i(*options); i; i.next()) { |
| String::Body key=i.key(); | String::Body key=i.key(); |
| Value* value=i.value(); | Value* value=i.value(); |
| if(key == "pad") { | if(key == "pad") { |
| result.pad=r.process(*value).as_bool(); | result.pad=r.process(*value).as_bool(); |
| valid_options++; | |
| } else if(key == "wrap") { | } else if(key == "wrap") { |
| result.wrap=r.process(*value).as_bool(); | result.wrap=r.process(*value).as_bool(); |
| valid_options++; | |
| } else if(key == "url-safe") { | } else if(key == "url-safe") { |
| if(r.process(*value).as_bool()) | if(r.process(*value).as_bool()) |
| result.set_url_safe_abc(); | result.set_url_safe_abc(); |
| valid_options++; | } else |
| } | throw Exception(PARSER_RUNTIME, 0, CALLED_WITH_INVALID_OPTION); |
| } | } |
| if(valid_options != options->count()) | |
| throw Exception(PARSER_RUNTIME, 0, CALLED_WITH_INVALID_OPTION); | |
| } | } |
| return result; | return result; |
| } | } |
| Line 716 Base64Options base64_encode_options(Requ | Line 710 Base64Options base64_encode_options(Requ |
| Base64Options base64_decode_options(Request& r, HashStringValue* options) { | Base64Options base64_decode_options(Request& r, HashStringValue* options) { |
| Base64Options result; | Base64Options result; |
| if(options) { | if(options) { |
| int valid_options=0; | |
| for(HashStringValue::Iterator i(*options); i; i.next() ) { | for(HashStringValue::Iterator i(*options); i; i.next() ) { |
| String::Body key=i.key(); | String::Body key=i.key(); |
| Value* value=i.value(); | Value* value=i.value(); |
| if(key == "pad") { | if(key == "pad") { |
| result.pad=r.process(*value).as_bool(); | result.pad=r.process(*value).as_bool(); |
| valid_options++; | |
| } else if(key == "strict") { | } else if(key == "strict") { |
| result.strict=r.process(*value).as_bool(); | result.strict=r.process(*value).as_bool(); |
| valid_options++; | |
| } else if(key == "url-safe") { | } else if(key == "url-safe") { |
| if(r.process(*value).as_bool()) | if(r.process(*value).as_bool()) |
| result.set_url_safe_abc(); | result.set_url_safe_abc(); |
| valid_options++; | } else |
| } | throw Exception(PARSER_RUNTIME, 0, CALLED_WITH_INVALID_OPTION); |
| } | } |
| if(valid_options != options->count()) | |
| throw Exception(PARSER_RUNTIME, 0, CALLED_WITH_INVALID_OPTION); | |
| } | } |
| return result; | return result; |
| } | } |