winlin

refine consts.

... ... @@ -169,7 +169,7 @@ int SrsHttpHandler::best_match(const char* path, int length, SrsHttpHandlerMatch
}
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.
... ... @@ -541,7 +541,7 @@ SrsHttpMessage::SrsHttpMessage()
_uri = new SrsHttpUri();
_match = NULL;
_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()
... ...
... ... @@ -63,12 +63,7 @@ class SrsHttpHandler;
#define __SRS_CRLFCRLF "\r\n\r\n" // 0x0D0A0D0A
// @see SrsHttpMessage._http_ts_send_buffer
#define SRS_CONSTS_HTTP_TS_SEND_BUFFER_SIZE 4096
// linux path seprator
#define __PATH_SEP '/'
// query string seprator
#define __QUERY_SEP '?'
#define __SRS_HTTP_TS_SEND_BUFFER_SIZE 4096
// compare the path.
// full compare, extractly match.
... ...
... ... @@ -272,7 +272,7 @@ int SrsHttpVhost::response_flv_file(SrsSocket* skt, SrsHttpMessage* req, string
while (left > 0) {
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);
break;
}
... ... @@ -377,7 +377,7 @@ int SrsHttpVhost::response_flv_file2(SrsSocket* skt, SrsHttpMessage* req, string
// send data
while (left > 0) {
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;
}
... ... @@ -427,7 +427,7 @@ int SrsHttpVhost::response_ts_file(SrsSocket* skt, SrsHttpMessage* req, string f
while (left > 0) {
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);
break;
}
... ...
... ... @@ -28,7 +28,7 @@ using namespace std;
#include <srs_kernel_log.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();
}
#ifdef SRS_JSON_USE_NXJSON
#ifdef __SRS_JSON_USE_NXJSON
SrsJsonAny* srs_json_parse_tree_nx_json(const nx_json* node)
{
if (!node) {
... ... @@ -490,7 +490,7 @@ void SrsJsonArray::add(SrsJsonAny* 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
// @see: https://bitbucket.org/yarosla/nxjson
#undef SRS_JSON_USE_NXJSON
#define SRS_JSON_USE_NXJSON
#undef __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
///////////////////////////////////////////////////////////
// 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
#define SRS_CONSTS_HTTP_Continue 100
#define SRS_CONSTS_HTTP_SwitchingProtocols 101
... ...