Commit 81bfb84b authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

nghttpx: Rename backend/replace API as backendconfig

parent 11bca9a9
......@@ -493,14 +493,14 @@ some cases where the error has occurred before reaching API endpoint
The following section describes available API endpoints.
PUT /api/v1beta1/backend/replace
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This API replaces the current set of backend servers with the
requested ones. The request must carry request body with method PUT
or POST. The request body must be nghttpx configuration file format.
For configuration file format, see `FILES`_ section. The line
separator inside the request body must be single LF (0x0A).
PUT /api/v1beta1/backendconfig
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This API replaces the current backend server settings with the
requested ones. The request method should be PUT, but POST is also
acceptable. The request body must be nghttpx configuration file
format. For configuration file format, see `FILES`_ section. The
line separator inside the request body must be single LF (0x0A).
Currently, only :option:`backend <--backend>` option is parsed, the
others are simply ignored. The semantics of this API is replace the
current backend with the backend options in request body. Describe
......
......@@ -795,7 +795,7 @@ func TestH1H2RespPhaseReturn(t *testing.T) {
}
}
// TestH1APIBackendReplace exercise backend/replace API endpoint
// TestH1APIBackendReplace exercise backendconfig API endpoint
// routine for successful case.
func TestH1APIBackendReplace(t *testing.T) {
st := newServerTesterConnectPort([]string{"-f127.0.0.1,3010;api;no-tls"}, t, func(w http.ResponseWriter, r *http.Request) {
......@@ -805,7 +805,7 @@ func TestH1APIBackendReplace(t *testing.T) {
res, err := st.http1(requestParam{
name: "TestH1APIBackendReplace",
path: "/api/v1beta1/backend/replace",
path: "/api/v1beta1/backendconfig",
method: "PUT",
body: []byte(`# comment
backend=127.0.0.1,3011
......@@ -832,7 +832,7 @@ backend=127.0.0.1,3011
}
}
// TestH1APIBackendReplaceBadMethod exercise backend/replace API
// TestH1APIBackendReplaceBadMethod exercise backendconfig API
// endpoint routine with bad method.
func TestH1APIBackendReplaceBadMethod(t *testing.T) {
st := newServerTesterConnectPort([]string{"-f127.0.0.1,3010;api;no-tls"}, t, func(w http.ResponseWriter, r *http.Request) {
......@@ -842,7 +842,7 @@ func TestH1APIBackendReplaceBadMethod(t *testing.T) {
res, err := st.http1(requestParam{
name: "TestH1APIBackendReplaceBadMethod",
path: "/api/v1beta1/backend/replace",
path: "/api/v1beta1/backendconfig",
method: "GET",
body: []byte(`# comment
backend=127.0.0.1,3011
......@@ -869,8 +869,8 @@ backend=127.0.0.1,3011
}
}
// TestH1APINotFound exercise backend/replace API endpoint routine
// when API endpoint is not found.
// TestH1APINotFound exercise backendconfig API endpoint routine when
// API endpoint is not found.
func TestH1APINotFound(t *testing.T) {
st := newServerTesterConnectPort([]string{"-f127.0.0.1,3010;api;no-tls"}, t, func(w http.ResponseWriter, r *http.Request) {
t.Fatalf("request should not be forwarded")
......
......@@ -1845,7 +1845,7 @@ func TestH2H2RespPhaseReturn(t *testing.T) {
}
}
// TestH2APIBackendReplace exercise backend/replace API endpoint
// TestH2APIBackendReplace exercise backendconfig API endpoint
// routine for successful case.
func TestH2APIBackendReplace(t *testing.T) {
st := newServerTesterConnectPort([]string{"-f127.0.0.1,3010;api;no-tls"}, t, func(w http.ResponseWriter, r *http.Request) {
......@@ -1855,7 +1855,7 @@ func TestH2APIBackendReplace(t *testing.T) {
res, err := st.http2(requestParam{
name: "TestH2APIBackendReplace",
path: "/api/v1beta1/backend/replace",
path: "/api/v1beta1/backendconfig",
method: "PUT",
body: []byte(`# comment
backend=127.0.0.1,3011
......@@ -1882,7 +1882,7 @@ backend=127.0.0.1,3011
}
}
// TestH2APIBackendReplaceBadMethod exercise backend/replace API
// TestH2APIBackendReplaceBadMethod exercise backendconfig API
// endpoint routine with bad method.
func TestH2APIBackendReplaceBadMethod(t *testing.T) {
st := newServerTesterConnectPort([]string{"-f127.0.0.1,3010;api;no-tls"}, t, func(w http.ResponseWriter, r *http.Request) {
......@@ -1892,7 +1892,7 @@ func TestH2APIBackendReplaceBadMethod(t *testing.T) {
res, err := st.http2(requestParam{
name: "TestH2APIBackendReplaceBadMethod",
path: "/api/v1beta1/backend/replace",
path: "/api/v1beta1/backendconfig",
method: "GET",
body: []byte(`# comment
backend=127.0.0.1,3011
......@@ -1919,8 +1919,8 @@ backend=127.0.0.1,3011
}
}
// TestH2APINotFound exercise backend/replace API endpoint routine
// when API endpoint is not found.
// TestH2APINotFound exercise backendconfig API endpoint routine when
// API endpoint is not found.
func TestH2APINotFound(t *testing.T) {
st := newServerTesterConnectPort([]string{"-f127.0.0.1,3010;api;no-tls"}, t, func(w http.ResponseWriter, r *http.Request) {
t.Fatalf("request should not be forwarded")
......
......@@ -476,7 +476,7 @@ func TestS3H2RespPhaseReturn(t *testing.T) {
}
}
// TestS3APIBackendReplace exercise backend/replace API endpoint
// TestS3APIBackendReplace exercise backendconfig API endpoint
// routine for successful case.
func TestS3APIBackendReplace(t *testing.T) {
st := newServerTesterTLSConnectPort([]string{"--npn-list=spdy/3.1", "-f127.0.0.1,3010;api"}, t, func(w http.ResponseWriter, r *http.Request) {
......@@ -486,7 +486,7 @@ func TestS3APIBackendReplace(t *testing.T) {
res, err := st.spdy(requestParam{
name: "TestS3APIBackendReplace",
path: "/api/v1beta1/backend/replace",
path: "/api/v1beta1/backendconfig",
method: "PUT",
body: []byte(`# comment
backend=127.0.0.1,3011
......@@ -513,7 +513,7 @@ backend=127.0.0.1,3011
}
}
// TestS3APIBackendReplaceBadMethod exercise backend/replace API
// TestS3APIBackendReplaceBadMethod exercise backendconfig API
// endpoint routine with bad method.
func TestS3APIBackendReplaceBadMethod(t *testing.T) {
st := newServerTesterTLSConnectPort([]string{"--npn-list=spdy/3.1", "-f127.0.0.1,3010;api"}, t, func(w http.ResponseWriter, r *http.Request) {
......@@ -523,7 +523,7 @@ func TestS3APIBackendReplaceBadMethod(t *testing.T) {
res, err := st.spdy(requestParam{
name: "TestS3APIBackendReplaceBadMethod",
path: "/api/v1beta1/backend/replace",
path: "/api/v1beta1/backendconfig",
method: "GET",
body: []byte(`# comment
backend=127.0.0.1,3011
......@@ -550,8 +550,8 @@ backend=127.0.0.1,3011
}
}
// TestS3APINotFound exercise backend/replace API endpoint routine
// when API endpoint is not found.
// TestS3APINotFound exercise backendconfig API endpoint routine when
// API endpoint is not found.
func TestS3APINotFound(t *testing.T) {
st := newServerTesterTLSConnectPort([]string{"--npn-list=spdy/3.1", "-f127.0.0.1,3010;api"}, t, func(w http.ResponseWriter, r *http.Request) {
t.Fatalf("request should not be forwarded")
......
......@@ -131,7 +131,7 @@ int APIDownstreamConnection::push_request_headers() {
auto &req = downstream_->request();
auto &resp = downstream_->response();
if (req.path != StringRef::from_lit("/api/v1beta1/backend/replace")) {
if (req.path != StringRef::from_lit("/api/v1beta1/backendconfig")) {
send_reply(404, API_FAILURE);
return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment