1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-12 11:21:52 +00:00

add contributors to api/v1/authors

This commit is contained in:
winlin 2014-04-03 13:48:52 +08:00
parent 9d5abbd9a6
commit 4a40075f68
7 changed files with 66 additions and 12 deletions

View file

@ -1,7 +1,7 @@
Authors ordered by first contribution. Authors ordered by first contribution.
* winlin <winlin@vip.126.com> * winlin<winlin@vip.126.com>
* wenjie.zhao <740936897@qq.com> * wenjie.zhao<740936897@qq.com>
* xiangcheng.liu <liuxc0116@foxmail.com> * xiangcheng.liu<liuxc0116@foxmail.com>
* naijia.liu <youngcow@youngcow.net> * naijia.liu<youngcow@youngcow.net>
* alcoholyi <alcoholyi@qq.com> * alcoholyi<alcoholyi@qq.com>

View file

@ -63,6 +63,7 @@ The PRIMARY AUTHORS are (and/or have been)(Authors ordered by first contribution
About the primary AUTHORS: About the primary AUTHORS:
* Contribute important features to SRS. * Contribute important features to SRS.
* Names of all PRIMARY AUTHORS response in NetConnection.connect and metadata. * Names of all PRIMARY AUTHORS response in NetConnection.connect and metadata.
* Names of all CONTRIBUTORS response in api/v1/authors.
And here is an inevitably incomplete list of MUCH-APPRECIATED CONTRIBUTORS -- And here is an inevitably incomplete list of MUCH-APPRECIATED CONTRIBUTORS --
people who have submitted patches, reported bugs, added translations, helped people who have submitted patches, reported bugs, added translations, helped

View file

@ -576,5 +576,17 @@ echo "" >> $SRS_AUTO_HEADERS_H
# prefix # prefix
echo "#define SRS_PREFIX \"${SRS_PREFIX}\"" >> $SRS_AUTO_HEADERS_H echo "#define SRS_PREFIX \"${SRS_PREFIX}\"" >> $SRS_AUTO_HEADERS_H
echo "" >> $SRS_AUTO_HEADERS_H
#####################################################################################
# generated the contributors from AUTHORS.txt
#####################################################################################
SRS_CONSTRIBUTORS=`cat ../AUTHORS.txt|grep "*"|awk -F '* ' '{print $2}'`
echo "#define SRS_CONSTRIBUTORS \"\\" >> $SRS_AUTO_HEADERS_H
for CONTRIBUTOR in $SRS_CONSTRIBUTORS; do
echo "${CONTRIBUTOR} \\" >> $SRS_AUTO_HEADERS_H
done
echo "\"" >> $SRS_AUTO_HEADERS_H
# new empty line to auto headers file. # new empty line to auto headers file.
echo "" >> $SRS_AUTO_HEADERS_H echo "" >> $SRS_AUTO_HEADERS_H

View file

@ -445,9 +445,6 @@ int SrsHttpParser::parse_message_imp(SrsSocket* skt)
// check header size. // check header size.
if (msg->is_complete()) { if (msg->is_complete()) {
srs_trace("http request parsed, method=%d, url=%s, content-length=%"PRId64"",
msg->method(), msg->url().c_str(), msg->content_length());
return ret; return ret;
} }
@ -579,7 +576,7 @@ int SrsHttpUri::initialize(std::string _url)
srs_info("parse url %s success", purl); srs_info("parse url %s success", purl);
query = get_uri_field(url, &hp_u, UF_QUERY); query = get_uri_field(url, &hp_u, UF_QUERY);
srs_trace("parse query %s success", purl); srs_info("parse query %s success", query);
return ret; return ret;
} }

View file

