update_engine: use ; delimiter
Since HTTP host header can take the form of `HOST = <host>:<port>` using
a : delimiter will result in incorrect key value parsing. Swapping out :
for ; in order to ensure our key value delimiter doesn't interfere with
HTTP header formats.
Bug: 355109876
Test: th
Change-Id: I060c93fd21a3359051c24b4303d587040d9f6949
diff --git a/aosp/update_attempter_android.cc b/aosp/update_attempter_android.cc
index 909ce59..857685f 100644
--- a/aosp/update_attempter_android.cc
+++ b/aosp/update_attempter_android.cc
@@ -391,11 +391,11 @@
auto entries =
android::base::Split(headers[kPayloadPropertyHTTPExtras], " ");
for (auto& entry : entries) {
- auto parts = android::base::Split(entry, ":");
+ auto parts = android::base::Split(entry, ";");
if (parts.size() != 2) {
LOG(ERROR)
<< "HTTP headers are not in expected format. "
- "headers[kPayloadPropertyHTTPExtras] = key1:val1 key2:val2";
+ "headers[kPayloadPropertyHTTPExtras] = key1;val1 key2;val2";
continue;
}
fetcher->SetHeader(parts[0], parts[1]);
diff --git a/common/constants.h b/common/constants.h
index 6b1bf6b..dcd181f 100644
--- a/common/constants.h
+++ b/common/constants.h
@@ -163,7 +163,7 @@
static constexpr const auto& kPayloadPropertyMetadataHash = "METADATA_HASH";
// The Authorization: HTTP header to be sent when downloading the payload.
static constexpr const auto& kPayloadPropertyAuthorization = "AUTHORIZATION";
-// HTTP headers extra entries in the format of key1:val1 key2:val2 key3:val3
+// HTTP headers extra entries in the format of key1;val1 key2;val2 key3;val3
static constexpr const auto& kPayloadPropertyHTTPExtras = "HTTP_EXTRAS";
// The User-Agent HTTP header to be sent when downloading the payload.
static constexpr const auto& kPayloadPropertyUserAgent = "USER_AGENT";