diff --git a/buffet/http_utils.cc b/buffet/http_utils.cc
new file mode 100644
index 0000000..a921386
--- /dev/null
+++ b/buffet/http_utils.cc
@@ -0,0 +1,88 @@
+// Copyright 2014 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "buffet/http_utils.h"
+
+#include <algorithm>
+#include <string.h>
+#include <base/values.h>
+#include <base/json/json_reader.h>
+#include <base/json/json_writer.h>
+
+#include "mime_utils.h"
+
+namespace chromeos {
+namespace http {
+
+std::unique_ptr<Response> Get(char const* url) {
+  Request request(url);
+  return request.GetResponse();
+}
+
+std::string GetAsString(char const* url) {
+  auto resp = Get(url);
+  return resp ? resp->GetDataAsString() : std::string();
+}
+
+std::unique_ptr<Response> Head(char const* url) {
+  Request request(url, request_type::kHead);
+  return request.GetResponse();
+}
+
+std::unique_ptr<Response> PostText(char const* url,
+                                   char const* data,
+                                   char const* mime_type) {
+  if (mime_type == nullptr) {
+    mime_type = chromeos::mime::application::kWwwFormUrlEncoded;
+  }
+
+  return PostBinary(url, data, strlen(data), mime_type);
+}
+
+std::unique_ptr<Response> PostBinary(char const* url, void const* data,
+                                     size_t data_size, char const* mime_type) {
+  if (mime_type == nullptr) {
+    mime_type = chromeos::mime::application::kOctet_stream;
+  }
+
+  Request request(url, request_type::kPost);
+  request.SetContentType(mime_type);
+  request.AddRequestBody(data, data_size);
+  return request.GetResponse();
+}
+
+std::unique_ptr<Response> PostJson(char const* url, base::Value const* json) {
+  std::string data;
+  base::JSONWriter::Write(json, &data);
+  return PostBinary(url, data.c_str(), data.size(), mime::application::kJson);
+}
+
+std::unique_ptr<base::Value> ParseJsonResponse(Response const* response,
+                                               std::string* error_message) {
+  std::unique_ptr<base::Value> value;
+  if (response) {
+    if (response->IsSuccessful()) {
+      // Make sure we have a correct content type. Do not try to parse
+      // binary files, or HTML output. Limit to application/json and text/plain.
+      auto content_type = mime::RemoveParameters(response->GetContentType());
+      if (content_type == mime::application::kJson ||
+          content_type == mime::text::kPlain) {
+        std::string json = response->GetDataAsString();
+        value.reset(base::JSONReader::ReadAndReturnError(json,
+                                                         base::JSON_PARSE_RFC,
+                                                         nullptr,
+                                                         error_message));
+      }
+      else if (error_message) {
+        *error_message = "Unexpected response content type: " + content_type;
+      }
+    }
+  } else if (error_message) {
+    *error_message = "NULL response.";
+  }
+  return value;
+}
+
+} // namespace http
+} // namespace chromeos
