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-03-27 17:13:26 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
41f52173604f999eefd203991953bb977a91fee4
41f52173
1 parent
6913efe1
refine http code, define CRLF consts for http
隐藏空白字符变更
内嵌
并排对比
正在显示
3 个修改的文件
包含
30 行增加
和
9 行删除
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.cpp
查看文件 @
41f5217
...
...
@@ -26,6 +26,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#ifdef SRS_HTTP_CALLBACK
#include <sstream>
using
namespace
std
;
#include <stdlib.h>
#include <sys/socket.h>
...
...
@@ -37,6 +38,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_kernel_log.hpp>
#include <srs_app_socket.hpp>
using
namespace
srs
;
#define SRS_DEFAULT_HTTP_PORT 80
#define SRS_HTTP_RESPONSE_OK "0"
...
...
@@ -150,13 +153,13 @@ int SrsHttpClient::post(SrsHttpUri* uri, std::string req, std::string& res)
// POST %s HTTP/1.1\r\nHost: %s\r\nContent-Length: %d\r\n\r\n%s
std
::
stringstream
ss
;
ss
<<
"POST "
<<
uri
->
get_path
()
<<
" "
<<
"HTTP/1.1
\r\n
"
<<
"Host: "
<<
uri
->
get_host
()
<<
"
\r\n
"
<<
"Connection: Keep-Alive"
<<
"
\r\n
"
<<
"Content-Length: "
<<
std
::
dec
<<
req
.
length
()
<<
"
\r\n
"
<<
"User-Agent: "
<<
RTMP_SIG_SRS_NAME
<<
RTMP_SIG_SRS_VERSION
<<
"
\r\n
"
<<
"Content-Type: text/html"
<<
"
\r\n
"
<<
"
\r\n
"
<<
"HTTP/1.1"
<<
CRLF
<<
"Host: "
<<
uri
->
get_host
()
<<
CRLF
<<
"Connection: Keep-Alive"
<<
CRLF
<<
"Content-Length: "
<<
std
::
dec
<<
req
.
length
()
<<
CRLF
<<
"User-Agent: "
<<
RTMP_SIG_SRS_NAME
<<
RTMP_SIG_SRS_VERSION
<<
CRLF
<<
"Content-Type: text/html"
<<
CRLF
<<
CRLF
<<
req
;
SrsSocket
skt
(
stfd
);
...
...
trunk/src/app/srs_app_http.hpp
查看文件 @
41f5217
...
...
@@ -31,6 +31,24 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <srs_app_st.hpp>
// http specification
namespace
srs
{
// CR = <US-ASCII CR, carriage return (13)>
const
static
char
CR
=
'\r'
;
// LF = <US-ASCII LF, linefeed (10)>
const
static
char
LF
=
'\n'
;
// SP = <US-ASCII SP, space (32)>
const
static
char
SP
=
' '
;
// HT = <US-ASCII HT, horizontal-tab (9)>
const
static
char
HT
=
9
;
// HTTP/1.1 defines the sequence CR LF as the end-of-line marker for all
// protocol elements except the entity-body (see appendix 19.3 for
// tolerant applications).
const
static
char
*
CRLF
=
"
\r\n
"
;
};
#ifdef SRS_HTTP_CALLBACK
class
SrsRequest
;
...
...
trunk/src/app/srs_app_http_api.cpp
查看文件 @
41f5217
...
...
@@ -31,11 +31,11 @@ SrsHttpApi::SrsHttpApi(SrsServer* srs_server, st_netfd_t client_stfd)
{
}
SrsHttpApi
::~
SrsHttpApi
()
SrsHttpApi
::~
SrsHttpApi
()
{
}
int
SrsHttpApi
::
do_cycle
()
int
SrsHttpApi
::
do_cycle
()
{
int
ret
=
ERROR_SUCCESS
;
...
...
请
注册
或
登录
后发表评论