Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
胡斌
/
srs
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
winlin
2014-07-26 20:08:37 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
6ee9ea341a95dbbb321bd2faa9b0a877d0f0bd7a
6ee9ea34
1 parent
b19d2e8e
refine code, rename SrsSocket to SrsStSocket
隐藏空白字符变更
内嵌
并排对比
正在显示
16 个修改的文件
包含
106 行增加
和
106 行删除
trunk/src/app/srs_app_edge.cpp
trunk/src/app/srs_app_edge.hpp
trunk/src/app/srs_app_forward.cpp
trunk/src/app/srs_app_http.cpp
trunk/src/app/srs_app_http.hpp
trunk/src/app/srs_app_http_api.cpp
trunk/src/app/srs_app_http_api.hpp
trunk/src/app/srs_app_http_client.cpp
trunk/src/app/srs_app_http_conn.cpp
trunk/src/app/srs_app_http_conn.hpp
trunk/src/app/srs_app_http_hooks.hpp
trunk/src/app/srs_app_rtmp_conn.cpp
trunk/src/app/srs_app_rtmp_conn.hpp
trunk/src/app/srs_app_source.hpp
trunk/src/app/srs_app_st_socket.cpp
trunk/src/app/srs_app_st_socket.hpp
trunk/src/app/srs_app_edge.cpp
查看文件 @
6ee9ea3
...
...
@@ -306,7 +306,7 @@ int SrsEdgeIngester::connect_server()
srs_freep
(
io
);
srs_assert
(
stfd
);
io
=
new
SrsSocket
(
stfd
);
io
=
new
SrsS
tS
ocket
(
stfd
);
client
=
new
SrsRtmpClient
(
io
);
kbps
->
set_io
(
io
,
io
);
...
...
@@ -559,7 +559,7 @@ int SrsEdgeForwarder::connect_server()
srs_freep
(
io
);
srs_assert
(
stfd
);
io
=
new
SrsSocket
(
stfd
);
io
=
new
SrsS
tS
ocket
(
stfd
);
client
=
new
SrsRtmpClient
(
io
);
kbps
->
set_io
(
io
,
io
);
...
...
trunk/src/app/srs_app_edge.hpp
查看文件 @
6ee9ea3
...
...
@@ -33,7 +33,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_app_st.hpp>
#include <srs_app_thread.hpp>
class
SrsSocket
;
class
SrsS
tS
ocket
;
class
SrsRtmpServer
;
class
SrsSource
;
class
SrsRequest
;
...
...
trunk/src/app/srs_app_forward.cpp
查看文件 @
6ee9ea3
...
...
@@ -266,7 +266,7 @@ int SrsForwarder::connect_server()
srs_freep
(
io
);
srs_assert
(
stfd
);
io
=
new
SrsSocket
(
stfd
);
io
=
new
SrsS
tS
ocket
(
stfd
);
client
=
new
SrsRtmpClient
(
io
);
kbps
->
set_io
(
io
,
io
);
...
...
trunk/src/app/srs_app_http.cpp
查看文件 @
6ee9ea3
...
...
@@ -97,7 +97,7 @@ bool SrsHttpHandler::can_handle(const char* /*path*/, int /*length*/, const char
return
false
;
}
int
SrsHttpHandler
::
process_request
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
)
int
SrsHttpHandler
::
process_request
(
SrsS
tS
ocket
*
skt
,
SrsHttpMessage
*
req
)
{
if
(
req
->
method
()
==
SRS_CONSTS_HTTP_OPTIONS
)
{
req
->
set_requires_crossdomain
(
true
);
...
...
@@ -136,13 +136,13 @@ bool SrsHttpHandler::is_handler_valid(SrsHttpMessage* req, int& status_code, str
return
true
;
}
int
SrsHttpHandler
::
do_process_request
(
SrsSocket
*
/*skt*/
,
SrsHttpMessage
*
/*req*/
)
int
SrsHttpHandler
::
do_process_request
(
SrsS
tS
ocket
*
/*skt*/
,
SrsHttpMessage
*
/*req*/
)
{
int
ret
=
ERROR_SUCCESS
;
return
ret
;
}
int
SrsHttpHandler
::
response_error
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
,
int
code
,
string
desc
)
int
SrsHttpHandler
::
response_error
(
SrsS
tS
ocket
*
skt
,
SrsHttpMessage
*
req
,
int
code
,
string
desc
)
{
std
::
stringstream
ss
;
ss
<<
__SRS_JOBJECT_START
...
...
@@ -334,12 +334,12 @@ SrsHttpHandler* SrsHttpHandler::res_body(stringstream& ss, string body)
return
this
;
}
int
SrsHttpHandler
::
res_flush
(
SrsSocket
*
skt
,
stringstream
&
ss
)
int
SrsHttpHandler
::
res_flush
(
SrsS
tS
ocket
*
skt
,
stringstream
&
ss
)
{
return
skt
->
write
((
void
*
)
ss
.
str
().
c_str
(),
ss
.
str
().
length
(),
NULL
);
}
int
SrsHttpHandler
::
res_options
(
SrsSocket
*
skt
)
int
SrsHttpHandler
::
res_options
(
SrsS
tS
ocket
*
skt
)
{
std
::
stringstream
ss
;
...
...
@@ -350,7 +350,7 @@ int SrsHttpHandler::res_options(SrsSocket* skt)
return
res_flush
(
skt
,
ss
);
}
int
SrsHttpHandler
::
res_text
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
,
string
body
)
int
SrsHttpHandler
::
res_text
(
SrsS
tS
ocket
*
skt
,
SrsHttpMessage
*
req
,
string
body
)
{
std
::
stringstream
ss
;
...
...
@@ -367,7 +367,7 @@ int SrsHttpHandler::res_text(SrsSocket* skt, SrsHttpMessage* req, string body)
return
res_flush
(
skt
,
ss
);
}
int
SrsHttpHandler
::
res_xml
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
,
string
body
)
int
SrsHttpHandler
::
res_xml
(
SrsS
tS
ocket
*
skt
,
SrsHttpMessage
*
req
,
string
body
)
{
std
::
stringstream
ss
;
...
...
@@ -384,7 +384,7 @@ int SrsHttpHandler::res_xml(SrsSocket* skt, SrsHttpMessage* req, string body)
return
res_flush
(
skt
,
ss
);
}
int
SrsHttpHandler
::
res_javascript
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
,
string
body
)
int
SrsHttpHandler
::
res_javascript
(
SrsS
tS
ocket
*
skt
,
SrsHttpMessage
*
req
,
string
body
)
{
std
::
stringstream
ss
;
...
...
@@ -401,7 +401,7 @@ int SrsHttpHandler::res_javascript(SrsSocket* skt, SrsHttpMessage* req, string b
return
res_flush
(
skt
,
ss
);
}
int
SrsHttpHandler
::
res_swf
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
,
string
body
)
int
SrsHttpHandler
::
res_swf
(
SrsS
tS
ocket
*
skt
,
SrsHttpMessage
*
req
,
string
body
)
{
std
::
stringstream
ss
;
...
...
@@ -418,7 +418,7 @@ int SrsHttpHandler::res_swf(SrsSocket* skt, SrsHttpMessage* req, string body)
return
res_flush
(
skt
,
ss
);
}
int
SrsHttpHandler
::
res_css
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
,
string
body
)
int
SrsHttpHandler
::
res_css
(
SrsS
tS
ocket
*
skt
,
SrsHttpMessage
*
req
,
string
body
)
{
std
::
stringstream
ss
;
...
...
@@ -435,7 +435,7 @@ int SrsHttpHandler::res_css(SrsSocket* skt, SrsHttpMessage* req, string body)
return
res_flush
(
skt
,
ss
);
}
int
SrsHttpHandler
::
res_ico
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
,
string
body
)
int
SrsHttpHandler
::
res_ico
(
SrsS
tS
ocket
*
skt
,
SrsHttpMessage
*
req
,
string
body
)
{
std
::
stringstream
ss
;
...
...
@@ -452,7 +452,7 @@ int SrsHttpHandler::res_ico(SrsSocket* skt, SrsHttpMessage* req, string body)
return
res_flush
(
skt
,
ss
);
}
int
SrsHttpHandler
::
res_m3u8
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
,
string
body
)
int
SrsHttpHandler
::
res_m3u8
(
SrsS
tS
ocket
*
skt
,
SrsHttpMessage
*
req
,
string
body
)
{
std
::
stringstream
ss
;
...
...
@@ -469,7 +469,7 @@ int SrsHttpHandler::res_m3u8(SrsSocket* skt, SrsHttpMessage* req, string body)
return
res_flush
(
skt
,
ss
);
}
int
SrsHttpHandler
::
res_mpegts
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
,
string
body
)
int
SrsHttpHandler
::
res_mpegts
(
SrsS
tS
ocket
*
skt
,
SrsHttpMessage
*
req
,
string
body
)
{
std
::
stringstream
ss
;
...
...
@@ -486,7 +486,7 @@ int SrsHttpHandler::res_mpegts(SrsSocket* skt, SrsHttpMessage* req, string body)
return
res_flush
(
skt
,
ss
);
}
int
SrsHttpHandler
::
res_json
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
,
string
json
)
int
SrsHttpHandler
::
res_json
(
SrsS
tS
ocket
*
skt
,
SrsHttpMessage
*
req
,
string
json
)
{
std
::
stringstream
ss
;
...
...
@@ -503,7 +503,7 @@ int SrsHttpHandler::res_json(SrsSocket* skt, SrsHttpMessage* req, string json)
return
res_flush
(
skt
,
ss
);
}
int
SrsHttpHandler
::
res_error
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
,
int
code
,
string
reason_phrase
,
string
body
)
int
SrsHttpHandler
::
res_error
(
SrsS
tS
ocket
*
skt
,
SrsHttpMessage
*
req
,
int
code
,
string
reason_phrase
,
string
body
)
{
std
::
stringstream
ss
;
...
...
@@ -829,7 +829,7 @@ int SrsHttpParser::initialize(enum http_parser_type type)
return
ret
;
}
int
SrsHttpParser
::
parse_message
(
SrsSocket
*
skt
,
SrsHttpMessage
**
ppmsg
)
int
SrsHttpParser
::
parse_message
(
SrsS
tS
ocket
*
skt
,
SrsHttpMessage
**
ppmsg
)
{
*
ppmsg
=
NULL
;
...
...
@@ -861,7 +861,7 @@ int SrsHttpParser::parse_message(SrsSocket* skt, SrsHttpMessage** ppmsg)
return
ret
;
}
int
SrsHttpParser
::
parse_message_imp
(
SrsSocket
*
skt
)
int
SrsHttpParser
::
parse_message_imp
(
SrsS
tS
ocket
*
skt
)
{
int
ret
=
ERROR_SUCCESS
;
...
...
trunk/src/app/srs_app_http.hpp
查看文件 @
6ee9ea3
...
...
@@ -41,7 +41,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
class
SrsBuffer
;
class
SrsRequest
;
class
SrsSocket
;
class
SrsS
tS
ocket
;
class
SrsHttpUri
;
class
SrsHttpMessage
;
class
SrsHttpHandler
;
...
...
@@ -123,7 +123,7 @@ public:
* use the handler to process the request.
* @remark sub classes should override the do_process_request.
*/
virtual
int
process_request
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
);
virtual
int
process_request
(
SrsS
tS
ocket
*
skt
,
SrsHttpMessage
*
req
);
public
:
/**
* find the best matched handler
...
...
@@ -143,12 +143,12 @@ protected:
* do the actual process of request., format as, for example:
* {"code":0, "data":{}}
*/
virtual
int
do_process_request
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
);
virtual
int
do_process_request
(
SrsS
tS
ocket
*
skt
,
SrsHttpMessage
*
req
);
/**
* response error, format as, for example:
* {"code":100, "desc":"description"}
*/
virtual
int
response_error
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
,
int
code
,
std
::
string
desc
);
virtual
int
response_error
(
SrsS
tS
ocket
*
skt
,
SrsHttpMessage
*
req
,
int
code
,
std
::
string
desc
);
// response writer
public:
virtual
SrsHttpHandler
*
res_status_line
(
std
::
stringstream
&
ss
);
...
...
@@ -167,19 +167,19 @@ public:
virtual
SrsHttpHandler
*
res_enable_crossdomain
(
std
::
stringstream
&
ss
);
virtual
SrsHttpHandler
*
res_header_eof
(
std
::
stringstream
&
ss
);
virtual
SrsHttpHandler
*
res_body
(
std
::
stringstream
&
ss
,
std
::
string
body
);
virtual
int
res_flush
(
SrsSocket
*
skt
,
std
::
stringstream
&
ss
);
virtual
int
res_flush
(
SrsS
tS
ocket
*
skt
,
std
::
stringstream
&
ss
);
public
:
virtual
int
res_options
(
SrsSocket
*
skt
);
virtual
int
res_text
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
,
std
::
string
body
);
virtual
int
res_xml
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
,
std
::
string
body
);
virtual
int
res_javascript
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
,
std
::
string
body
);
virtual
int
res_swf
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
,
std
::
string
body
);
virtual
int
res_css
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
,
std
::
string
body
);
virtual
int
res_ico
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
,
std
::
string
body
);
virtual
int
res_m3u8
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
,
std
::
string
body
);
virtual
int
res_mpegts
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
,
std
::
string
body
);
virtual
int
res_json
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
,
std
::
string
json
);
virtual
int
res_error
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
,
int
code
,
std
::
string
reason_phrase
,
std
::
string
body
);
virtual
int
res_options
(
SrsStSocket
*
skt
);
virtual
int
res_text
(
SrsStSocket
*
skt
,
SrsHttpMessage
*
req
,
std
::
string
body
);
virtual
int
res_xml
(
SrsStSocket
*
skt
,
SrsHttpMessage
*
req
,
std
::
string
body
);
virtual
int
res_javascript
(
SrsStSocket
*
skt
,
SrsHttpMessage
*
req
,
std
::
string
body
);
virtual
int
res_swf
(
SrsStSocket
*
skt
,
SrsHttpMessage
*
req
,
std
::
string
body
);
virtual
int
res_css
(
SrsStSocket
*
skt
,
SrsHttpMessage
*
req
,
std
::
string
body
);
virtual
int
res_ico
(
SrsStSocket
*
skt
,
SrsHttpMessage
*
req
,
std
::
string
body
);
virtual
int
res_m3u8
(
SrsStSocket
*
skt
,
SrsHttpMessage
*
req
,
std
::
string
body
);
virtual
int
res_mpegts
(
SrsStSocket
*
skt
,
SrsHttpMessage
*
req
,
std
::
string
body
);
virtual
int
res_json
(
SrsStSocket
*
skt
,
SrsHttpMessage
*
req
,
std
::
string
json
);
virtual
int
res_error
(
SrsStSocket
*
skt
,
SrsHttpMessage
*
req
,
int
code
,
std
::
string
reason_phrase
,
std
::
string
body
);
// object creator
public:
/**
...
...
@@ -313,12 +313,12 @@ public:
* or error and *ppmsg must be NULL.
* @remark, if success, *ppmsg always NOT-NULL, *ppmsg always is_complete().
*/
virtual
int
parse_message
(
SrsSocket
*
skt
,
SrsHttpMessage
**
ppmsg
);
virtual
int
parse_message
(
SrsS
tS
ocket
*
skt
,
SrsHttpMessage
**
ppmsg
);
private
:
/**
* parse the HTTP message to member field: msg.
*/
virtual
int
parse_message_imp
(
SrsSocket
*
skt
);
virtual
int
parse_message_imp
(
SrsS
tS
ocket
*
skt
);
private
:
static
int
on_message_begin
(
http_parser
*
parser
);
static
int
on_headers_complete
(
http_parser
*
parser
);
...
...
trunk/src/app/srs_app_http_api.cpp
查看文件 @
6ee9ea3
...
...
@@ -72,7 +72,7 @@ bool SrsApiRoot::can_handle(const char* path, int length, const char** pchild)
return
srs_path_equals
(
"/"
,
path
,
1
);
}
int
SrsApiRoot
::
do_process_request
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
)
int
SrsApiRoot
::
do_process_request
(
SrsS
tS
ocket
*
skt
,
SrsHttpMessage
*
req
)
{
std
::
stringstream
ss
;
...
...
@@ -100,7 +100,7 @@ bool SrsApiApi::can_handle(const char* path, int length, const char** /*pchild*/
return
srs_path_equals
(
"/api"
,
path
,
length
);
}
int
SrsApiApi
::
do_process_request
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
)
int
SrsApiApi
::
do_process_request
(
SrsS
tS
ocket
*
skt
,
SrsHttpMessage
*
req
)
{
std
::
stringstream
ss
;
...
...
@@ -135,7 +135,7 @@ bool SrsApiV1::can_handle(const char* path, int length, const char** /*pchild*/)
return
srs_path_equals
(
"/v1"
,
path
,
length
);
}
int
SrsApiV1
::
do_process_request
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
)
int
SrsApiV1
::
do_process_request
(
SrsS
tS
ocket
*
skt
,
SrsHttpMessage
*
req
)
{
std
::
stringstream
ss
;
...
...
@@ -169,7 +169,7 @@ bool SrsApiRequests::can_handle(const char* path, int length, const char** /*pch
return
srs_path_equals
(
"/requests"
,
path
,
length
);
}
int
SrsApiRequests
::
do_process_request
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
)
int
SrsApiRequests
::
do_process_request
(
SrsS
tS
ocket
*
skt
,
SrsHttpMessage
*
req
)
{
std
::
stringstream
ss
;
...
...
@@ -233,7 +233,7 @@ bool SrsApiVersion::can_handle(const char* path, int length, const char** /*pchi
return
srs_path_equals
(
"/versions"
,
path
,
length
);
}
int
SrsApiVersion
::
do_process_request
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
)
int
SrsApiVersion
::
do_process_request
(
SrsS
tS
ocket
*
skt
,
SrsHttpMessage
*
req
)
{
std
::
stringstream
ss
;
...
...
@@ -263,7 +263,7 @@ bool SrsApiSummaries::can_handle(const char* path, int length, const char** /*pc
return
srs_path_equals
(
"/summaries"
,
path
,
length
);
}
int
SrsApiSummaries
::
do_process_request
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
)
int
SrsApiSummaries
::
do_process_request
(
SrsS
tS
ocket
*
skt
,
SrsHttpMessage
*
req
)
{
std
::
stringstream
ss
;
srs_api_dump_summaries
(
ss
);
...
...
@@ -283,7 +283,7 @@ bool SrsApiRusages::can_handle(const char* path, int length, const char** /*pchi
return
srs_path_equals
(
"/rusages"
,
path
,
length
);
}
int
SrsApiRusages
::
do_process_request
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
)
int
SrsApiRusages
::
do_process_request
(
SrsS
tS
ocket
*
skt
,
SrsHttpMessage
*
req
)
{
std
::
stringstream
ss
;
...
...
@@ -329,7 +329,7 @@ bool SrsApiSelfProcStats::can_handle(const char* path, int length, const char**
return
srs_path_equals
(
"/self_proc_stats"
,
path
,
length
);
}
int
SrsApiSelfProcStats
::
do_process_request
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
)
int
SrsApiSelfProcStats
::
do_process_request
(
SrsS
tS
ocket
*
skt
,
SrsHttpMessage
*
req
)
{
std
::
stringstream
ss
;
...
...
@@ -404,7 +404,7 @@ bool SrsApiSystemProcStats::can_handle(const char* path, int length, const char*
return
srs_path_equals
(
"/system_proc_stats"
,
path
,
length
);
}
int
SrsApiSystemProcStats
::
do_process_request
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
)
int
SrsApiSystemProcStats
::
do_process_request
(
SrsS
tS
ocket
*
skt
,
SrsHttpMessage
*
req
)
{
std
::
stringstream
ss
;
...
...
@@ -444,7 +444,7 @@ bool SrsApiMemInfos::can_handle(const char* path, int length, const char** /*pch
return
srs_path_equals
(
"/meminfos"
,
path
,
length
);
}
int
SrsApiMemInfos
::
do_process_request
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
)
int
SrsApiMemInfos
::
do_process_request
(
SrsS
tS
ocket
*
skt
,
SrsHttpMessage
*
req
)
{
std
::
stringstream
ss
;
...
...
@@ -485,7 +485,7 @@ bool SrsApiAuthors::can_handle(const char* path, int length, const char** /*pchi
return
srs_path_equals
(
"/authors"
,
path
,
length
);
}
int
SrsApiAuthors
::
do_process_request
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
)
int
SrsApiAuthors
::
do_process_request
(
SrsS
tS
ocket
*
skt
,
SrsHttpMessage
*
req
)
{
std
::
stringstream
ss
;
...
...
@@ -544,7 +544,7 @@ int SrsHttpApi::do_cycle()
}
// underlayer socket
SrsSocket
skt
(
stfd
);
SrsS
tS
ocket
skt
(
stfd
);
// process http messages.
for
(;;)
{
...
...
@@ -571,7 +571,7 @@ int SrsHttpApi::do_cycle()
return
ret
;
}
int
SrsHttpApi
::
process_request
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
)
int
SrsHttpApi
::
process_request
(
SrsS
tS
ocket
*
skt
,
SrsHttpMessage
*
req
)
{
int
ret
=
ERROR_SUCCESS
;
...
...
trunk/src/app/srs_app_http_api.hpp
查看文件 @
6ee9ea3
...
...
@@ -32,7 +32,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#ifdef SRS_AUTO_HTTP_API
class
SrsSocket
;
class
SrsS
tS
ocket
;
class
SrsHttpMessage
;
class
SrsHttpParser
;
class
SrsHttpHandler
;
...
...
@@ -51,7 +51,7 @@ public:
virtual
bool
is_handler_valid
(
SrsHttpMessage
*
req
,
int
&
status_code
,
std
::
string
&
reason_phrase
);
protected
:
virtual
bool
can_handle
(
const
char
*
path
,
int
length
,
const
char
**
pchild
);
virtual
int
do_process_request
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
);
virtual
int
do_process_request
(
SrsS
tS
ocket
*
skt
,
SrsHttpMessage
*
req
);
};
class
SrsApiApi
:
public
SrsHttpHandler
...
...
@@ -62,7 +62,7 @@ public:
public
:
virtual
bool
can_handle
(
const
char
*
path
,
int
length
,
const
char
**
pchild
);
protected
:
virtual
int
do_process_request
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
);
virtual
int
do_process_request
(
SrsS
tS
ocket
*
skt
,
SrsHttpMessage
*
req
);
};
class
SrsApiV1
:
public
SrsHttpHandler
...
...
@@ -73,7 +73,7 @@ public:
public
:
virtual
bool
can_handle
(
const
char
*
path
,
int
length
,
const
char
**
pchild
);
protected
:
virtual
int
do_process_request
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
);
virtual
int
do_process_request
(
SrsS
tS
ocket
*
skt
,
SrsHttpMessage
*
req
);
};
class
SrsApiRequests
:
public
SrsHttpHandler
...
...
@@ -84,7 +84,7 @@ public:
public
:
virtual
bool
can_handle
(
const
char
*
path
,
int
length
,
const
char
**
pchild
);
protected
:
virtual
int
do_process_request
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
);
virtual
int
do_process_request
(
SrsS
tS
ocket
*
skt
,
SrsHttpMessage
*
req
);
};
class
SrsApiVersion
:
public
SrsHttpHandler
...
...
@@ -95,7 +95,7 @@ public:
public
:
virtual
bool
can_handle
(
const
char
*
path
,
int
length
,
const
char
**
pchild
);
protected
:
virtual
int
do_process_request
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
);
virtual
int
do_process_request
(
SrsS
tS
ocket
*
skt
,
SrsHttpMessage
*
req
);
};
class
SrsApiSummaries
:
public
SrsHttpHandler
...
...
@@ -106,7 +106,7 @@ public:
public
:
virtual
bool
can_handle
(
const
char
*
path
,
int
length
,
const
char
**
pchild
);
protected
:
virtual
int
do_process_request
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
);
virtual
int
do_process_request
(
SrsS
tS
ocket
*
skt
,
SrsHttpMessage
*
req
);
};
class
SrsApiRusages
:
public
SrsHttpHandler
...
...
@@ -117,7 +117,7 @@ public:
public
:
virtual
bool
can_handle
(
const
char
*
path
,
int
length
,
const
char
**
pchild
);
protected
:
virtual
int
do_process_request
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
);
virtual
int
do_process_request
(
SrsS
tS
ocket
*
skt
,
SrsHttpMessage
*
req
);
};
class
SrsApiSelfProcStats
:
public
SrsHttpHandler
...
...
@@ -128,7 +128,7 @@ public:
public
:
virtual
bool
can_handle
(
const
char
*
path
,
int
length
,
const
char
**
pchild
);
protected
:
virtual
int
do_process_request
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
);
virtual
int
do_process_request
(
SrsS
tS
ocket
*
skt
,
SrsHttpMessage
*
req
);
};
class
SrsApiSystemProcStats
:
public
SrsHttpHandler
...
...
@@ -139,7 +139,7 @@ public:
public
:
virtual
bool
can_handle
(
const
char
*
path
,
int
length
,
const
char
**
pchild
);
protected
:
virtual
int
do_process_request
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
);
virtual
int
do_process_request
(
SrsS
tS
ocket
*
skt
,
SrsHttpMessage
*
req
);
};
class
SrsApiMemInfos
:
public
SrsHttpHandler
...
...
@@ -150,7 +150,7 @@ public:
public
:
virtual
bool
can_handle
(
const
char
*
path
,
int
length
,
const
char
**
pchild
);
protected
:
virtual
int
do_process_request
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
);
virtual
int
do_process_request
(
SrsS
tS
ocket
*
skt
,
SrsHttpMessage
*
req
);
};
class
SrsApiAuthors
:
public
SrsHttpHandler
...
...
@@ -161,7 +161,7 @@ public:
public
:
virtual
bool
can_handle
(
const
char
*
path
,
int
length
,
const
char
**
pchild
);
protected
:
virtual
int
do_process_request
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
);
virtual
int
do_process_request
(
SrsS
tS
ocket
*
skt
,
SrsHttpMessage
*
req
);
};
class
SrsHttpApi
:
public
SrsConnection
...
...
@@ -182,7 +182,7 @@ public:
protected
:
virtual
int
do_cycle
();
private
:
virtual
int
process_request
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
);
virtual
int
process_request
(
SrsS
tS
ocket
*
skt
,
SrsHttpMessage
*
req
);
};
#endif
...
...
trunk/src/app/srs_app_http_client.cpp
查看文件 @
6ee9ea3
...
...
@@ -85,7 +85,7 @@ int SrsHttpClient::post(SrsHttpUri* uri, string req, string& res)
<<
__SRS_CRLF
<<
req
;
SrsSocket
skt
(
stfd
);
SrsS
tS
ocket
skt
(
stfd
);
std
::
string
data
=
ss
.
str
();
if
((
ret
=
skt
.
write
((
void
*
)
data
.
c_str
(),
data
.
length
(),
NULL
))
!=
ERROR_SUCCESS
)
{
...
...
trunk/src/app/srs_app_http_conn.cpp
查看文件 @
6ee9ea3
...
...
@@ -124,7 +124,7 @@ bool SrsHttpRoot::is_handler_valid(SrsHttpMessage* req, int& status_code, std::s
return
false
;
}
int
SrsHttpRoot
::
do_process_request
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
)
int
SrsHttpRoot
::
do_process_request
(
SrsS
tS
ocket
*
skt
,
SrsHttpMessage
*
req
)
{
int
ret
=
ERROR_SUCCESS
;
return
ret
;
...
...
@@ -161,7 +161,7 @@ bool SrsHttpVhost::is_handler_valid(SrsHttpMessage* req, int& status_code, std::
return
true
;
}
int
SrsHttpVhost
::
do_process_request
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
)
int
SrsHttpVhost
::
do_process_request
(
SrsS
tS
ocket
*
skt
,
SrsHttpMessage
*
req
)
{
int
ret
=
ERROR_SUCCESS
;
...
...
@@ -188,7 +188,7 @@ int SrsHttpVhost::do_process_request(SrsSocket* skt, SrsHttpMessage* req)
return
ret
;
}
int
SrsHttpVhost
::
response_regular_file
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
,
string
fullpath
)
int
SrsHttpVhost
::
response_regular_file
(
SrsS
tS
ocket
*
skt
,
SrsHttpMessage
*
req
,
string
fullpath
)
{
int
ret
=
ERROR_SUCCESS
;
...
...
@@ -235,7 +235,7 @@ int SrsHttpVhost::response_regular_file(SrsSocket* skt, SrsHttpMessage* req, str
return
ret
;
}
int
SrsHttpVhost
::
response_flv_file
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
,
string
fullpath
)
int
SrsHttpVhost
::
response_flv_file
(
SrsS
tS
ocket
*
skt
,
SrsHttpMessage
*
req
,
string
fullpath
)
{
int
ret
=
ERROR_SUCCESS
;
...
...
@@ -286,7 +286,7 @@ int SrsHttpVhost::response_flv_file(SrsSocket* skt, SrsHttpMessage* req, string
return
ret
;
}
int
SrsHttpVhost
::
response_flv_file2
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
,
string
fullpath
,
int
offset
)
int
SrsHttpVhost
::
response_flv_file2
(
SrsS
tS
ocket
*
skt
,
SrsHttpMessage
*
req
,
string
fullpath
,
int
offset
)
{
int
ret
=
ERROR_SUCCESS
;
...
...
@@ -390,7 +390,7 @@ int SrsHttpVhost::response_flv_file2(SrsSocket* skt, SrsHttpMessage* req, string
return
ret
;
}
int
SrsHttpVhost
::
response_ts_file
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
,
string
fullpath
)
int
SrsHttpVhost
::
response_ts_file
(
SrsS
tS
ocket
*
skt
,
SrsHttpMessage
*
req
,
string
fullpath
)
{
int
ret
=
ERROR_SUCCESS
;
...
...
@@ -524,7 +524,7 @@ int SrsHttpConn::do_cycle()
}
// underlayer socket
SrsSocket
skt
(
stfd
);
SrsS
tS
ocket
skt
(
stfd
);
// process http messages.
for
(;;)
{
...
...
@@ -551,7 +551,7 @@ int SrsHttpConn::do_cycle()
return
ret
;
}
int
SrsHttpConn
::
process_request
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
)
int
SrsHttpConn
::
process_request
(
SrsS
tS
ocket
*
skt
,
SrsHttpMessage
*
req
)
{
int
ret
=
ERROR_SUCCESS
;
...
...
trunk/src/app/srs_app_http_conn.hpp
查看文件 @
6ee9ea3
...
...
@@ -36,7 +36,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_app_conn.hpp>
#include <srs_app_http.hpp>
class
SrsSocket
;
class
SrsS
tS
ocket
;
class
SrsHttpParser
;
class
SrsHttpMessage
;
class
SrsHttpHandler
;
...
...
@@ -52,7 +52,7 @@ public:
virtual
int
best_match
(
const
char
*
path
,
int
length
,
SrsHttpHandlerMatch
**
ppmatch
);
protected
:
virtual
bool
is_handler_valid
(
SrsHttpMessage
*
req
,
int
&
status_code
,
std
::
string
&
reason_phrase
);
virtual
int
do_process_request
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
);
virtual
int
do_process_request
(
SrsS
tS
ocket
*
skt
,
SrsHttpMessage
*
req
);
};
class
SrsHttpVhost
:
public
SrsHttpHandler
...
...
@@ -68,12 +68,12 @@ public:
virtual
bool
can_handle
(
const
char
*
path
,
int
length
,
const
char
**
pchild
);
protected
:
virtual
bool
is_handler_valid
(
SrsHttpMessage
*
req
,
int
&
status_code
,
std
::
string
&
reason_phrase
);
virtual
int
do_process_request
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
);
virtual
int
do_process_request
(
SrsS
tS
ocket
*
skt
,
SrsHttpMessage
*
req
);
private
:
virtual
int
response_regular_file
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
,
std
::
string
fullpath
);
virtual
int
response_flv_file
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
,
std
::
string
fullpath
);
virtual
int
response_flv_file2
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
,
std
::
string
fullpath
,
int
offset
);
virtual
int
response_ts_file
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
,
std
::
string
fullpath
);
virtual
int
response_regular_file
(
SrsStSocket
*
skt
,
SrsHttpMessage
*
req
,
std
::
string
fullpath
);
virtual
int
response_flv_file
(
SrsStSocket
*
skt
,
SrsHttpMessage
*
req
,
std
::
string
fullpath
);
virtual
int
response_flv_file2
(
SrsStSocket
*
skt
,
SrsHttpMessage
*
req
,
std
::
string
fullpath
,
int
offset
);
virtual
int
response_ts_file
(
SrsStSocket
*
skt
,
SrsHttpMessage
*
req
,
std
::
string
fullpath
);
virtual
std
::
string
get_request_file
(
SrsHttpMessage
*
req
);
public
:
virtual
std
::
string
vhost
();
...
...
@@ -99,7 +99,7 @@ public:
protected
:
virtual
int
do_cycle
();
private
:
virtual
int
process_request
(
SrsSocket
*
skt
,
SrsHttpMessage
*
req
);
virtual
int
process_request
(
SrsS
tS
ocket
*
skt
,
SrsHttpMessage
*
req
);
};
#endif
...
...
trunk/src/app/srs_app_http_hooks.hpp
查看文件 @
6ee9ea3
...
...
@@ -36,7 +36,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <http_parser.h>
class
SrsHttpUri
;
class
SrsSocket
;
class
SrsS
tS
ocket
;
class
SrsRequest
;
class
SrsHttpParser
;
class
SrsFlvSegment
;
...
...
trunk/src/app/srs_app_rtmp_conn.cpp
查看文件 @
6ee9ea3
...
...
@@ -79,7 +79,7 @@ SrsRtmpConn::SrsRtmpConn(SrsServer* srs_server, st_netfd_t client_stfd)
{
req
=
new
SrsRequest
();
res
=
new
SrsResponse
();
skt
=
new
SrsSocket
(
client_stfd
);
skt
=
new
SrsS
tS
ocket
(
client_stfd
);
rtmp
=
new
SrsRtmpServer
(
skt
);
refer
=
new
SrsRefer
();
bandwidth
=
new
SrsBandwidth
();
...
...
@@ -910,7 +910,7 @@ int SrsRtmpConn::check_edge_token_traverse_auth()
}
srs_assert
(
stsock
);
SrsS
ocket
*
io
=
new
Srs
Socket
(
stsock
);
SrsS
tSocket
*
io
=
new
SrsSt
Socket
(
stsock
);
SrsRtmpClient
*
client
=
new
SrsRtmpClient
(
io
);
ret
=
do_token_traverse_auth
(
io
,
client
);
...
...
@@ -956,7 +956,7 @@ int SrsRtmpConn::connect_server(int origin_index, st_netfd_t* pstsock)
return
ret
;
}
int
SrsRtmpConn
::
do_token_traverse_auth
(
SrsSocket
*
io
,
SrsRtmpClient
*
client
)
int
SrsRtmpConn
::
do_token_traverse_auth
(
SrsS
tS
ocket
*
io
,
SrsRtmpClient
*
client
)
{
int
ret
=
ERROR_SUCCESS
;
...
...
trunk/src/app/srs_app_rtmp_conn.hpp
查看文件 @
6ee9ea3
...
...
@@ -41,7 +41,7 @@ class SrsSource;
class
SrsRefer
;
class
SrsConsumer
;
class
SrsMessage
;
class
SrsSocket
;
class
SrsS
tS
ocket
;
#ifdef SRS_AUTO_HTTP_CALLBACK
class
SrsHttpHooks
;
#endif
...
...
@@ -58,7 +58,7 @@ class SrsRtmpConn : public virtual SrsConnection, public virtual ISrsReloadHandl
private
:
SrsRequest
*
req
;
SrsResponse
*
res
;
SrsSocket
*
skt
;
SrsS
tS
ocket
*
skt
;
SrsRtmpServer
*
rtmp
;
SrsRefer
*
refer
;
SrsBandwidth
*
bandwidth
;
...
...
@@ -95,7 +95,7 @@ private:
private
:
virtual
int
check_edge_token_traverse_auth
();
virtual
int
connect_server
(
int
origin_index
,
st_netfd_t
*
pstsock
);
virtual
int
do_token_traverse_auth
(
SrsSocket
*
io
,
SrsRtmpClient
*
client
);
virtual
int
do_token_traverse_auth
(
SrsS
tS
ocket
*
io
,
SrsRtmpClient
*
client
);
private
:
virtual
int
http_hooks_on_connect
();
virtual
void
http_hooks_on_close
();
...
...
trunk/src/app/srs_app_source.hpp
查看文件 @
6ee9ea3
...
...
@@ -45,7 +45,7 @@ class SrsOnMetaDataPacket;
class
SrsSharedPtrMessage
;
class
SrsForwarder
;
class
SrsRequest
;
class
SrsSocket
;
class
SrsS
tS
ocket
;
class
SrsRtmpServer
;
class
SrsEdgeProxyContext
;
#ifdef SRS_AUTO_HLS
...
...
trunk/src/app/srs_app_st_socket.cpp
查看文件 @
6ee9ea3
...
...
@@ -26,53 +26,53 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_kernel_error.hpp>
#include <srs_kernel_utility.hpp>
SrsS
ocket
::
Srs
Socket
(
st_netfd_t
client_stfd
)
SrsS
tSocket
::
SrsSt
Socket
(
st_netfd_t
client_stfd
)
{
stfd
=
client_stfd
;
send_timeout
=
recv_timeout
=
ST_UTIME_NO_TIMEOUT
;
recv_bytes
=
send_bytes
=
0
;
}
SrsS
ocket
::~
Srs
Socket
()
SrsS
tSocket
::~
SrsSt
Socket
()
{
}
bool
SrsSocket
::
is_never_timeout
(
int64_t
timeout_us
)
bool
SrsS
tS
ocket
::
is_never_timeout
(
int64_t
timeout_us
)
{
return
timeout_us
==
(
int64_t
)
ST_UTIME_NO_TIMEOUT
;
}
void
SrsSocket
::
set_recv_timeout
(
int64_t
timeout_us
)
void
SrsS
tS
ocket
::
set_recv_timeout
(
int64_t
timeout_us
)
{
recv_timeout
=
timeout_us
;
}
int64_t
SrsSocket
::
get_recv_timeout
()
int64_t
SrsS
tS
ocket
::
get_recv_timeout
()
{
return
recv_timeout
;
}
void
SrsSocket
::
set_send_timeout
(
int64_t
timeout_us
)
void
SrsS
tS
ocket
::
set_send_timeout
(
int64_t
timeout_us
)
{
send_timeout
=
timeout_us
;
}
int64_t
SrsSocket
::
get_send_timeout
()
int64_t
SrsS
tS
ocket
::
get_send_timeout
()
{
return
send_timeout
;
}
int64_t
SrsSocket
::
get_recv_bytes
()
int64_t
SrsS
tS
ocket
::
get_recv_bytes
()
{
return
recv_bytes
;
}
int64_t
SrsSocket
::
get_send_bytes
()
int64_t
SrsS
tS
ocket
::
get_send_bytes
()
{
return
send_bytes
;
}
int
SrsSocket
::
read
(
void
*
buf
,
size_t
size
,
ssize_t
*
nread
)
int
SrsS
tS
ocket
::
read
(
void
*
buf
,
size_t
size
,
ssize_t
*
nread
)
{
int
ret
=
ERROR_SUCCESS
;
...
...
@@ -100,7 +100,7 @@ int SrsSocket::read(void* buf, size_t size, ssize_t* nread)
return
ret
;
}
int
SrsSocket
::
read_fully
(
void
*
buf
,
size_t
size
,
ssize_t
*
nread
)
int
SrsS
tS
ocket
::
read_fully
(
void
*
buf
,
size_t
size
,
ssize_t
*
nread
)
{
int
ret
=
ERROR_SUCCESS
;
...
...
@@ -128,7 +128,7 @@ int SrsSocket::read_fully(void* buf, size_t size, ssize_t* nread)
return
ret
;
}
int
SrsSocket
::
write
(
void
*
buf
,
size_t
size
,
ssize_t
*
nwrite
)
int
SrsS
tS
ocket
::
write
(
void
*
buf
,
size_t
size
,
ssize_t
*
nwrite
)
{
int
ret
=
ERROR_SUCCESS
;
...
...
@@ -150,7 +150,7 @@ int SrsSocket::write(void* buf, size_t size, ssize_t* nwrite)
return
ret
;
}
int
SrsSocket
::
writev
(
const
iovec
*
iov
,
int
iov_size
,
ssize_t
*
nwrite
)
int
SrsS
tS
ocket
::
writev
(
const
iovec
*
iov
,
int
iov_size
,
ssize_t
*
nwrite
)
{
int
ret
=
ERROR_SUCCESS
;
...
...
trunk/src/app/srs_app_st_socket.hpp
查看文件 @
6ee9ea3
...
...
@@ -37,7 +37,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* the socket provides TCP socket over st,
* that is, the sync socket mechanism.
*/
class
SrsSocket
:
public
ISrsProtocolReaderWriter
class
SrsS
tS
ocket
:
public
ISrsProtocolReaderWriter
{
private
:
int64_t
recv_timeout
;
...
...
@@ -46,8 +46,8 @@ private:
int64_t
send_bytes
;
st_netfd_t
stfd
;
public
:
SrsSocket
(
st_netfd_t
client_stfd
);
virtual
~
SrsSocket
();
SrsStSocket
(
st_netfd_t
client_stfd
);
virtual
~
SrsStSocket
();
public
:
virtual
bool
is_never_timeout
(
int64_t
timeout_us
);
virtual
void
set_recv_timeout
(
int64_t
timeout_us
);
...
...
请
注册
或
登录
后发表评论