mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
refine consts.
This commit is contained in:
parent
2667815123
commit
1afa6ed607
6 changed files with 16 additions and 16 deletions
|
@ -169,7 +169,7 @@ int SrsHttpHandler::best_match(const char* path, int length, SrsHttpHandlerMatch
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* p = NULL;
|
const char* p = NULL;
|
||||||
for (p = path + 1; p - path < length && *p != __PATH_SEP; p++) {
|
for (p = path + 1; p - path < length && *p != SRS_CONSTS_HTTP_PATH_SEP; p++) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// whether the handler can handler the node.
|
// whether the handler can handler the node.
|
||||||
|
@ -541,7 +541,7 @@ SrsHttpMessage::SrsHttpMessage()
|
||||||
_uri = new SrsHttpUri();
|
_uri = new SrsHttpUri();
|
||||||
_match = NULL;
|
_match = NULL;
|
||||||
_requires_crossdomain = false;
|
_requires_crossdomain = false;
|
||||||
_http_ts_send_buffer = new char[SRS_CONSTS_HTTP_TS_SEND_BUFFER_SIZE];
|
_http_ts_send_buffer = new char[__SRS_HTTP_TS_SEND_BUFFER_SIZE];
|
||||||
}
|
}
|
||||||
|
|
||||||
SrsHttpMessage::~SrsHttpMessage()
|
SrsHttpMessage::~SrsHttpMessage()
|
||||||
|
|
|
@ -63,12 +63,7 @@ class SrsHttpHandler;
|
||||||
#define __SRS_CRLFCRLF "\r\n\r\n" // 0x0D0A0D0A
|
#define __SRS_CRLFCRLF "\r\n\r\n" // 0x0D0A0D0A
|
||||||
|
|
||||||
// @see SrsHttpMessage._http_ts_send_buffer
|
// @see SrsHttpMessage._http_ts_send_buffer
|
||||||
#define SRS_CONSTS_HTTP_TS_SEND_BUFFER_SIZE 4096
|
#define __SRS_HTTP_TS_SEND_BUFFER_SIZE 4096
|
||||||
|
|
||||||
// linux path seprator
|
|
||||||
#define __PATH_SEP '/'
|
|
||||||
// query string seprator
|
|
||||||
#define __QUERY_SEP '?'
|
|
||||||
|
|
||||||
// compare the path.
|
// compare the path.
|
||||||
// full compare, extractly match.
|
// full compare, extractly match.
|
||||||
|
|
|
@ -272,7 +272,7 @@ int SrsHttpVhost::response_flv_file(SrsSocket* skt, SrsHttpMessage* req, string
|
||||||
|
|
||||||
while (left > 0) {
|
while (left > 0) {
|
||||||
ssize_t nread = -1;
|
ssize_t nread = -1;
|
||||||
if ((ret = fs.read(buf, SRS_CONSTS_HTTP_TS_SEND_BUFFER_SIZE, &nread)) != ERROR_SUCCESS) {
|
if ((ret = fs.read(buf, __SRS_HTTP_TS_SEND_BUFFER_SIZE, &nread)) != ERROR_SUCCESS) {
|
||||||
srs_warn("read file %s failed, ret=%d", fullpath.c_str(), ret);
|
srs_warn("read file %s failed, ret=%d", fullpath.c_str(), ret);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -377,7 +377,7 @@ int SrsHttpVhost::response_flv_file2(SrsSocket* skt, SrsHttpMessage* req, string
|
||||||
// send data
|
// send data
|
||||||
while (left > 0) {
|
while (left > 0) {
|
||||||
ssize_t nread = -1;
|
ssize_t nread = -1;
|
||||||
if ((ret = fs.read(buf, SRS_CONSTS_HTTP_TS_SEND_BUFFER_SIZE, &nread)) != ERROR_SUCCESS) {
|
if ((ret = fs.read(buf, __SRS_HTTP_TS_SEND_BUFFER_SIZE, &nread)) != ERROR_SUCCESS) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -427,7 +427,7 @@ int SrsHttpVhost::response_ts_file(SrsSocket* skt, SrsHttpMessage* req, string f
|
||||||
|
|
||||||
while (left > 0) {
|
while (left > 0) {
|
||||||
ssize_t nread = -1;
|
ssize_t nread = -1;
|
||||||
if ((ret = fs.read(buf, SRS_CONSTS_HTTP_TS_SEND_BUFFER_SIZE, &nread)) != ERROR_SUCCESS) {
|
if ((ret = fs.read(buf, __SRS_HTTP_TS_SEND_BUFFER_SIZE, &nread)) != ERROR_SUCCESS) {
|
||||||
srs_warn("read file %s failed, ret=%d", fullpath.c_str(), ret);
|
srs_warn("read file %s failed, ret=%d", fullpath.c_str(), ret);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ using namespace std;
|
||||||
#include <srs_kernel_log.hpp>
|
#include <srs_kernel_log.hpp>
|
||||||
#include <srs_kernel_error.hpp>
|
#include <srs_kernel_error.hpp>
|
||||||
|
|
||||||
#ifdef SRS_JSON_USE_NXJSON
|
#ifdef __SRS_JSON_USE_NXJSON
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -303,7 +303,7 @@ SrsJsonArray* SrsJsonAny::array()
|
||||||
return new SrsJsonArray();
|
return new SrsJsonArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SRS_JSON_USE_NXJSON
|
#ifdef __SRS_JSON_USE_NXJSON
|
||||||
SrsJsonAny* srs_json_parse_tree_nx_json(const nx_json* node)
|
SrsJsonAny* srs_json_parse_tree_nx_json(const nx_json* node)
|
||||||
{
|
{
|
||||||
if (!node) {
|
if (!node) {
|
||||||
|
@ -490,7 +490,7 @@ void SrsJsonArray::add(SrsJsonAny* value)
|
||||||
properties.push_back(value);
|
properties.push_back(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SRS_JSON_USE_NXJSON
|
#ifdef __SRS_JSON_USE_NXJSON
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -34,8 +34,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
// whether use nxjson
|
// whether use nxjson
|
||||||
// @see: https://bitbucket.org/yarosla/nxjson
|
// @see: https://bitbucket.org/yarosla/nxjson
|
||||||
#undef SRS_JSON_USE_NXJSON
|
#undef __SRS_JSON_USE_NXJSON
|
||||||
#define SRS_JSON_USE_NXJSON
|
#define __SRS_JSON_USE_NXJSON
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -160,6 +160,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// HTTP consts values
|
// HTTP consts values
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
// linux path seprator
|
||||||
|
#define SRS_CONSTS_HTTP_PATH_SEP '/'
|
||||||
|
// query string seprator
|
||||||
|
#define SRS_CONSTS_HTTP_QUERY_SEP '?'
|
||||||
|
|
||||||
// 6.1.1 Status Code and Reason Phrase
|
// 6.1.1 Status Code and Reason Phrase
|
||||||
#define SRS_CONSTS_HTTP_Continue 100
|
#define SRS_CONSTS_HTTP_Continue 100
|
||||||
#define SRS_CONSTS_HTTP_SwitchingProtocols 101
|
#define SRS_CONSTS_HTTP_SwitchingProtocols 101
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue