1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

For #1508, Transform http header name to upper camel case. 4.0.54

This commit is contained in:
winlin 2020-11-11 16:38:05 +08:00
parent 07c04a042a
commit 9908433bc8
3 changed files with 18 additions and 1 deletions

View file

@ -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

View file

@ -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

View file

@ -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;
}