log_services: Add download of post code log entries

- Add a GET method /redfish/v1/Systems/system/LogServices/PostCodes
  /Entries/<str>/attachment/, Get the attribute value through the
  getPostCodes method and encode it as base64, and send it off.

- This allows the use to offload error logs for analysis and further
  parsing if needed. An http header of "Accept:
  application/octet-stream" or the default "*/*" is expected.

Tested:
- Ran Redfish validator.

- Before, It broke post JSON content as HTTP
  https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/44660
  Now, I tested it passed.

- pldmtool raw --data 0x80 0x3F 0xC 0x0A 0x00 0x00 0x00 0x00 0x00 0x07 0x00 0x00 0x00 0x48 0x00 0x00 0x00 0x02 0x00 0x00 0x01 0x00 0x00 0x00 0x48 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x53 0x54 0x41 0x4e 0x44 0x42 0x59 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20

$curl -k https://127.0.0.1:2443/redfish/v1/Systems/system/LogServices/PostCodes/Entries/B1-1/attachment/
output:
AgAAAQAAAEgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFNUQU5EQlkgICAgICAgICAgICAgICAgICAgICAgICAg

Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: Ide684146a4ae9d55dc95fb765927867b042fc27c
diff --git a/include/http_utility.hpp b/include/http_utility.hpp
index ef65e23..740e218 100644
--- a/include/http_utility.hpp
+++ b/include/http_utility.hpp
@@ -5,14 +5,20 @@
 
 namespace http_helpers
 {
-inline bool requestPrefersHtml(std::string_view header)
+inline std::vector<std::string> parseAccept(std::string_view header)
 {
     std::vector<std::string> encodings;
     // chrome currently sends 6 accepts headers, firefox sends 4.
     encodings.reserve(6);
     boost::split(encodings, header, boost::is_any_of(", "),
                  boost::token_compress_on);
-    for (const std::string& encoding : encodings)
+
+    return encodings;
+}
+
+inline bool requestPrefersHtml(std::string_view header)
+{
+    for (const std::string& encoding : parseAccept(header))
     {
         if (encoding == "text/html")
         {
@@ -26,6 +32,18 @@
     return false;
 }
 
+inline bool isOctetAccepted(std::string_view header)
+{
+    for (const std::string& encoding : parseAccept(header))
+    {
+        if (encoding == "*/*" || encoding == "application/octet-stream")
+        {
+            return true;
+        }
+    }
+    return false;
+}
+
 inline std::string urlEncode(const std::string_view value)
 {
     std::ostringstream escaped;