winlin

add contributors to api/v1/authors

1 Authors ordered by first contribution. 1 Authors ordered by first contribution.
2 2
3 -* winlin <winlin@vip.126.com>  
4 -* wenjie.zhao <740936897@qq.com>  
5 -* xiangcheng.liu <liuxc0116@foxmail.com>  
6 -* naijia.liu <youngcow@youngcow.net>  
7 -* alcoholyi <alcoholyi@qq.com> 3 +* winlin<winlin@vip.126.com>
  4 +* wenjie.zhao<740936897@qq.com>
  5 +* xiangcheng.liu<liuxc0116@foxmail.com>
  6 +* naijia.liu<youngcow@youngcow.net>
  7 +* alcoholyi<alcoholyi@qq.com>
@@ -63,6 +63,7 @@ The PRIMARY AUTHORS are (and/or have been)(Authors ordered by first contribution @@ -63,6 +63,7 @@ The PRIMARY AUTHORS are (and/or have been)(Authors ordered by first contribution
63 About the primary AUTHORS: 63 About the primary AUTHORS:
64 * Contribute important features to SRS. 64 * Contribute important features to SRS.
65 * Names of all PRIMARY AUTHORS response in NetConnection.connect and metadata. 65 * Names of all PRIMARY AUTHORS response in NetConnection.connect and metadata.
  66 +* Names of all CONTRIBUTORS response in api/v1/authors.
66 67
67 And here is an inevitably incomplete list of MUCH-APPRECIATED CONTRIBUTORS -- 68 And here is an inevitably incomplete list of MUCH-APPRECIATED CONTRIBUTORS --
68 people who have submitted patches, reported bugs, added translations, helped 69 people who have submitted patches, reported bugs, added translations, helped
@@ -576,5 +576,17 @@ echo "" >> $SRS_AUTO_HEADERS_H @@ -576,5 +576,17 @@ echo "" >> $SRS_AUTO_HEADERS_H
576 # prefix 576 # prefix
577 echo "#define SRS_PREFIX \"${SRS_PREFIX}\"" >> $SRS_AUTO_HEADERS_H 577 echo "#define SRS_PREFIX \"${SRS_PREFIX}\"" >> $SRS_AUTO_HEADERS_H
578 578
  579 +echo "" >> $SRS_AUTO_HEADERS_H
  580 +
  581 +#####################################################################################
  582 +# generated the contributors from AUTHORS.txt
  583 +#####################################################################################
  584 +SRS_CONSTRIBUTORS=`cat ../AUTHORS.txt|grep "*"|awk -F '* ' '{print $2}'`
  585 +echo "#define SRS_CONSTRIBUTORS \"\\" >> $SRS_AUTO_HEADERS_H
  586 +for CONTRIBUTOR in $SRS_CONSTRIBUTORS; do
  587 + echo "${CONTRIBUTOR} \\" >> $SRS_AUTO_HEADERS_H
  588 +done
  589 +echo "\"" >> $SRS_AUTO_HEADERS_H
  590 +
579 # new empty line to auto headers file. 591 # new empty line to auto headers file.
580 echo "" >> $SRS_AUTO_HEADERS_H 592 echo "" >> $SRS_AUTO_HEADERS_H
@@ -445,9 +445,6 @@ int SrsHttpParser::parse_message_imp(SrsSocket* skt) @@ -445,9 +445,6 @@ int SrsHttpParser::parse_message_imp(SrsSocket* skt)
445 445
446 // check header size. 446 // check header size.
447 if (msg->is_complete()) { 447 if (msg->is_complete()) {
448 - srs_trace("http request parsed, method=%d, url=%s, content-length=%"PRId64"",  
449 - msg->method(), msg->url().c_str(), msg->content_length());  
450 -  
451 return ret; 448 return ret;
452 } 449 }
453 450
@@ -579,7 +576,7 @@ int SrsHttpUri::initialize(std::string _url) @@ -579,7 +576,7 @@ int SrsHttpUri::initialize(std::string _url)
579 srs_info("parse url %s success", purl); 576 srs_info("parse url %s success", purl);
580 577
581 query = get_uri_field(url, &hp_u, UF_QUERY); 578 query = get_uri_field(url, &hp_u, UF_QUERY);
582 - srs_trace("parse query %s success", purl); 579 + srs_info("parse query %s success", query);
583 580
584 return ret; 581 return ret;
585 } 582 }
@@ -99,6 +99,7 @@ int SrsApiApi::do_process_request(SrsSocket* skt, SrsHttpMessage* req) @@ -99,6 +99,7 @@ int SrsApiApi::do_process_request(SrsSocket* skt, SrsHttpMessage* req)
99 SrsApiV1::SrsApiV1() 99 SrsApiV1::SrsApiV1()
100 { 100 {
101 handlers.push_back(new SrsApiVersion()); 101 handlers.push_back(new SrsApiVersion());
  102 + handlers.push_back(new SrsApiAuthors());
102 } 103 }
103 104
104 SrsApiV1::~SrsApiV1() 105 SrsApiV1::~SrsApiV1()
@@ -117,7 +118,8 @@ int SrsApiV1::do_process_request(SrsSocket* skt, SrsHttpMessage* req) @@ -117,7 +118,8 @@ int SrsApiV1::do_process_request(SrsSocket* skt, SrsHttpMessage* req)
117 ss << JOBJECT_START 118 ss << JOBJECT_START
118 << JFIELD_ERROR(ERROR_SUCCESS) << JFIELD_CONT 119 << JFIELD_ERROR(ERROR_SUCCESS) << JFIELD_CONT
119 << JFIELD_ORG("urls", JOBJECT_START) 120 << JFIELD_ORG("urls", JOBJECT_START)
120 - << JFIELD_STR("version", "the version of SRS") 121 + << JFIELD_STR("version", "the version of SRS") << JFIELD_CONT
  122 + << JFIELD_STR("authors", "the primary authors and contributors")
121 << JOBJECT_END 123 << JOBJECT_END
122 << JOBJECT_END; 124 << JOBJECT_END;
123 125
@@ -147,8 +149,36 @@ int SrsApiVersion::do_process_request(SrsSocket* skt, SrsHttpMessage* req) @@ -147,8 +149,36 @@ int SrsApiVersion::do_process_request(SrsSocket* skt, SrsHttpMessage* req)
147 << JFIELD_ORG("major", VERSION_MAJOR) << JFIELD_CONT 149 << JFIELD_ORG("major", VERSION_MAJOR) << JFIELD_CONT
148 << JFIELD_ORG("minor", VERSION_MINOR) << JFIELD_CONT 150 << JFIELD_ORG("minor", VERSION_MINOR) << JFIELD_CONT
149 << JFIELD_ORG("revision", VERSION_REVISION) << JFIELD_CONT 151 << JFIELD_ORG("revision", VERSION_REVISION) << JFIELD_CONT
150 - << JFIELD_STR("version", RTMP_SIG_SRS_VERSION) << JFIELD_CONT  
151 - << JFIELD_STR("primary_authors", RTMP_SIG_SRS_PRIMARY_AUTHROS) 152 + << JFIELD_STR("version", RTMP_SIG_SRS_VERSION)
  153 + << JOBJECT_END
  154 + << JOBJECT_END;
  155 +
  156 + return res_json(skt, ss.str());
  157 +}
  158 +
  159 +SrsApiAuthors::SrsApiAuthors()
  160 +{
  161 +}
  162 +
  163 +SrsApiAuthors::~SrsApiAuthors()
  164 +{
  165 +}
  166 +
  167 +bool SrsApiAuthors::can_handle(const char* path, int length, const char** /*pchild*/)
  168 +{
  169 + return srs_path_equals("/authors", path, length);
  170 +}
  171 +
  172 +int SrsApiAuthors::do_process_request(SrsSocket* skt, SrsHttpMessage* req)
  173 +{
  174 + std::stringstream ss;
  175 +
  176 + ss << JOBJECT_START
  177 + << JFIELD_ERROR(ERROR_SUCCESS) << JFIELD_CONT
  178 + << JFIELD_ORG("data", JOBJECT_START)
  179 + << JFIELD_STR("primary_authors", RTMP_SIG_SRS_PRIMARY_AUTHROS) << JFIELD_CONT
  180 + << JFIELD_STR("contributors_link", RTMP_SIG_SRS_CONTRIBUTORS_URL) << JFIELD_CONT
  181 + << JFIELD_STR("contributors", SRS_CONSTRIBUTORS)
152 << JOBJECT_END 182 << JOBJECT_END
153 << JOBJECT_END; 183 << JOBJECT_END;
154 184
@@ -220,6 +250,9 @@ int SrsHttpApi::process_request(SrsSocket* skt, SrsHttpMessage* req) @@ -220,6 +250,9 @@ int SrsHttpApi::process_request(SrsSocket* skt, SrsHttpMessage* req)
220 return ret; 250 return ret;
221 } 251 }
222 252
  253 + srs_trace("http request parsed, method=%d, url=%s, content-length=%"PRId64"",
  254 + req->method(), req->url().c_str(), req->content_length());
  255 +
223 // TODO: maybe need to parse the url. 256 // TODO: maybe need to parse the url.
224 std::string url = req->path(); 257 std::string url = req->path();
225 258
@@ -82,6 +82,16 @@ public: @@ -82,6 +82,16 @@ public:
82 virtual int do_process_request(SrsSocket* skt, SrsHttpMessage* req); 82 virtual int do_process_request(SrsSocket* skt, SrsHttpMessage* req);
83 }; 83 };
84 84
  85 +class SrsApiAuthors : public SrsHttpHandler
  86 +{
  87 +public:
  88 + SrsApiAuthors();
  89 + virtual ~SrsApiAuthors();
  90 +public:
  91 + virtual bool can_handle(const char* path, int length, const char** pchild);
  92 + virtual int do_process_request(SrsSocket* skt, SrsHttpMessage* req);
  93 +};
  94 +
85 class SrsHttpApi : public SrsConnection 95 class SrsHttpApi : public SrsConnection
86 { 96 {
87 private: 97 private:
@@ -44,6 +44,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -44,6 +44,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
44 #define RTMP_SIG_SRS_LICENSE "The MIT License (MIT)" 44 #define RTMP_SIG_SRS_LICENSE "The MIT License (MIT)"
45 #define RTMP_SIG_SRS_COPYRIGHT "Copyright (c) 2013-2014 winlin" 45 #define RTMP_SIG_SRS_COPYRIGHT "Copyright (c) 2013-2014 winlin"
46 #define RTMP_SIG_SRS_PRIMARY_AUTHROS "winlin,wenjie.zhao" 46 #define RTMP_SIG_SRS_PRIMARY_AUTHROS "winlin,wenjie.zhao"
  47 +#define RTMP_SIG_SRS_CONTRIBUTORS_URL "https://github.com/winlinvip/simple-rtmp-server/blob/master/AUTHORS.txt"
47 48
48 /** 49 /**
49 * the core provides the common defined macros, utilities, 50 * the core provides the common defined macros, utilities,