Add nghttp client backed by libevent
This commit is contained in:
parent
1dd21c1e30
commit
6bc7e7bd0b
|
@ -35,7 +35,7 @@ AM_CXXFLAGS = -std=c++11
|
||||||
|
|
||||||
LDADD = $(top_builddir)/lib/libnghttp2.la
|
LDADD = $(top_builddir)/lib/libnghttp2.la
|
||||||
|
|
||||||
bin_PROGRAMS += spdycat
|
bin_PROGRAMS += spdycat nghttp
|
||||||
|
|
||||||
if ENABLE_SPDYD
|
if ENABLE_SPDYD
|
||||||
bin_PROGRAMS += spdyd
|
bin_PROGRAMS += spdyd
|
||||||
|
@ -72,6 +72,10 @@ spdycat_SOURCES = ${HELPER_OBJECTS} ${HELPER_HFILES} spdycat.cc \
|
||||||
${HTML_PARSER_OBJECTS} ${HTML_PARSER_HFILES} \
|
${HTML_PARSER_OBJECTS} ${HTML_PARSER_HFILES} \
|
||||||
http-parser/http_parser.c http-parser/http_parser.h
|
http-parser/http_parser.c http-parser/http_parser.h
|
||||||
|
|
||||||
|
nghttp_SOURCES = ${HELPER_OBJECTS} ${HELPER_HFILES} nghttp.cc \
|
||||||
|
${HTML_PARSER_OBJECTS} ${HTML_PARSER_HFILES} \
|
||||||
|
http-parser/http_parser.c http-parser/http_parser.h
|
||||||
|
|
||||||
if ENABLE_SPDYD
|
if ENABLE_SPDYD
|
||||||
SPDY_SERVER_OBJECTS = SpdyServer.cc
|
SPDY_SERVER_OBJECTS = SpdyServer.cc
|
||||||
SPDY_SERVER_HFILES = SpdyServer.h
|
SPDY_SERVER_HFILES = SpdyServer.h
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -486,10 +486,10 @@ void check_response_header
|
||||||
bool gzip = false;
|
bool gzip = false;
|
||||||
for(size_t i = 0; i < frame->headers.nvlen; ++i) {
|
for(size_t i = 0; i < frame->headers.nvlen; ++i) {
|
||||||
auto nv = &frame->headers.nva[i];
|
auto nv = &frame->headers.nva[i];
|
||||||
if(util::strieq("content-encoding", nv->name, nv->namelen) == 0) {
|
if(util::strieq("content-encoding", nv->name, nv->namelen)) {
|
||||||
gzip = util::strieq("gzip", nv->value, nv->valuelen) ||
|
gzip = util::strieq("gzip", nv->value, nv->valuelen) ||
|
||||||
util::strieq("deflate", nv->value, nv->valuelen);
|
util::strieq("deflate", nv->value, nv->valuelen);
|
||||||
} else if(util::strieq(":status", nv->name, nv->namelen) == 0) {
|
} else if(util::strieq(":status", nv->name, nv->namelen)) {
|
||||||
req->status.assign(nv->value, nv->value + nv->valuelen);
|
req->status.assign(nv->value, nv->value + nv->valuelen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -165,9 +165,9 @@ bool strieq(const char *a, const uint8_t *b, size_t bn)
|
||||||
if(!a || !b) {
|
if(!a || !b) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
size_t i;
|
const uint8_t *blast = b + bn;
|
||||||
for(i = 0; i < bn && *a && lowcase(*a) == lowcase(*b); ++a, ++b);
|
for(; *a && lowcase(*a) == lowcase(*b); ++a, ++b);
|
||||||
return !*a && i == bn;
|
return !*a && b == blast;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool strifind(const char *a, const char *b)
|
bool strifind(const char *a, const char *b)
|
||||||
|
|
15
src/util.h
15
src/util.h
|
@ -32,6 +32,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
namespace nghttp2 {
|
namespace nghttp2 {
|
||||||
|
|
||||||
|
@ -360,6 +361,20 @@ std::string utos(T n)
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename T, typename... U>
|
||||||
|
typename std::enable_if<!std::is_array<T>::value, std::unique_ptr<T>>::type
|
||||||
|
make_unique(U&&... u)
|
||||||
|
{
|
||||||
|
return std::unique_ptr<T>(new T(std::forward<U>(u)...));
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
typename std::enable_if<std::is_array<T>::value, std::unique_ptr<T>>::type
|
||||||
|
make_unique(size_t size)
|
||||||
|
{
|
||||||
|
return std::unique_ptr<T>(new typename std::remove_extent<T>::type[size]());
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace util
|
} // namespace util
|
||||||
|
|
||||||
} // namespace nghttp2
|
} // namespace nghttp2
|
||||||
|
|
Loading…
Reference in New Issue