THRIFT-1030 C++ THttpTransport doesn't support chucked transfer encoding
Patch: Rowan Kerr
git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1075399 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cpp/src/transport/THttpClient.cpp b/lib/cpp/src/transport/THttpClient.cpp
index 604df0d..d783351 100644
--- a/lib/cpp/src/transport/THttpClient.cpp
+++ b/lib/cpp/src/transport/THttpClient.cpp
@@ -19,6 +19,7 @@
#include <cstdlib>
#include <sstream>
+#include <boost/algorithm/string.hpp>
#include <transport/THttpClient.h>
#include <transport/TSocket.h>
@@ -45,11 +46,11 @@
uint32_t sz = colon - header;
char* value = colon+1;
- if (strncmp(header, "Transfer-Encoding", sz) == 0) {
- if (strstr(value, "chunked") != NULL) {
+ if (boost::istarts_with(header, "Transfer-Encoding")) {
+ if (boost::iends_with(value, "chunked")) {
chunked_ = true;
}
- } else if (strncmp(header, "Content-Length", sz) == 0) {
+ } else if (boost::istarts_with(header, "Content-Length")) {
chunked_ = false;
contentLength_ = atoi(value);
}