Fixed headers parsing in CurlHttpClient
1. substr(pos, pos_end) was used instead of substr(pos, pos_end - pos)
2. CURLOPT_HEADERFUNCTION is called for single header so no need to
merge and split them later
Change-Id: Iad852212258f870c2fe0683b0021ae99a020d12b
Reviewed-on: https://weave-review.googlesource.com/1562
Reviewed-by: Vitaly Buka <vitalybuka@google.com>
diff --git a/src/device_registration_info.cc b/src/device_registration_info.cc
index d2b10a9..8b8e752 100644
--- a/src/device_registration_info.cc
+++ b/src/device_registration_info.cc
@@ -201,9 +201,9 @@
SplitAtFirst(response.GetContentType(), ";", true).first;
if (content_type != http::kJson && content_type != http::kPlain) {
- Error::AddTo(error, FROM_HERE, errors::json::kDomain,
- "non_json_content_type",
- "Unexpected response content type: " + content_type);
+ Error::AddTo(
+ error, FROM_HERE, errors::json::kDomain, "non_json_content_type",
+ "Unexpected content type: \'" + response.GetContentType() + "\'");
return std::unique_ptr<base::DictionaryValue>();
}