rgw: Fix potential null pointer dereferences where `RGWEnv::get()` is called
Here are the changes I've made:
- Added `RGWEnv::get_optional` with the similar implementation to the `RGWHTTPArgs::get_optional`
- Replaced `RGWEnv::get` in the RGW code where null pointer derefence happens with `RGWEnv::get_optional` as long as it accepts `std::string`
- Otherwise if calling function of `RGWEnv::get` accepts `char*` I leave it as it is
- Added null pointer checks to avoid the null pointer dereference
This commit addresses the following Coverity CIDs:
- "
1510310"
- "
1510928"
- "
1511097"
- "
1511555"
- "
1511760"
- "
1511951"
- "
1512003"
- "
1512138"
- "
1512398"
Fixes: https://tracker.ceph.com/issues/57347
Signed-off-by: Mohamed Awnallah <mohamedmohey2352@gmail.com>
(cherry picked from commit
b8cb558cc35d9fb5c47372a79c6249207a964245)