1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-13 03:41:55 +00:00

add http library, support in build script

This commit is contained in:
winlin 2013-12-07 20:51:27 +08:00
parent 3600be9796
commit bb22c3b5cd
7 changed files with 218 additions and 134 deletions

14
trunk/auto/depends.sh Normal file → Executable file
View file

@ -25,9 +25,10 @@ if [ ! -f ${SRS_OBJS}/st-1.9/obj/libst.so ]; then echo "build st-1.9 failed."; e
#####################################################################################
# http-parser-2.1
#####################################################################################
if [[ -f ${SRS_OBJS}/http-parser-2.1/http_parser.h && -f ${SRS_OBJS}/http-parser-2.1/libhttp_parser.a ]]; then
if [ $SRS_HTTP = YES ]; then
if [[ -f ${SRS_OBJS}/http-parser-2.1/http_parser.h && -f ${SRS_OBJS}/http-parser-2.1/libhttp_parser.a ]]; then
echo "http-parser-2.1 is ok.";
else
else
echo "build http-parser-2.1";
(
rm -rf ${SRS_OBJS}/http-parser-2.1 && cd ${SRS_OBJS} && unzip -q ../3rdparty/http-parser-2.1.zip &&
@ -37,11 +38,12 @@ else
make package &&
cd .. && rm -f hp && ln -sf http-parser-2.1 hp
)
fi
# check status
ret=$?; if [[ $ret -ne 0 ]]; then echo "build http-parser-2.1 failed, ret=$ret"; exit $ret; fi
if [[ ! -f ${SRS_OBJS}/http-parser-2.1/http_parser.h ]]; then echo "build http-parser-2.1 failed"; exit -1; fi
if [[ ! -f ${SRS_OBJS}/http-parser-2.1/libhttp_parser.a ]]; then echo "build http-parser-2.1 failed"; exit -1; fi
fi
# check status
ret=$?; if [[ $ret -ne 0 ]]; then echo "build http-parser-2.1 failed, ret=$ret"; exit $ret; fi
if [[ ! -f ${SRS_OBJS}/http-parser-2.1/http_parser.h ]]; then echo "build http-parser-2.1 failed"; exit -1; fi
if [[ ! -f ${SRS_OBJS}/http-parser-2.1/libhttp_parser.a ]]; then echo "build http-parser-2.1 failed"; exit -1; fi
#####################################################################################
# nginx for HLS, nginx-1.5.0

19
trunk/configure vendored
View file

@ -95,13 +95,18 @@ END
# Libraries
LibSTRoot="${SRS_OBJS}/st"
LibSTfile="${LibSTRoot}/libst.a"
LibHttpParserRoot="${SRS_OBJS}/hp"
LibHttpParserfile="${LibHttpParserRoot}/libhttp_parser.a"
if [ $SRS_HTTP = YES ]; then
LibHttpParserRoot="${SRS_OBJS}/hp"
LibHttpParserfile="${LibHttpParserRoot}/libhttp_parser.a"
fi
#Core Module
MODULE_ID="CORE"
MODULE_DEPENDS=()
ModuleLibIncs=(${LibSTRoot} ${LibHttpParserRoot} ${SRS_OBJS})
ModuleLibIncs=(${LibSTRoot} ${SRS_OBJS})
if [ $SRS_HTTP = YES ]; then
ModuleLibIncs="${ModuleLibIncs[@]} ${LibHttpParserRoot}"
fi
MODULE_FILES=("srs_core" "srs_core_log" "srs_core_server"
"srs_core_error" "srs_core_conn" "srs_core_client"
"srs_core_rtmp" "srs_core_socket" "srs_core_buffer"
@ -109,7 +114,8 @@ MODULE_FILES=("srs_core" "srs_core_log" "srs_core_server"
"srs_core_stream" "srs_core_source" "srs_core_codec"
"srs_core_handshake" "srs_core_pithy_print"
"srs_core_config" "srs_core_refer" "srs_core_reload"
"srs_core_hls" "srs_core_forward" "srs_core_encoder")
"srs_core_hls" "srs_core_forward" "srs_core_encoder"
"srs_core_http")
MODULE_DIR="src/core" . auto/modules.sh
CORE_OBJS="${MODULE_OBJS[@]}"
@ -125,7 +131,10 @@ MAIN_OBJS="${MODULE_OBJS[@].o}"
MAIN_ENTRANCES=("srs_main_server")
# srs(simple rtmp server) over st(state-threads)
ModuleLibFiles=(${LibSTfile} ${LibHttpParserfile})
ModuleLibFiles=(${LibSTfile})
if [ $SRS_HTTP = YES ]; then
ModuleLibFiles="${ModuleLibFiles[@]} ${LibHttpParserfile}"
fi
MODULE_OBJS="${CORE_OBJS[@]} ${CONFIG_OBJS[@]} ${PROTOCOL_OBJS[@]} ${MAIN_OBJS[@]}"
if [ $SRS_SSL = YES ]; then
LINK_OPTIONS="-ldl -lssl -lcrypto"

0
trunk/src/core/srs_core.cpp Executable file → Normal file
View file

View file

@ -242,6 +242,15 @@ int SrsClient::check_vhost()
req->vhost = vhost->arg0();
}
#ifdef SRS_HTTP
// HTTP: on_connect
std::string on_connect = config->get_vhost_on_connect(req->vhost);
if (on_connect.empty()) {
srs_info("ignore the empty http callback: on_connect");
return ret;
}
#endif
return ret;
}

View file

@ -0,0 +1,27 @@
/*
The MIT License (MIT)
Copyright (c) 2013 winlin
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <srs_core_http.hpp>
#ifdef SRS_HTTP
#endif

View file

@ -0,0 +1,35 @@
/*
The MIT License (MIT)
Copyright (c) 2013 winlin
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef SRS_CORE_HTTP_HPP
#define SRS_CORE_HTTP_HPP
/*
#include <srs_core_http.hpp>
*/
#include <srs_core.hpp>
#ifdef SRS_HTTP
#endif
#endif

View file

@ -22,6 +22,8 @@ file
..\core\srs_core_conn.cpp,
..\core\srs_core_client.hpp,
..\core\srs_core_client.cpp,
..\core\srs_core_http.hpp,
..\core\srs_core_http.cpp,
..\core\srs_core_source.hpp,
..\core\srs_core_source.cpp,
..\core\srs_core_forward.hpp,