diff --git a/lib/cpp/src/thrift/transport/THttpServer.cpp b/lib/cpp/src/thrift/transport/THttpServer.cpp index 705e34aed09..a20d612ed47 100644 --- a/lib/cpp/src/thrift/transport/THttpServer.cpp +++ b/lib/cpp/src/thrift/transport/THttpServer.cpp @@ -23,6 +23,9 @@ #include #include +#ifdef _MSC_VER +#include +#endif namespace apache { namespace thrift { @@ -36,6 +39,14 @@ THttpServer::THttpServer(boost::shared_ptr transport) : THttpTranspo THttpServer::~THttpServer() { } +#ifdef _MSC_VER + #define THRIFT_strncasecmp(str1, str2, len) _strnicmp(str1, str2, len) + #define THRIFT_strcasestr(haystack, needle) StrStrIA(haystack, needle) +#else + #define THRIFT_strncasecmp(str1, str2, len) strncasecmp(str1, str2, len) + #define THRIFT_strcasestr(haystack, needle) strcasestr(haystack, needle) +#endif + void THttpServer::parseHeader(char* header) { char* colon = strchr(header, ':'); if (colon == NULL) { @@ -44,11 +55,11 @@ void THttpServer::parseHeader(char* header) { size_t sz = colon - header; char* value = colon + 1; - if (strncasecmp(header, "Transfer-Encoding", sz) == 0) { - if (strcasestr(value, "chunked") != NULL) { + if (THRIFT_strncasecmp(header, "Transfer-Encoding", sz) == 0) { + if (THRIFT_strcasestr(value, "chunked") != NULL) { chunked_ = true; } - } else if (strncasecmp(header, "Content-length", sz) == 0) { + } else if (THRIFT_strncasecmp(header, "Content-length", sz) == 0) { chunked_ = false; contentLength_ = atoi(value); } else if (strncmp(header, "X-Forwarded-For", sz) == 0) { diff --git a/lib/cpp/src/thrift/windows/config.h b/lib/cpp/src/thrift/windows/config.h index dd0da3572da..24a94f86fc4 100644 --- a/lib/cpp/src/thrift/windows/config.h +++ b/lib/cpp/src/thrift/windows/config.h @@ -94,5 +94,6 @@ typedef boost::uint8_t uint8_t; #else #pragma comment(lib, "Ws2_32.lib") #pragma comment(lib, "advapi32.lib") // For security APIs in TPipeServer +#pragma comment(lib, "Shlwapi.lib") // For StrStrIA in TPipeServer #endif #endif // _THRIFT_WINDOWS_CONFIG_H_