正在显示
6 个修改的文件
包含
16 行增加
和
16 行删除
| @@ -169,7 +169,7 @@ int SrsHttpHandler::best_match(const char* path, int length, SrsHttpHandlerMatch | @@ -169,7 +169,7 @@ int SrsHttpHandler::best_match(const char* path, int length, SrsHttpHandlerMatch | ||
| 169 | } | 169 | } |
| 170 | 170 | ||
| 171 | const char* p = NULL; | 171 | const char* p = NULL; |
| 172 | - for (p = path + 1; p - path < length && *p != __PATH_SEP; p++) { | 172 | + for (p = path + 1; p - path < length && *p != SRS_CONSTS_HTTP_PATH_SEP; p++) { |
| 173 | } | 173 | } |
| 174 | 174 | ||
| 175 | // whether the handler can handler the node. | 175 | // whether the handler can handler the node. |
| @@ -541,7 +541,7 @@ SrsHttpMessage::SrsHttpMessage() | @@ -541,7 +541,7 @@ SrsHttpMessage::SrsHttpMessage() | ||
| 541 | _uri = new SrsHttpUri(); | 541 | _uri = new SrsHttpUri(); |
| 542 | _match = NULL; | 542 | _match = NULL; |
| 543 | _requires_crossdomain = false; | 543 | _requires_crossdomain = false; |
| 544 | - _http_ts_send_buffer = new char[SRS_CONSTS_HTTP_TS_SEND_BUFFER_SIZE]; | 544 | + _http_ts_send_buffer = new char[__SRS_HTTP_TS_SEND_BUFFER_SIZE]; |
| 545 | } | 545 | } |
| 546 | 546 | ||
| 547 | SrsHttpMessage::~SrsHttpMessage() | 547 | SrsHttpMessage::~SrsHttpMessage() |
| @@ -63,12 +63,7 @@ class SrsHttpHandler; | @@ -63,12 +63,7 @@ class SrsHttpHandler; | ||
| 63 | #define __SRS_CRLFCRLF "\r\n\r\n" // 0x0D0A0D0A | 63 | #define __SRS_CRLFCRLF "\r\n\r\n" // 0x0D0A0D0A |
| 64 | 64 | ||
| 65 | // @see SrsHttpMessage._http_ts_send_buffer | 65 | // @see SrsHttpMessage._http_ts_send_buffer |
| 66 | -#define SRS_CONSTS_HTTP_TS_SEND_BUFFER_SIZE 4096 | ||
| 67 | - | ||
| 68 | -// linux path seprator | ||
| 69 | -#define __PATH_SEP '/' | ||
| 70 | -// query string seprator | ||
| 71 | -#define __QUERY_SEP '?' | 66 | +#define __SRS_HTTP_TS_SEND_BUFFER_SIZE 4096 |
| 72 | 67 | ||
| 73 | // compare the path. | 68 | // compare the path. |
| 74 | // full compare, extractly match. | 69 | // full compare, extractly match. |
| @@ -272,7 +272,7 @@ int SrsHttpVhost::response_flv_file(SrsSocket* skt, SrsHttpMessage* req, string | @@ -272,7 +272,7 @@ int SrsHttpVhost::response_flv_file(SrsSocket* skt, SrsHttpMessage* req, string | ||
| 272 | 272 | ||
| 273 | while (left > 0) { | 273 | while (left > 0) { |
| 274 | ssize_t nread = -1; | 274 | ssize_t nread = -1; |
| 275 | - if ((ret = fs.read(buf, SRS_CONSTS_HTTP_TS_SEND_BUFFER_SIZE, &nread)) != ERROR_SUCCESS) { | 275 | + if ((ret = fs.read(buf, __SRS_HTTP_TS_SEND_BUFFER_SIZE, &nread)) != ERROR_SUCCESS) { |
| 276 | srs_warn("read file %s failed, ret=%d", fullpath.c_str(), ret); | 276 | srs_warn("read file %s failed, ret=%d", fullpath.c_str(), ret); |
| 277 | break; | 277 | break; |
| 278 | } | 278 | } |
| @@ -377,7 +377,7 @@ int SrsHttpVhost::response_flv_file2(SrsSocket* skt, SrsHttpMessage* req, string | @@ -377,7 +377,7 @@ int SrsHttpVhost::response_flv_file2(SrsSocket* skt, SrsHttpMessage* req, string | ||
| 377 | // send data | 377 | // send data |
| 378 | while (left > 0) { | 378 | while (left > 0) { |
| 379 | ssize_t nread = -1; | 379 | ssize_t nread = -1; |
| 380 | - if ((ret = fs.read(buf, SRS_CONSTS_HTTP_TS_SEND_BUFFER_SIZE, &nread)) != ERROR_SUCCESS) { | 380 | + if ((ret = fs.read(buf, __SRS_HTTP_TS_SEND_BUFFER_SIZE, &nread)) != ERROR_SUCCESS) { |
| 381 | return ret; | 381 | return ret; |
| 382 | } | 382 | } |
| 383 | 383 | ||
| @@ -427,7 +427,7 @@ int SrsHttpVhost::response_ts_file(SrsSocket* skt, SrsHttpMessage* req, string f | @@ -427,7 +427,7 @@ int SrsHttpVhost::response_ts_file(SrsSocket* skt, SrsHttpMessage* req, string f | ||
| 427 | 427 | ||
| 428 | while (left > 0) { | 428 | while (left > 0) { |
| 429 | ssize_t nread = -1; | 429 | ssize_t nread = -1; |
| 430 | - if ((ret = fs.read(buf, SRS_CONSTS_HTTP_TS_SEND_BUFFER_SIZE, &nread)) != ERROR_SUCCESS) { | 430 | + if ((ret = fs.read(buf, __SRS_HTTP_TS_SEND_BUFFER_SIZE, &nread)) != ERROR_SUCCESS) { |
| 431 | srs_warn("read file %s failed, ret=%d", fullpath.c_str(), ret); | 431 | srs_warn("read file %s failed, ret=%d", fullpath.c_str(), ret); |
| 432 | break; | 432 | break; |
| 433 | } | 433 | } |
| @@ -28,7 +28,7 @@ using namespace std; | @@ -28,7 +28,7 @@ using namespace std; | ||
| 28 | #include <srs_kernel_log.hpp> | 28 | #include <srs_kernel_log.hpp> |
| 29 | #include <srs_kernel_error.hpp> | 29 | #include <srs_kernel_error.hpp> |
| 30 | 30 | ||
| 31 | -#ifdef SRS_JSON_USE_NXJSON | 31 | +#ifdef __SRS_JSON_USE_NXJSON |
| 32 | 32 | ||
| 33 | //////////////////////////////////////////////////////////////////////////////////////////////// | 33 | //////////////////////////////////////////////////////////////////////////////////////////////// |
| 34 | //////////////////////////////////////////////////////////////////////////////////////////////// | 34 | //////////////////////////////////////////////////////////////////////////////////////////////// |
| @@ -303,7 +303,7 @@ SrsJsonArray* SrsJsonAny::array() | @@ -303,7 +303,7 @@ SrsJsonArray* SrsJsonAny::array() | ||
| 303 | return new SrsJsonArray(); | 303 | return new SrsJsonArray(); |
| 304 | } | 304 | } |
| 305 | 305 | ||
| 306 | -#ifdef SRS_JSON_USE_NXJSON | 306 | +#ifdef __SRS_JSON_USE_NXJSON |
| 307 | SrsJsonAny* srs_json_parse_tree_nx_json(const nx_json* node) | 307 | SrsJsonAny* srs_json_parse_tree_nx_json(const nx_json* node) |
| 308 | { | 308 | { |
| 309 | if (!node) { | 309 | if (!node) { |
| @@ -490,7 +490,7 @@ void SrsJsonArray::add(SrsJsonAny* value) | @@ -490,7 +490,7 @@ void SrsJsonArray::add(SrsJsonAny* value) | ||
| 490 | properties.push_back(value); | 490 | properties.push_back(value); |
| 491 | } | 491 | } |
| 492 | 492 | ||
| 493 | -#ifdef SRS_JSON_USE_NXJSON | 493 | +#ifdef __SRS_JSON_USE_NXJSON |
| 494 | 494 | ||
| 495 | //////////////////////////////////////////////////////////////////////////////////////////////// | 495 | //////////////////////////////////////////////////////////////////////////////////////////////// |
| 496 | //////////////////////////////////////////////////////////////////////////////////////////////// | 496 | //////////////////////////////////////////////////////////////////////////////////////////////// |
| @@ -34,8 +34,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -34,8 +34,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 34 | 34 | ||
| 35 | // whether use nxjson | 35 | // whether use nxjson |
| 36 | // @see: https://bitbucket.org/yarosla/nxjson | 36 | // @see: https://bitbucket.org/yarosla/nxjson |
| 37 | -#undef SRS_JSON_USE_NXJSON | ||
| 38 | -#define SRS_JSON_USE_NXJSON | 37 | +#undef __SRS_JSON_USE_NXJSON |
| 38 | +#define __SRS_JSON_USE_NXJSON | ||
| 39 | 39 | ||
| 40 | //////////////////////////////////////////////////////////////////////// | 40 | //////////////////////////////////////////////////////////////////////// |
| 41 | //////////////////////////////////////////////////////////////////////// | 41 | //////////////////////////////////////////////////////////////////////// |
| @@ -160,6 +160,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -160,6 +160,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 160 | /////////////////////////////////////////////////////////// | 160 | /////////////////////////////////////////////////////////// |
| 161 | // HTTP consts values | 161 | // HTTP consts values |
| 162 | /////////////////////////////////////////////////////////// | 162 | /////////////////////////////////////////////////////////// |
| 163 | +// linux path seprator | ||
| 164 | +#define SRS_CONSTS_HTTP_PATH_SEP '/' | ||
| 165 | +// query string seprator | ||
| 166 | +#define SRS_CONSTS_HTTP_QUERY_SEP '?' | ||
| 167 | + | ||
| 163 | // 6.1.1 Status Code and Reason Phrase | 168 | // 6.1.1 Status Code and Reason Phrase |
| 164 | #define SRS_CONSTS_HTTP_Continue 100 | 169 | #define SRS_CONSTS_HTTP_Continue 100 |
| 165 | #define SRS_CONSTS_HTTP_SwitchingProtocols 101 | 170 | #define SRS_CONSTS_HTTP_SwitchingProtocols 101 |
-
请 注册 或 登录 后发表评论