diff --git a/README.md b/README.md index d68a4cc786..82a85a2035 100755 --- a/README.md +++ b/README.md @@ -155,6 +155,7 @@ For previous versions, please read: ## V4 changes +* v4.0, 2020-11-11, For [#1508][bug #1508], Transform http header name to upper camel case. 4.0.54 * v4.0, 2020-11-06, For [#1657][bug #1657], Read cached data first in SSL. 4.0.48 * v4.0, 2020-11-06, For [#1657][bug #1657-3], support HTTPS Streaming(HTTPS-FLV, etc). 4.0.47 * v4.0, 2020-11-06, For [#1657][bug #1657-2], support HTTPS API. 4.0.46 diff --git a/trunk/src/core/srs_core_version4.hpp b/trunk/src/core/srs_core_version4.hpp index 51c1bf421c..b1c174c72e 100644 --- a/trunk/src/core/srs_core_version4.hpp +++ b/trunk/src/core/srs_core_version4.hpp @@ -24,6 +24,6 @@ #ifndef SRS_CORE_VERSION4_HPP #define SRS_CORE_VERSION4_HPP -#define SRS_VERSION4_REVISION 53 +#define SRS_VERSION4_REVISION 54 #endif diff --git a/trunk/src/protocol/srs_http_stack.cpp b/trunk/src/protocol/srs_http_stack.cpp index 48c1f456f2..591f1fde1b 100644 --- a/trunk/src/protocol/srs_http_stack.cpp +++ b/trunk/src/protocol/srs_http_stack.cpp @@ -154,6 +154,22 @@ SrsHttpHeader::~SrsHttpHeader() void SrsHttpHeader::set(string key, string value) { + // Convert to UpperCamelCase, for example: + // transfer-encoding + // transform to: + // Transfer-Encoding + char pchar = 0; + for (int i = 0; i < (int)key.length(); i++) { + char ch = key.at(i); + + if (i == 0 || pchar == '-') { + if (ch >= 'a' && ch <= 'z') { + ((char*)key.data())[i] = ch - 32; + } + } + pchar = ch; + } + headers[key] = value; }