正在显示
7 个修改的文件
包含
95 行增加
和
11 行删除
trunk/auto/depends.sh
100644 → 100755
| @@ -25,9 +25,10 @@ if [ ! -f ${SRS_OBJS}/st-1.9/obj/libst.so ]; then echo "build st-1.9 failed."; e | @@ -25,9 +25,10 @@ if [ ! -f ${SRS_OBJS}/st-1.9/obj/libst.so ]; then echo "build st-1.9 failed."; e | ||
| 25 | ##################################################################################### | 25 | ##################################################################################### |
| 26 | # http-parser-2.1 | 26 | # http-parser-2.1 |
| 27 | ##################################################################################### | 27 | ##################################################################################### |
| 28 | -if [[ -f ${SRS_OBJS}/http-parser-2.1/http_parser.h && -f ${SRS_OBJS}/http-parser-2.1/libhttp_parser.a ]]; then | 28 | +if [ $SRS_HTTP = YES ]; then |
| 29 | + if [[ -f ${SRS_OBJS}/http-parser-2.1/http_parser.h && -f ${SRS_OBJS}/http-parser-2.1/libhttp_parser.a ]]; then | ||
| 29 | echo "http-parser-2.1 is ok."; | 30 | echo "http-parser-2.1 is ok."; |
| 30 | -else | 31 | + else |
| 31 | echo "build http-parser-2.1"; | 32 | echo "build http-parser-2.1"; |
| 32 | ( | 33 | ( |
| 33 | rm -rf ${SRS_OBJS}/http-parser-2.1 && cd ${SRS_OBJS} && unzip -q ../3rdparty/http-parser-2.1.zip && | 34 | rm -rf ${SRS_OBJS}/http-parser-2.1 && cd ${SRS_OBJS} && unzip -q ../3rdparty/http-parser-2.1.zip && |
| @@ -37,11 +38,12 @@ else | @@ -37,11 +38,12 @@ else | ||
| 37 | make package && | 38 | make package && |
| 38 | cd .. && rm -f hp && ln -sf http-parser-2.1 hp | 39 | cd .. && rm -f hp && ln -sf http-parser-2.1 hp |
| 39 | ) | 40 | ) |
| 41 | + fi | ||
| 42 | + # check status | ||
| 43 | + ret=$?; if [[ $ret -ne 0 ]]; then echo "build http-parser-2.1 failed, ret=$ret"; exit $ret; fi | ||
| 44 | + if [[ ! -f ${SRS_OBJS}/http-parser-2.1/http_parser.h ]]; then echo "build http-parser-2.1 failed"; exit -1; fi | ||
| 45 | + if [[ ! -f ${SRS_OBJS}/http-parser-2.1/libhttp_parser.a ]]; then echo "build http-parser-2.1 failed"; exit -1; fi | ||
| 40 | fi | 46 | fi |
| 41 | -# check status | ||
| 42 | -ret=$?; if [[ $ret -ne 0 ]]; then echo "build http-parser-2.1 failed, ret=$ret"; exit $ret; fi | ||
| 43 | -if [[ ! -f ${SRS_OBJS}/http-parser-2.1/http_parser.h ]]; then echo "build http-parser-2.1 failed"; exit -1; fi | ||
| 44 | -if [[ ! -f ${SRS_OBJS}/http-parser-2.1/libhttp_parser.a ]]; then echo "build http-parser-2.1 failed"; exit -1; fi | ||
| 45 | 47 | ||
| 46 | ##################################################################################### | 48 | ##################################################################################### |
| 47 | # nginx for HLS, nginx-1.5.0 | 49 | # nginx for HLS, nginx-1.5.0 |
| @@ -95,13 +95,18 @@ END | @@ -95,13 +95,18 @@ END | ||
| 95 | # Libraries | 95 | # Libraries |
| 96 | LibSTRoot="${SRS_OBJS}/st" | 96 | LibSTRoot="${SRS_OBJS}/st" |
| 97 | LibSTfile="${LibSTRoot}/libst.a" | 97 | LibSTfile="${LibSTRoot}/libst.a" |
| 98 | -LibHttpParserRoot="${SRS_OBJS}/hp" | ||
| 99 | -LibHttpParserfile="${LibHttpParserRoot}/libhttp_parser.a" | 98 | +if [ $SRS_HTTP = YES ]; then |
| 99 | + LibHttpParserRoot="${SRS_OBJS}/hp" | ||
| 100 | + LibHttpParserfile="${LibHttpParserRoot}/libhttp_parser.a" | ||
| 101 | +fi | ||
| 100 | 102 | ||
| 101 | #Core Module | 103 | #Core Module |
| 102 | MODULE_ID="CORE" | 104 | MODULE_ID="CORE" |
| 103 | MODULE_DEPENDS=() | 105 | MODULE_DEPENDS=() |
| 104 | -ModuleLibIncs=(${LibSTRoot} ${LibHttpParserRoot} ${SRS_OBJS}) | 106 | +ModuleLibIncs=(${LibSTRoot} ${SRS_OBJS}) |
| 107 | +if [ $SRS_HTTP = YES ]; then | ||
| 108 | + ModuleLibIncs="${ModuleLibIncs[@]} ${LibHttpParserRoot}" | ||
| 109 | +fi | ||
| 105 | MODULE_FILES=("srs_core" "srs_core_log" "srs_core_server" | 110 | MODULE_FILES=("srs_core" "srs_core_log" "srs_core_server" |
| 106 | "srs_core_error" "srs_core_conn" "srs_core_client" | 111 | "srs_core_error" "srs_core_conn" "srs_core_client" |
| 107 | "srs_core_rtmp" "srs_core_socket" "srs_core_buffer" | 112 | "srs_core_rtmp" "srs_core_socket" "srs_core_buffer" |
| @@ -109,7 +114,8 @@ MODULE_FILES=("srs_core" "srs_core_log" "srs_core_server" | @@ -109,7 +114,8 @@ MODULE_FILES=("srs_core" "srs_core_log" "srs_core_server" | ||
| 109 | "srs_core_stream" "srs_core_source" "srs_core_codec" | 114 | "srs_core_stream" "srs_core_source" "srs_core_codec" |
| 110 | "srs_core_handshake" "srs_core_pithy_print" | 115 | "srs_core_handshake" "srs_core_pithy_print" |
| 111 | "srs_core_config" "srs_core_refer" "srs_core_reload" | 116 | "srs_core_config" "srs_core_refer" "srs_core_reload" |
| 112 | - "srs_core_hls" "srs_core_forward" "srs_core_encoder") | 117 | + "srs_core_hls" "srs_core_forward" "srs_core_encoder" |
| 118 | + "srs_core_http") | ||
| 113 | MODULE_DIR="src/core" . auto/modules.sh | 119 | MODULE_DIR="src/core" . auto/modules.sh |
| 114 | CORE_OBJS="${MODULE_OBJS[@]}" | 120 | CORE_OBJS="${MODULE_OBJS[@]}" |
| 115 | 121 | ||
| @@ -125,7 +131,10 @@ MAIN_OBJS="${MODULE_OBJS[@].o}" | @@ -125,7 +131,10 @@ MAIN_OBJS="${MODULE_OBJS[@].o}" | ||
| 125 | MAIN_ENTRANCES=("srs_main_server") | 131 | MAIN_ENTRANCES=("srs_main_server") |
| 126 | 132 | ||
| 127 | # srs(simple rtmp server) over st(state-threads) | 133 | # srs(simple rtmp server) over st(state-threads) |
| 128 | -ModuleLibFiles=(${LibSTfile} ${LibHttpParserfile}) | 134 | +ModuleLibFiles=(${LibSTfile}) |
| 135 | +if [ $SRS_HTTP = YES ]; then | ||
| 136 | + ModuleLibFiles="${ModuleLibFiles[@]} ${LibHttpParserfile}" | ||
| 137 | +fi | ||
| 129 | MODULE_OBJS="${CORE_OBJS[@]} ${CONFIG_OBJS[@]} ${PROTOCOL_OBJS[@]} ${MAIN_OBJS[@]}" | 138 | MODULE_OBJS="${CORE_OBJS[@]} ${CONFIG_OBJS[@]} ${PROTOCOL_OBJS[@]} ${MAIN_OBJS[@]}" |
| 130 | if [ $SRS_SSL = YES ]; then | 139 | if [ $SRS_SSL = YES ]; then |
| 131 | LINK_OPTIONS="-ldl -lssl -lcrypto" | 140 | LINK_OPTIONS="-ldl -lssl -lcrypto" |
trunk/src/core/srs_core.cpp
100755 → 100644
| @@ -242,6 +242,15 @@ int SrsClient::check_vhost() | @@ -242,6 +242,15 @@ int SrsClient::check_vhost() | ||
| 242 | req->vhost = vhost->arg0(); | 242 | req->vhost = vhost->arg0(); |
| 243 | } | 243 | } |
| 244 | 244 | ||
| 245 | +#ifdef SRS_HTTP | ||
| 246 | + // HTTP: on_connect | ||
| 247 | + std::string on_connect = config->get_vhost_on_connect(req->vhost); | ||
| 248 | + if (on_connect.empty()) { | ||
| 249 | + srs_info("ignore the empty http callback: on_connect"); | ||
| 250 | + return ret; | ||
| 251 | + } | ||
| 252 | +#endif | ||
| 253 | + | ||
| 245 | return ret; | 254 | return ret; |
| 246 | } | 255 | } |
| 247 | 256 |
trunk/src/core/srs_core_http.cpp
0 → 100644
| 1 | +/* | ||
| 2 | +The MIT License (MIT) | ||
| 3 | + | ||
| 4 | +Copyright (c) 2013 winlin | ||
| 5 | + | ||
| 6 | +Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
| 7 | +this software and associated documentation files (the "Software"), to deal in | ||
| 8 | +the Software without restriction, including without limitation the rights to | ||
| 9 | +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
| 10 | +the Software, and to permit persons to whom the Software is furnished to do so, | ||
| 11 | +subject to the following conditions: | ||
| 12 | + | ||
| 13 | +The above copyright notice and this permission notice shall be included in all | ||
| 14 | +copies or substantial portions of the Software. | ||
| 15 | + | ||
| 16 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 17 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
| 18 | +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
| 19 | +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
| 20 | +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
| 21 | +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 22 | +*/ | ||
| 23 | + | ||
| 24 | +#include <srs_core_http.hpp> | ||
| 25 | + | ||
| 26 | +#ifdef SRS_HTTP | ||
| 27 | +#endif |
trunk/src/core/srs_core_http.hpp
0 → 100644
| 1 | +/* | ||
| 2 | +The MIT License (MIT) | ||
| 3 | + | ||
| 4 | +Copyright (c) 2013 winlin | ||
| 5 | + | ||
| 6 | +Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
| 7 | +this software and associated documentation files (the "Software"), to deal in | ||
| 8 | +the Software without restriction, including without limitation the rights to | ||
| 9 | +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
| 10 | +the Software, and to permit persons to whom the Software is furnished to do so, | ||
| 11 | +subject to the following conditions: | ||
| 12 | + | ||
| 13 | +The above copyright notice and this permission notice shall be included in all | ||
| 14 | +copies or substantial portions of the Software. | ||
| 15 | + | ||
| 16 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 17 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
| 18 | +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
| 19 | +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
| 20 | +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
| 21 | +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 22 | +*/ | ||
| 23 | + | ||
| 24 | +#ifndef SRS_CORE_HTTP_HPP | ||
| 25 | +#define SRS_CORE_HTTP_HPP | ||
| 26 | + | ||
| 27 | +/* | ||
| 28 | +#include <srs_core_http.hpp> | ||
| 29 | +*/ | ||
| 30 | +#include <srs_core.hpp> | ||
| 31 | + | ||
| 32 | +#ifdef SRS_HTTP | ||
| 33 | +#endif | ||
| 34 | + | ||
| 35 | +#endif |
| @@ -22,6 +22,8 @@ file | @@ -22,6 +22,8 @@ file | ||
| 22 | ..\core\srs_core_conn.cpp, | 22 | ..\core\srs_core_conn.cpp, |
| 23 | ..\core\srs_core_client.hpp, | 23 | ..\core\srs_core_client.hpp, |
| 24 | ..\core\srs_core_client.cpp, | 24 | ..\core\srs_core_client.cpp, |
| 25 | + ..\core\srs_core_http.hpp, | ||
| 26 | + ..\core\srs_core_http.cpp, | ||
| 25 | ..\core\srs_core_source.hpp, | 27 | ..\core\srs_core_source.hpp, |
| 26 | ..\core\srs_core_source.cpp, | 28 | ..\core\srs_core_source.cpp, |
| 27 | ..\core\srs_core_forward.hpp, | 29 | ..\core\srs_core_forward.hpp, |
-
请 注册 或 登录 后发表评论