winlin

fix bug of configure.

@@ -76,10 +76,10 @@ fi @@ -76,10 +76,10 @@ fi
76 echo "" >> $SRS_AUTO_HEADERS_H 76 echo "" >> $SRS_AUTO_HEADERS_H
77 77
78 # auto headers in depends. 78 # auto headers in depends.
79 -if [ $SRS_HTTP_PARSER = YES ]; then  
80 - echo "#define SRS_AUTO_HTTP_PARSER" >> $SRS_AUTO_HEADERS_H 79 +if [ $SRS_HTTP_CORE = YES ]; then
  80 + echo "#define SRS_AUTO_HTTP_CORE" >> $SRS_AUTO_HEADERS_H
81 else 81 else
82 - echo "#undef SRS_AUTO_HTTP_PARSER" >> $SRS_AUTO_HEADERS_H 82 + echo "#undef SRS_AUTO_HTTP_CORE" >> $SRS_AUTO_HEADERS_H
83 fi 83 fi
84 84
85 if [ $SRS_HTTP_SERVER = YES ]; then 85 if [ $SRS_HTTP_SERVER = YES ]; then
@@ -426,7 +426,7 @@ fi @@ -426,7 +426,7 @@ fi
426 # http-parser-2.1 426 # http-parser-2.1
427 ##################################################################################### 427 #####################################################################################
428 # check the arm flag file, if flag changed, need to rebuild the st. 428 # check the arm flag file, if flag changed, need to rebuild the st.
429 -if [ $SRS_HTTP_PARSER = YES ]; then 429 +if [ $SRS_HTTP_CORE = YES ]; then
430 # ok, arm specified, if the flag filed does not exists, need to rebuild. 430 # ok, arm specified, if the flag filed does not exists, need to rebuild.
431 if [ $SRS_EMBEDED_CPU = YES ]; then 431 if [ $SRS_EMBEDED_CPU = YES ]; then
432 if [[ -f ${SRS_OBJS}/_flag.st.hp.tmp && -f ${SRS_OBJS}/hp/http_parser.h && -f ${SRS_OBJS}/hp/libhttp_parser.a ]]; then 432 if [[ -f ${SRS_OBJS}/_flag.st.hp.tmp && -f ${SRS_OBJS}/hp/http_parser.h && -f ${SRS_OBJS}/hp/libhttp_parser.a ]]; then
@@ -45,7 +45,7 @@ SRS_GPROF=RESERVED @@ -45,7 +45,7 @@ SRS_GPROF=RESERVED
45 ################################################################ 45 ################################################################
46 # libraries 46 # libraries
47 SRS_FFMPEG_STUB=RESERVED 47 SRS_FFMPEG_STUB=RESERVED
48 -SRS_HTTP_PARSER=RESERVED 48 +SRS_HTTP_CORE=RESERVED
49 # arguments 49 # arguments
50 SRS_PREFIX=/usr/local/srs 50 SRS_PREFIX=/usr/local/srs
51 SRS_JOBS=1 51 SRS_JOBS=1
@@ -376,7 +376,7 @@ function apply_user_presets() { @@ -376,7 +376,7 @@ function apply_user_presets() {
376 SRS_TRANSCODE=NO 376 SRS_TRANSCODE=NO
377 SRS_INGEST=NO 377 SRS_INGEST=NO
378 SRS_STAT=NO 378 SRS_STAT=NO
379 - SRS_HTTP_PARSER=NO 379 + SRS_HTTP_CORE=NO
380 SRS_HTTP_CALLBACK=NO 380 SRS_HTTP_CALLBACK=NO
381 SRS_HTTP_SERVER=NO 381 SRS_HTTP_SERVER=NO
382 SRS_STREAM_CASTER=NO 382 SRS_STREAM_CASTER=NO
@@ -403,7 +403,7 @@ function apply_user_presets() { @@ -403,7 +403,7 @@ function apply_user_presets() {
403 SRS_TRANSCODE=YES 403 SRS_TRANSCODE=YES
404 SRS_INGEST=YES 404 SRS_INGEST=YES
405 SRS_STAT=YES 405 SRS_STAT=YES
406 - SRS_HTTP_PARSER=YES 406 + SRS_HTTP_CORE=YES
407 SRS_HTTP_CALLBACK=YES 407 SRS_HTTP_CALLBACK=YES
408 SRS_HTTP_SERVER=YES 408 SRS_HTTP_SERVER=YES
409 SRS_STREAM_CASTER=YES 409 SRS_STREAM_CASTER=YES
@@ -430,7 +430,7 @@ function apply_user_presets() { @@ -430,7 +430,7 @@ function apply_user_presets() {
430 SRS_TRANSCODE=NO 430 SRS_TRANSCODE=NO
431 SRS_INGEST=NO 431 SRS_INGEST=NO
432 SRS_STAT=NO 432 SRS_STAT=NO
433 - SRS_HTTP_PARSER=NO 433 + SRS_HTTP_CORE=NO
434 SRS_HTTP_CALLBACK=NO 434 SRS_HTTP_CALLBACK=NO
435 SRS_HTTP_SERVER=NO 435 SRS_HTTP_SERVER=NO
436 SRS_STREAM_CASTER=NO 436 SRS_STREAM_CASTER=NO
@@ -457,7 +457,7 @@ function apply_user_presets() { @@ -457,7 +457,7 @@ function apply_user_presets() {
457 SRS_TRANSCODE=NO 457 SRS_TRANSCODE=NO
458 SRS_INGEST=NO 458 SRS_INGEST=NO
459 SRS_STAT=NO 459 SRS_STAT=NO
460 - SRS_HTTP_PARSER=NO 460 + SRS_HTTP_CORE=NO
461 SRS_HTTP_CALLBACK=NO 461 SRS_HTTP_CALLBACK=NO
462 SRS_HTTP_SERVER=NO 462 SRS_HTTP_SERVER=NO
463 SRS_STREAM_CASTER=NO 463 SRS_STREAM_CASTER=NO
@@ -484,7 +484,7 @@ function apply_user_presets() { @@ -484,7 +484,7 @@ function apply_user_presets() {
484 SRS_TRANSCODE=NO 484 SRS_TRANSCODE=NO
485 SRS_INGEST=NO 485 SRS_INGEST=NO
486 SRS_STAT=NO 486 SRS_STAT=NO
487 - SRS_HTTP_PARSER=NO 487 + SRS_HTTP_CORE=NO
488 SRS_HTTP_CALLBACK=NO 488 SRS_HTTP_CALLBACK=NO
489 SRS_HTTP_SERVER=NO 489 SRS_HTTP_SERVER=NO
490 SRS_STREAM_CASTER=NO 490 SRS_STREAM_CASTER=NO
@@ -511,7 +511,7 @@ function apply_user_presets() { @@ -511,7 +511,7 @@ function apply_user_presets() {
511 SRS_TRANSCODE=YES 511 SRS_TRANSCODE=YES
512 SRS_INGEST=YES 512 SRS_INGEST=YES
513 SRS_STAT=YES 513 SRS_STAT=YES
514 - SRS_HTTP_PARSER=YES 514 + SRS_HTTP_CORE=YES
515 SRS_HTTP_CALLBACK=YES 515 SRS_HTTP_CALLBACK=YES
516 SRS_HTTP_SERVER=YES 516 SRS_HTTP_SERVER=YES
517 SRS_STREAM_CASTER=NO 517 SRS_STREAM_CASTER=NO
@@ -539,7 +539,7 @@ function apply_user_presets() { @@ -539,7 +539,7 @@ function apply_user_presets() {
539 SRS_TRANSCODE=YES 539 SRS_TRANSCODE=YES
540 SRS_INGEST=YES 540 SRS_INGEST=YES
541 SRS_STAT=YES 541 SRS_STAT=YES
542 - SRS_HTTP_PARSER=YES 542 + SRS_HTTP_CORE=YES
543 SRS_HTTP_CALLBACK=YES 543 SRS_HTTP_CALLBACK=YES
544 SRS_HTTP_SERVER=YES 544 SRS_HTTP_SERVER=YES
545 SRS_STREAM_CASTER=NO 545 SRS_STREAM_CASTER=NO
@@ -566,7 +566,7 @@ function apply_user_presets() { @@ -566,7 +566,7 @@ function apply_user_presets() {
566 SRS_TRANSCODE=YES 566 SRS_TRANSCODE=YES
567 SRS_INGEST=YES 567 SRS_INGEST=YES
568 SRS_STAT=YES 568 SRS_STAT=YES
569 - SRS_HTTP_PARSER=YES 569 + SRS_HTTP_CORE=YES
570 SRS_HTTP_CALLBACK=YES 570 SRS_HTTP_CALLBACK=YES
571 SRS_HTTP_SERVER=YES 571 SRS_HTTP_SERVER=YES
572 SRS_STREAM_CASTER=NO 572 SRS_STREAM_CASTER=NO
@@ -593,7 +593,7 @@ function apply_user_presets() { @@ -593,7 +593,7 @@ function apply_user_presets() {
593 SRS_TRANSCODE=YES 593 SRS_TRANSCODE=YES
594 SRS_INGEST=YES 594 SRS_INGEST=YES
595 SRS_STAT=YES 595 SRS_STAT=YES
596 - SRS_HTTP_PARSER=YES 596 + SRS_HTTP_CORE=YES
597 SRS_HTTP_CALLBACK=YES 597 SRS_HTTP_CALLBACK=YES
598 SRS_HTTP_SERVER=YES 598 SRS_HTTP_SERVER=YES
599 SRS_STREAM_CASTER=NO 599 SRS_STREAM_CASTER=NO
@@ -620,7 +620,7 @@ function apply_user_presets() { @@ -620,7 +620,7 @@ function apply_user_presets() {
620 SRS_TRANSCODE=YES 620 SRS_TRANSCODE=YES
621 SRS_INGEST=YES 621 SRS_INGEST=YES
622 SRS_STAT=YES 622 SRS_STAT=YES
623 - SRS_HTTP_PARSER=YES 623 + SRS_HTTP_CORE=YES
624 SRS_HTTP_CALLBACK=YES 624 SRS_HTTP_CALLBACK=YES
625 SRS_HTTP_SERVER=YES 625 SRS_HTTP_SERVER=YES
626 SRS_STREAM_CASTER=NO 626 SRS_STREAM_CASTER=NO
@@ -647,7 +647,7 @@ function apply_user_presets() { @@ -647,7 +647,7 @@ function apply_user_presets() {
647 SRS_TRANSCODE=YES 647 SRS_TRANSCODE=YES
648 SRS_INGEST=YES 648 SRS_INGEST=YES
649 SRS_STAT=YES 649 SRS_STAT=YES
650 - SRS_HTTP_PARSER=YES 650 + SRS_HTTP_CORE=YES
651 SRS_HTTP_CALLBACK=YES 651 SRS_HTTP_CALLBACK=YES
652 SRS_HTTP_SERVER=YES 652 SRS_HTTP_SERVER=YES
653 SRS_STREAM_CASTER=NO 653 SRS_STREAM_CASTER=NO
@@ -674,7 +674,7 @@ function apply_user_presets() { @@ -674,7 +674,7 @@ function apply_user_presets() {
674 SRS_TRANSCODE=YES 674 SRS_TRANSCODE=YES
675 SRS_INGEST=YES 675 SRS_INGEST=YES
676 SRS_STAT=YES 676 SRS_STAT=YES
677 - SRS_HTTP_PARSER=YES 677 + SRS_HTTP_CORE=YES
678 SRS_HTTP_CALLBACK=YES 678 SRS_HTTP_CALLBACK=YES
679 SRS_HTTP_SERVER=YES 679 SRS_HTTP_SERVER=YES
680 SRS_STREAM_CASTER=NO 680 SRS_STREAM_CASTER=NO
@@ -701,7 +701,7 @@ function apply_user_presets() { @@ -701,7 +701,7 @@ function apply_user_presets() {
701 SRS_TRANSCODE=YES 701 SRS_TRANSCODE=YES
702 SRS_INGEST=YES 702 SRS_INGEST=YES
703 SRS_STAT=YES 703 SRS_STAT=YES
704 - SRS_HTTP_PARSER=YES 704 + SRS_HTTP_CORE=YES
705 SRS_HTTP_CALLBACK=YES 705 SRS_HTTP_CALLBACK=YES
706 SRS_HTTP_SERVER=YES 706 SRS_HTTP_SERVER=YES
707 SRS_STREAM_CASTER=NO 707 SRS_STREAM_CASTER=NO
@@ -728,7 +728,7 @@ function apply_user_presets() { @@ -728,7 +728,7 @@ function apply_user_presets() {
728 SRS_TRANSCODE=YES 728 SRS_TRANSCODE=YES
729 SRS_INGEST=YES 729 SRS_INGEST=YES
730 SRS_STAT=YES 730 SRS_STAT=YES
731 - SRS_HTTP_PARSER=YES 731 + SRS_HTTP_CORE=YES
732 SRS_HTTP_CALLBACK=YES 732 SRS_HTTP_CALLBACK=YES
733 SRS_HTTP_SERVER=YES 733 SRS_HTTP_SERVER=YES
734 SRS_STREAM_CASTER=NO 734 SRS_STREAM_CASTER=NO
@@ -761,11 +761,11 @@ function apply_user_detail_options() { @@ -761,11 +761,11 @@ function apply_user_detail_options() {
761 if [ $SRS_TRANSCODE = YES ]; then SRS_FFMPEG_STUB=YES; fi 761 if [ $SRS_TRANSCODE = YES ]; then SRS_FFMPEG_STUB=YES; fi
762 if [ $SRS_INGEST = YES ]; then SRS_FFMPEG_STUB=YES; fi 762 if [ $SRS_INGEST = YES ]; then SRS_FFMPEG_STUB=YES; fi
763 763
764 - # if http-xxxx specified, open the SRS_HTTP_PARSER  
765 - SRS_HTTP_PARSER=NO  
766 - if [ $SRS_HTTP_CALLBACK = YES ]; then SRS_HTTP_PARSER=YES; fi  
767 - if [ $SRS_HTTP_SERVER = YES ]; then SRS_HTTP_PARSER=YES; fi  
768 - if [ $SRS_HTTP_API = YES ]; then SRS_HTTP_PARSER=YES; fi 764 + # if http-xxxx specified, open the SRS_HTTP_CORE
  765 + SRS_HTTP_CORE=NO
  766 + if [ $SRS_HTTP_CALLBACK = YES ]; then SRS_HTTP_CORE=YES; fi
  767 + if [ $SRS_HTTP_SERVER = YES ]; then SRS_HTTP_CORE=YES; fi
  768 + if [ $SRS_HTTP_API = YES ]; then SRS_HTTP_CORE=YES; fi
769 769
770 # parse the jobs for make 770 # parse the jobs for make
771 if [[ "" -eq SRS_JOBS ]]; then 771 if [[ "" -eq SRS_JOBS ]]; then
@@ -790,7 +790,7 @@ function apply_user_detail_options() { @@ -790,7 +790,7 @@ function apply_user_detail_options() {
790 SRS_TRANSCODE=NO 790 SRS_TRANSCODE=NO
791 SRS_INGEST=NO 791 SRS_INGEST=NO
792 SRS_STAT=NO 792 SRS_STAT=NO
793 - SRS_HTTP_PARSER=NO 793 + SRS_HTTP_CORE=NO
794 SRS_HTTP_CALLBACK=NO 794 SRS_HTTP_CALLBACK=NO
795 SRS_HTTP_SERVER=NO 795 SRS_HTTP_SERVER=NO
796 SRS_STREAM_CASTER=NO 796 SRS_STREAM_CASTER=NO
@@ -855,13 +855,14 @@ function check_option_conflicts() { @@ -855,13 +855,14 @@ function check_option_conflicts() {
855 if [ $SRS_GPERF_MP = YES ]; then echo "gperf-mp depends on gperf, see: ./configure --help"; __check_ok=NO; fi 855 if [ $SRS_GPERF_MP = YES ]; then echo "gperf-mp depends on gperf, see: ./configure --help"; __check_ok=NO; fi
856 if [ $SRS_GPERF_CP = YES ]; then echo "gperf-cp depends on gperf, see: ./configure --help"; __check_ok=NO; fi 856 if [ $SRS_GPERF_CP = YES ]; then echo "gperf-cp depends on gperf, see: ./configure --help"; __check_ok=NO; fi
857 fi 857 fi
858 - if [ $SRS_GPERF_MC = YES ]; then  
859 - if [ $SRS_GPERF_MP = YES ]; then  
860 - echo "gperf-mc not compatible with gperf-mp, see: ./configure --help";  
861 - echo "@see: http://google-perftools.googlecode.com/svn/trunk/doc/heap_checker.html";  
862 - echo "Note that since the heap-checker uses the heap-profiling framework internally, it is not possible to run both the heap-checker and heap profiler at the same time";  
863 - __check_ok=NO  
864 - fi 858 + if [[ $SRS_GPERF_MC = YES && $SRS_GPERF_MP = YES ]]; then
  859 + echo "gperf-mc not compatible with gperf-mp, see: ./configure --help";
  860 + echo "@see: http://google-perftools.googlecode.com/svn/trunk/doc/heap_checker.html";
  861 + echo "Note that since the heap-checker uses the heap-profiling framework internally, it is not possible to run both the heap-checker and heap profiler at the same time";
  862 + __check_ok=NO
  863 + fi
  864 + if [[ $SRS_HTTP_CORE = NO && $SRS_STREAM_CASTER = YES ]]; then
  865 + echo "stream-caster depends on http-api or http-server, see: ./configure --help"; __check_ok=NO;
865 fi 866 fi
866 # generate the group option: SRS_GPERF 867 # generate the group option: SRS_GPERF
867 __gperf_slow=NO 868 __gperf_slow=NO
@@ -885,10 +886,8 @@ function check_option_conflicts() { @@ -885,10 +886,8 @@ function check_option_conflicts() {
885 fi 886 fi
886 887
887 # if x86/x64 or directly build, never use static 888 # if x86/x64 or directly build, never use static
888 - if [ $SRS_X86_X64 = YES ]; then  
889 - if [ $SRS_STATIC = YES ]; then  
890 - echo "x86/x64 should never use static, see: ./configure --help"; __check_ok=NO;  
891 - fi 889 + if [[ $SRS_X86_X64 = YES && $SRS_STATIC = YES ]]; then
  890 + echo "x86/x64 should never use static, see: ./configure --help"; __check_ok=NO;
892 fi 891 fi
893 892
894 # TODO: FIXME: check more os. 893 # TODO: FIXME: check more os.
@@ -115,7 +115,7 @@ END @@ -115,7 +115,7 @@ END
115 LibSTRoot="${SRS_OBJS_DIR}/st"; LibSTfile="${LibSTRoot}/libst.a" 115 LibSTRoot="${SRS_OBJS_DIR}/st"; LibSTfile="${LibSTRoot}/libst.a"
116 # hp(http-parser) the http request/url parser, for SRS to support HTTP callback. 116 # hp(http-parser) the http request/url parser, for SRS to support HTTP callback.
117 LibHttpParserRoot=""; LibHttpParserfile="" 117 LibHttpParserRoot=""; LibHttpParserfile=""
118 -if [ $SRS_HTTP_PARSER = YES ]; then LibHttpParserRoot="${SRS_OBJS_DIR}/hp"; LibHttpParserfile="${LibHttpParserRoot}/libhttp_parser.a"; fi 118 +if [ $SRS_HTTP_CORE = YES ]; then LibHttpParserRoot="${SRS_OBJS_DIR}/hp"; LibHttpParserfile="${LibHttpParserRoot}/libhttp_parser.a"; fi
119 # openssl-1.0.1f, for the RTMP complex handshake. 119 # openssl-1.0.1f, for the RTMP complex handshake.
120 LibSSLRoot="";LibSSLfile="" 120 LibSSLRoot="";LibSSLfile=""
121 if [ $SRS_SSL = YES ]; then if [ $SRS_USE_SYS_SSL = NO ]; then LibSSLRoot="${SRS_OBJS_DIR}/openssl/include"; LibSSLfile="${SRS_OBJS_DIR}/openssl/lib/libssl.a ${SRS_OBJS_DIR}/openssl/lib/libcrypto.a"; fi fi 121 if [ $SRS_SSL = YES ]; then if [ $SRS_USE_SYS_SSL = NO ]; then LibSSLRoot="${SRS_OBJS_DIR}/openssl/include"; LibSSLfile="${SRS_OBJS_DIR}/openssl/lib/libssl.a ${SRS_OBJS_DIR}/openssl/lib/libcrypto.a"; fi fi
@@ -33,7 +33,6 @@ using namespace std; @@ -33,7 +33,6 @@ using namespace std;
33 #include <srs_kernel_log.hpp> 33 #include <srs_kernel_log.hpp>
34 #include <srs_app_config.hpp> 34 #include <srs_app_config.hpp>
35 #include <srs_app_pithy_print.hpp> 35 #include <srs_app_pithy_print.hpp>
36 -#include <srs_app_http.hpp>  
37 #include <srs_app_http_conn.hpp> 36 #include <srs_app_http_conn.hpp>
38 #include <srs_core_autofree.hpp> 37 #include <srs_core_autofree.hpp>
39 #include <srs_kernel_flv.hpp> 38 #include <srs_kernel_flv.hpp>
@@ -89,9 +88,10 @@ void SrsAppCasterFlv::remove(SrsConnection* c) @@ -89,9 +88,10 @@ void SrsAppCasterFlv::remove(SrsConnection* c)
89 } 88 }
90 } 89 }
91 90
92 -int SrsAppCasterFlv::serve_http(ISrsHttpResponseWriter* w, SrsHttpMessage* r) 91 +int SrsAppCasterFlv::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r)
93 { 92 {
94 - SrsDynamicHttpConn* conn = dynamic_cast<SrsDynamicHttpConn*>(r->connection()); 93 + SrsHttpMessage* msg = dynamic_cast<SrsHttpMessage*>(r);
  94 + SrsDynamicHttpConn* conn = dynamic_cast<SrsDynamicHttpConn*>(msg->connection());
95 srs_assert(conn); 95 srs_assert(conn);
96 96
97 std::string app = srs_path_dirname(r->path()); 97 std::string app = srs_path_dirname(r->path());
@@ -134,13 +134,13 @@ SrsDynamicHttpConn::~SrsDynamicHttpConn() @@ -134,13 +134,13 @@ SrsDynamicHttpConn::~SrsDynamicHttpConn()
134 srs_freep(pprint); 134 srs_freep(pprint);
135 } 135 }
136 136
137 -int SrsDynamicHttpConn::on_got_http_message(SrsHttpMessage* msg) 137 +int SrsDynamicHttpConn::on_got_http_message(ISrsHttpMessage* msg)
138 { 138 {
139 int ret = ERROR_SUCCESS; 139 int ret = ERROR_SUCCESS;
140 return ret; 140 return ret;
141 } 141 }
142 142
143 -int SrsDynamicHttpConn::proxy(ISrsHttpResponseWriter* w, SrsHttpMessage* r, std::string o) 143 +int SrsDynamicHttpConn::proxy(ISrsHttpResponseWriter* w, ISrsHttpMessage* r, std::string o)
144 { 144 {
145 int ret = ERROR_SUCCESS; 145 int ret = ERROR_SUCCESS;
146 146
@@ -430,7 +430,7 @@ int SrsHttpFileReader::read(void* buf, size_t count, ssize_t* pnread) @@ -430,7 +430,7 @@ int SrsHttpFileReader::read(void* buf, size_t count, ssize_t* pnread)
430 } 430 }
431 431
432 int total_read = 0; 432 int total_read = 0;
433 - while (total_read < count) { 433 + while (total_read < (int)count) {
434 int nread = 0; 434 int nread = 0;
435 if ((ret = http->read((char*)buf + total_read, (int)(count - total_read), &nread)) != ERROR_SUCCESS) { 435 if ((ret = http->read((char*)buf + total_read, (int)(count - total_read), &nread)) != ERROR_SUCCESS) {
436 return ret; 436 return ret;
@@ -37,7 +37,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -37,7 +37,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
37 37
38 class SrsConfDirective; 38 class SrsConfDirective;
39 class SrsHttpServeMux; 39 class SrsHttpServeMux;
40 -class SrsHttpConn;  
41 class SrsRtmpClient; 40 class SrsRtmpClient;
42 class SrsStSocket; 41 class SrsStSocket;
43 class SrsRequest; 42 class SrsRequest;
@@ -48,7 +47,6 @@ class SrsFlvDecoder; @@ -48,7 +47,6 @@ class SrsFlvDecoder;
48 #include <srs_app_st.hpp> 47 #include <srs_app_st.hpp>
49 #include <srs_app_listener.hpp> 48 #include <srs_app_listener.hpp>
50 #include <srs_app_conn.hpp> 49 #include <srs_app_conn.hpp>
51 -#include <srs_app_http.hpp>  
52 #include <srs_app_http_conn.hpp> 50 #include <srs_app_http_conn.hpp>
53 #include <srs_kernel_file.hpp> 51 #include <srs_kernel_file.hpp>
54 52
@@ -75,7 +73,7 @@ public: @@ -75,7 +73,7 @@ public:
75 virtual void remove(SrsConnection* c); 73 virtual void remove(SrsConnection* c);
76 // ISrsHttpHandler 74 // ISrsHttpHandler
77 public: 75 public:
78 - virtual int serve_http(ISrsHttpResponseWriter* w, SrsHttpMessage* r); 76 + virtual int serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r);
79 }; 77 };
80 78
81 /** 79 /**
@@ -96,9 +94,9 @@ public: @@ -96,9 +94,9 @@ public:
96 SrsDynamicHttpConn(IConnectionManager* cm, st_netfd_t fd, SrsHttpServeMux* m); 94 SrsDynamicHttpConn(IConnectionManager* cm, st_netfd_t fd, SrsHttpServeMux* m);
97 virtual ~SrsDynamicHttpConn(); 95 virtual ~SrsDynamicHttpConn();
98 public: 96 public:
99 - virtual int on_got_http_message(SrsHttpMessage* msg); 97 + virtual int on_got_http_message(ISrsHttpMessage* msg);
100 public: 98 public:
101 - virtual int proxy(ISrsHttpResponseWriter* w, SrsHttpMessage* r, std::string o); 99 + virtual int proxy(ISrsHttpResponseWriter* w, ISrsHttpMessage* r, std::string o);
102 private: 100 private:
103 virtual int do_proxy(ISrsHttpResponseReader* rr, SrsFlvDecoder* dec); 101 virtual int do_proxy(ISrsHttpResponseReader* rr, SrsFlvDecoder* dec);
104 virtual int rtmp_write_packet(char type, u_int32_t timestamp, char* data, int size); 102 virtual int rtmp_write_packet(char type, u_int32_t timestamp, char* data, int size);
@@ -23,7 +23,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -23,7 +23,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 23
24 #include <srs_app_heartbeat.hpp> 24 #include <srs_app_heartbeat.hpp>
25 25
26 -#ifdef SRS_AUTO_HTTP_PARSER 26 +#ifdef SRS_AUTO_HTTP_CORE
27 27
28 #include <sstream> 28 #include <sstream>
29 using namespace std; 29 using namespace std;
@@ -29,7 +29,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -29,7 +29,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 */ 29 */
30 #include <srs_core.hpp> 30 #include <srs_core.hpp>
31 31
32 -#ifdef SRS_AUTO_HTTP_PARSER 32 +#ifdef SRS_AUTO_HTTP_CORE
33 33
34 /** 34 /**
35 * the http heartbeat to api-server to notice api 35 * the http heartbeat to api-server to notice api
@@ -23,7 +23,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -23,7 +23,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 23
24 #include <srs_app_http_client.hpp> 24 #include <srs_app_http_client.hpp>
25 25
26 -#ifdef SRS_AUTO_HTTP_PARSER 26 +#ifdef SRS_AUTO_HTTP_CORE
27 27
28 #include <arpa/inet.h> 28 #include <arpa/inet.h>
29 29
@@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 31
32 #include <string> 32 #include <string>
33 33
34 -#ifdef SRS_AUTO_HTTP_PARSER 34 +#ifdef SRS_AUTO_HTTP_CORE
35 35
36 #include <srs_app_st.hpp> 36 #include <srs_app_st.hpp>
37 37
@@ -23,7 +23,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -23,7 +23,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 23
24 #include <srs_app_http_conn.hpp> 24 #include <srs_app_http_conn.hpp>
25 25
26 -#if defined(SRS_AUTO_HTTP_PARSER) || defined(SRS_AUTO_HTTP_SERVER) 26 +#if defined(SRS_AUTO_HTTP_CORE) || defined(SRS_AUTO_HTTP_SERVER)
27 27
28 #include <sys/types.h> 28 #include <sys/types.h>
29 #include <sys/stat.h> 29 #include <sys/stat.h>
@@ -55,7 +55,7 @@ using namespace std; @@ -55,7 +55,7 @@ using namespace std;
55 55
56 #endif 56 #endif
57 57
58 -#ifdef SRS_AUTO_HTTP_PARSER 58 +#ifdef SRS_AUTO_HTTP_CORE
59 59
60 SrsHttpResponseWriter::SrsHttpResponseWriter(SrsStSocket* io) 60 SrsHttpResponseWriter::SrsHttpResponseWriter(SrsStSocket* io)
61 { 61 {
@@ -2423,6 +2423,9 @@ int SrsHttpServer::initialize_hls_streaming() @@ -2423,6 +2423,9 @@ int SrsHttpServer::initialize_hls_streaming()
2423 return ret; 2423 return ret;
2424 } 2424 }
2425 2425
  2426 +#endif
  2427 +
  2428 +#ifdef SRS_AUTO_HTTP_CORE
2426 SrsHttpConn::SrsHttpConn(IConnectionManager* cm, st_netfd_t fd, SrsHttpServeMux* m) 2429 SrsHttpConn::SrsHttpConn(IConnectionManager* cm, st_netfd_t fd, SrsHttpServeMux* m)
2427 : SrsConnection(cm, fd) 2430 : SrsConnection(cm, fd)
2428 { 2431 {
@@ -30,11 +30,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -30,11 +30,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 30
31 #include <srs_core.hpp> 31 #include <srs_core.hpp>
32 32
33 -#ifdef SRS_AUTO_HTTP_PARSER 33 +#ifdef SRS_AUTO_HTTP_CORE
34 #include <http_parser.h> 34 #include <http_parser.h>
35 #endif 35 #endif
36 36
37 -#if defined(SRS_AUTO_HTTP_PARSER) || defined(SRS_AUTO_HTTP_SERVER) 37 +#ifdef SRS_AUTO_HTTP_CORE
38 38
39 #include <map> 39 #include <map>
40 #include <string> 40 #include <string>
@@ -69,7 +69,7 @@ class SrsHttpMessage; @@ -69,7 +69,7 @@ class SrsHttpMessage;
69 69
70 #endif 70 #endif
71 71
72 -#ifdef SRS_AUTO_HTTP_PARSER 72 +#ifdef SRS_AUTO_HTTP_CORE
73 73
74 // the http chunked header size, 74 // the http chunked header size,
75 // for writev, there always one chunk to send it. 75 // for writev, there always one chunk to send it.
@@ -214,7 +214,7 @@ public: @@ -214,7 +214,7 @@ public:
214 virtual int update(std::string url, http_parser* header, 214 virtual int update(std::string url, http_parser* header,
215 SrsFastBuffer* body, std::vector<SrsHttpHeaderField>& headers 215 SrsFastBuffer* body, std::vector<SrsHttpHeaderField>& headers
216 ); 216 );
217 -private: 217 +public:
218 virtual SrsConnection* connection(); 218 virtual SrsConnection* connection();
219 public: 219 public:
220 virtual u_int8_t method(); 220 virtual u_int8_t method();
@@ -711,6 +711,9 @@ private: @@ -711,6 +711,9 @@ private:
711 virtual int initialize_hls_streaming(); 711 virtual int initialize_hls_streaming();
712 }; 712 };
713 713
  714 +#endif
  715 +
  716 +#ifdef SRS_AUTO_HTTP_CORE
714 class SrsHttpConn : public SrsConnection 717 class SrsHttpConn : public SrsConnection
715 { 718 {
716 private: 719 private:
@@ -495,7 +495,7 @@ SrsServer::SrsServer() @@ -495,7 +495,7 @@ SrsServer::SrsServer()
495 #ifdef SRS_AUTO_HTTP_SERVER 495 #ifdef SRS_AUTO_HTTP_SERVER
496 http_stream_mux = new SrsHttpServer(this); 496 http_stream_mux = new SrsHttpServer(this);
497 #endif 497 #endif
498 -#ifdef SRS_AUTO_HTTP_PARSER 498 +#ifdef SRS_AUTO_HTTP_CORE
499 http_heartbeat = NULL; 499 http_heartbeat = NULL;
500 #endif 500 #endif
501 #ifdef SRS_AUTO_INGEST 501 #ifdef SRS_AUTO_INGEST
@@ -530,7 +530,7 @@ void SrsServer::destroy() @@ -530,7 +530,7 @@ void SrsServer::destroy()
530 srs_freep(http_stream_mux); 530 srs_freep(http_stream_mux);
531 #endif 531 #endif
532 532
533 -#ifdef SRS_AUTO_HTTP_PARSER 533 +#ifdef SRS_AUTO_HTTP_CORE
534 srs_freep(http_heartbeat); 534 srs_freep(http_heartbeat);
535 #endif 535 #endif
536 536
@@ -589,7 +589,7 @@ int SrsServer::initialize(ISrsServerCycle* cycle_handler) @@ -589,7 +589,7 @@ int SrsServer::initialize(ISrsServerCycle* cycle_handler)
589 } 589 }
590 #endif 590 #endif
591 591
592 -#ifdef SRS_AUTO_HTTP_PARSER 592 +#ifdef SRS_AUTO_HTTP_CORE
593 srs_assert(!http_heartbeat); 593 srs_assert(!http_heartbeat);
594 http_heartbeat = new SrsHttpHeartbeat(); 594 http_heartbeat = new SrsHttpHeartbeat();
595 #endif 595 #endif
@@ -971,7 +971,7 @@ int SrsServer::do_cycle() @@ -971,7 +971,7 @@ int SrsServer::do_cycle()
971 srs_info("update network server kbps info."); 971 srs_info("update network server kbps info.");
972 resample_kbps(); 972 resample_kbps();
973 } 973 }
974 - #ifdef SRS_AUTO_HTTP_PARSER 974 + #ifdef SRS_AUTO_HTTP_CORE
975 if (_srs_config->get_heartbeat_enabled()) { 975 if (_srs_config->get_heartbeat_enabled()) {
976 if ((i % heartbeat_max_resolution) == 0) { 976 if ((i % heartbeat_max_resolution) == 0) {
977 srs_info("do http heartbeat, for internal server to report."); 977 srs_info("do http heartbeat, for internal server to report.");
@@ -240,7 +240,7 @@ private: @@ -240,7 +240,7 @@ private:
240 #ifdef SRS_AUTO_HTTP_SERVER 240 #ifdef SRS_AUTO_HTTP_SERVER
241 SrsHttpServer* http_stream_mux; 241 SrsHttpServer* http_stream_mux;
242 #endif 242 #endif
243 -#ifdef SRS_AUTO_HTTP_PARSER 243 +#ifdef SRS_AUTO_HTTP_CORE
244 SrsHttpHeartbeat* http_heartbeat; 244 SrsHttpHeartbeat* http_heartbeat;
245 #endif 245 #endif
246 #ifdef SRS_AUTO_INGEST 246 #ifdef SRS_AUTO_INGEST
@@ -61,7 +61,7 @@ ISrsThreadContext* _srs_context = new ISrsThreadContext(); @@ -61,7 +61,7 @@ ISrsThreadContext* _srs_context = new ISrsThreadContext();
61 SrsConfig* _srs_config = NULL; 61 SrsConfig* _srs_config = NULL;
62 SrsServer* _srs_server = NULL; 62 SrsServer* _srs_server = NULL;
63 63
64 -#if defined(SRS_AUTO_HTTP_PARSER) 64 +#if defined(SRS_AUTO_HTTP_CORE)
65 65
66 /** 66 /**
67 * main entrance. 67 * main entrance.
@@ -72,7 +72,7 @@ int main(int argc, char** argv) @@ -72,7 +72,7 @@ int main(int argc, char** argv)
72 srs_assert(srs_is_little_endian()); 72 srs_assert(srs_is_little_endian());
73 73
74 // directly failed when compile limited. 74 // directly failed when compile limited.
75 -#if !defined(SRS_AUTO_HTTP_PARSER) 75 +#if !defined(SRS_AUTO_HTTP_CORE)
76 srs_error("depends on http-parser."); 76 srs_error("depends on http-parser.");
77 exit(-1); 77 exit(-1);
78 #endif 78 #endif
@@ -1408,7 +1408,7 @@ int proxy_hls2rtmp(string hls, string rtmp) @@ -1408,7 +1408,7 @@ int proxy_hls2rtmp(string hls, string rtmp)
1408 1408
1409 int main(int argc, char** argv) 1409 int main(int argc, char** argv)
1410 { 1410 {
1411 -#ifndef SRS_AUTO_HTTP_PARSER 1411 +#ifndef SRS_AUTO_HTTP_CORE
1412 srs_error("ingest requires http-api or http-server"); 1412 srs_error("ingest requires http-api or http-server");
1413 #endif 1413 #endif
1414 return -1; 1414 return -1;
@@ -96,7 +96,7 @@ void show_macro_features() @@ -96,7 +96,7 @@ void show_macro_features()
96 srs_warn("check feature http server: off"); 96 srs_warn("check feature http server: off");
97 #endif 97 #endif
98 98
99 -#ifdef SRS_AUTO_HTTP_PARSER 99 +#ifdef SRS_AUTO_HTTP_CORE
100 srs_trace("check feature http parser: on"); 100 srs_trace("check feature http parser: on");
101 #else 101 #else
102 srs_warn("check feature http parser: off"); 102 srs_warn("check feature http parser: off");