Skip to content

Commit

Permalink
For #1508, Transform http header name to upper camel case. 4.0.54
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Nov 11, 2020
1 parent 07c04a0 commit 9908433
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion trunk/src/core/srs_core_version4.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
16 changes: 16 additions & 0 deletions trunk/src/protocol/srs_http_stack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 9908433

Please # to comment.