@ -99,6 +99,7 @@ int SrsApiApi::do_process_request(SrsSocket* skt, SrsHttpMessage* req)
SrsApiV1::SrsApiV1() SrsApiV1::SrsApiV1()
{ {
handlers.push_back(new SrsApiVersion()); handlers.push_back(new SrsApiVersion());
handlers.push_back(new SrsApiAuthors());
} }
SrsApiV1::~SrsApiV1() SrsApiV1::~SrsApiV1()
@ -117,7 +118,8 @@ int SrsApiV1::do_process_request(SrsSocket* skt, SrsHttpMessage* req)
ss << JOBJECT_START ss << JOBJECT_START
<< JFIELD_ERROR(ERROR_SUCCESS) << JFIELD_CONT << JFIELD_ERROR(ERROR_SUCCESS) << JFIELD_CONT
<< JFIELD_ORG("urls", JOBJECT_START) << JFIELD_ORG("urls", JOBJECT_START)
<< JFIELD_STR("version", "the version of SRS") << JFIELD_STR("version", "the version of SRS") << JFIELD_CONT
<< JFIELD_STR("authors", "the primary authors and contributors")
<< JOBJECT_END << JOBJECT_END
<< JOBJECT_END; << JOBJECT_END;
@ -147,8 +149,36 @@ int SrsApiVersion::do_process_request(SrsSocket* skt, SrsHttpMessage* req)
<< JFIELD_ORG("major", VERSION_MAJOR) << JFIELD_CONT << JFIELD_ORG("major", VERSION_MAJOR) << JFIELD_CONT
<< JFIELD_ORG("minor", VERSION_MINOR) << JFIELD_CONT << JFIELD_ORG("minor", VERSION_MINOR) << JFIELD_CONT
<< JFIELD_ORG("revision", VERSION_REVISION) << JFIELD_CONT << JFIELD_ORG("revision", VERSION_REVISION) << JFIELD_CONT
<< JFIELD_STR("version", RTMP_SIG_SRS_VERSION) << JFIELD_CONT << JFIELD_STR("version", RTMP_SIG_SRS_VERSION)
<< JFIELD_STR("primary_authors", RTMP_SIG_SRS_PRIMARY_AUTHROS) << JOBJECT_END
<< JOBJECT_END;
return res_json(skt, ss.str());
}
SrsApiAuthors::SrsApiAuthors()
{
}
SrsApiAuthors::~SrsApiAuthors()
{
}
bool SrsApiAuthors::can_handle(const char* path, int length, const char** /*pchild*/)
{
return srs_path_equals("/authors", path, length);
}
int SrsApiAuthors::do_process_request(SrsSocket* skt, SrsHttpMessage* req)
{
std::stringstream ss;
ss << JOBJECT_START
<< JFIELD_ERROR(ERROR_SUCCESS) << JFIELD_CONT
<< JFIELD_ORG("data", JOBJECT_START)
<< JFIELD_STR("primary_authors", RTMP_SIG_SRS_PRIMARY_AUTHROS) << JFIELD_CONT
<< JFIELD_STR("contributors_link", RTMP_SIG_SRS_CONTRIBUTORS_URL) << JFIELD_CONT
<< JFIELD_STR("contributors", SRS_CONSTRIBUTORS)
<< JOBJECT_END << JOBJECT_END
<< JOBJECT_END; << JOBJECT_END;
@ -220,6 +250,9 @@ int SrsHttpApi::process_request(SrsSocket* skt, SrsHttpMessage* req)
return ret; return ret;
} }
srs_trace("http request parsed, method=%d, url=%s, content-length=%"PRId64"",
req->method(), req->url().c_str(), req->content_length());
// TODO: maybe need to parse the url. // TODO: maybe need to parse the url.
std::string url = req->path(); std::string url = req->path();

View file

@ -82,6 +82,16 @@ public:
virtual int do_process_request(SrsSocket* skt, SrsHttpMessage* req); virtual int do_process_request(SrsSocket* skt, SrsHttpMessage* req);
}; };
class SrsApiAuthors : public SrsHttpHandler
{
public:
SrsApiAuthors();
virtual ~SrsApiAuthors();
public:
virtual bool can_handle(const char* path, int length, const char** pchild);
virtual int do_process_request(SrsSocket* skt, SrsHttpMessage* req);
};
class SrsHttpApi : public SrsConnection class SrsHttpApi : public SrsConnection
{ {
private: private:

View file

@ -44,6 +44,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define RTMP_SIG_SRS_LICENSE "The MIT License (MIT)" #define RTMP_SIG_SRS_LICENSE "The MIT License (MIT)"
#define RTMP_SIG_SRS_COPYRIGHT "Copyright (c) 2013-2014 winlin" #define RTMP_SIG_SRS_COPYRIGHT "Copyright (c) 2013-2014 winlin"
#define RTMP_SIG_SRS_PRIMARY_AUTHROS "winlin,wenjie.zhao" #define RTMP_SIG_SRS_PRIMARY_AUTHROS "winlin,wenjie.zhao"
#define RTMP_SIG_SRS_CONTRIBUTORS_URL "https://github.com/winlinvip/simple-rtmp-server/blob/master/AUTHORS.txt"
/** /**
* the core provides the common defined macros, utilities, * the core provides the common defined macros, utilities,