nghttpx: Use raw pointer for apis
This commit is contained in:
parent
12a4e7c3a2
commit
b21779e685
|
@ -35,17 +35,22 @@ namespace shrpx {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
// List of API endpoints
|
// List of API endpoints
|
||||||
const APIEndpoint apis[] = {
|
const std::array<APIEndpoint, 2> &apis() {
|
||||||
APIEndpoint{
|
static const auto apis = new std::array<APIEndpoint, 2>{{
|
||||||
StringRef::from_lit("/api/v1beta1/backendconfig"), true,
|
APIEndpoint{
|
||||||
(1 << API_METHOD_POST) | (1 << API_METHOD_PUT),
|
StringRef::from_lit("/api/v1beta1/backendconfig"), true,
|
||||||
&APIDownstreamConnection::handle_backendconfig,
|
(1 << API_METHOD_POST) | (1 << API_METHOD_PUT),
|
||||||
},
|
&APIDownstreamConnection::handle_backendconfig,
|
||||||
APIEndpoint{
|
},
|
||||||
StringRef::from_lit("/api/v1beta1/configrevision"), true,
|
APIEndpoint{
|
||||||
(1 << API_METHOD_GET), &APIDownstreamConnection::handle_configrevision,
|
StringRef::from_lit("/api/v1beta1/configrevision"), true,
|
||||||
},
|
(1 << API_METHOD_GET),
|
||||||
};
|
&APIDownstreamConnection::handle_configrevision,
|
||||||
|
},
|
||||||
|
}};
|
||||||
|
|
||||||
|
return *apis;
|
||||||
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -160,7 +165,7 @@ const APIEndpoint *lookup_api(const StringRef &path) {
|
||||||
switch (path[25]) {
|
switch (path[25]) {
|
||||||
case 'g':
|
case 'g':
|
||||||
if (util::streq_l("/api/v1beta1/backendconfi", std::begin(path), 25)) {
|
if (util::streq_l("/api/v1beta1/backendconfi", std::begin(path), 25)) {
|
||||||
return &apis[0];
|
return &apis()[0];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -169,7 +174,7 @@ const APIEndpoint *lookup_api(const StringRef &path) {
|
||||||
switch (path[26]) {
|
switch (path[26]) {
|
||||||
case 'n':
|
case 'n':
|
||||||
if (util::streq_l("/api/v1beta1/configrevisio", std::begin(path), 26)) {
|
if (util::streq_l("/api/v1beta1/configrevisio", std::begin(path), 26)) {
|
||||||
return &apis[1];
|
return &apis()[1];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue