Update engine properly sets Content-Type to text/xml.
Since the payload sent to Omaha is XML encoded, update engine should
properly set the HTTP Content-Type header to text/xml, instead of using
the libcurl default (application/x-www-form-urlencoded).
BUG=chromium-os:7613
TEST=Tested against devserver, ensuring that Content-Type is set
correctly
Change-Id: I9766e8dd67ffd387634a0ab4ef83c2990b16b537
Reviewed-on: https://gerrit.chromium.org/gerrit/16051
Reviewed-by: Andrew de los Reyes <adlr@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Commit-Ready: Gilad Arnold <garnold@chromium.org>
diff --git a/http_fetcher.h b/http_fetcher.h
index 46f6903..2ca6fe2 100644
--- a/http_fetcher.h
+++ b/http_fetcher.h
@@ -14,6 +14,7 @@
#include <glib.h>
#include <google/protobuf/stubs/common.h>
+#include "http_common.h"
#include "update_engine/proxy_resolver.h"
// This class is a simple wrapper around an HTTP library (libcurl). We can
@@ -47,7 +48,11 @@
int http_response_code() const { return http_response_code_; }
// Optional: Post data to the server. The HttpFetcher should make a copy
- // of this data and upload it via HTTP POST during the transfer.
+ // of this data and upload it via HTTP POST during the transfer. The type of
+ // the data is necessary for properly setting the Content-Type HTTP header.
+ void SetPostData(const void* data, size_t size, HttpContentType type);
+
+ // Same without a specified Content-Type.
void SetPostData(const void* data, size_t size);
// Proxy methods to set the proxies, then to pop them off.
@@ -111,6 +116,7 @@
// POST data for the transfer, and whether or not it was ever set
bool post_data_set_;
std::vector<char> post_data_;
+ HttpContentType post_content_type_;
// The server's HTTP response code from the last transfer. This
// field should be set to 0 when a new transfer is initiated, and