blob: 7f0de6715cc180f663019893405edfb05ce6d9ee [file] [edit]
#ifndef THIRD_PARTY_MILOTIC_INTERNAL_CC_PROXY_UTILS_URL_H_
#define THIRD_PARTY_MILOTIC_INTERNAL_CC_PROXY_UTILS_URL_H_
#include <string>
#include "absl/status/statusor.h"
#include "absl/strings/string_view.h"
namespace milotic {
// Decodes a URL-encoded string by converting hex sequences (e.g. %24 to $,
// %3D to =) back to their character representation.
std::string UrlDecode(absl::string_view encoded);
// Normalizes a full Redfish URL, resolving path traversal in the path part
// while keeping query parameters intact.
// Returns an error if the path contains invalid characters (e.g. delimiters).
absl::StatusOr<std::string> SanitizeUrl(absl::string_view redfish_id);
} // namespace milotic
#endif // THIRD_PARTY_MILOTIC_INTERNAL_CC_PROXY_UTILS_URL_H_