Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nghttp2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
nghttp2
Commits
81bfb84b
Commit
81bfb84b
authored
Jun 13, 2016
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nghttpx: Rename backend/replace API as backendconfig
parent
11bca9a9
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
27 deletions
+27
-27
doc/nghttpx.h2r
doc/nghttpx.h2r
+8
-8
integration-tests/nghttpx_http1_test.go
integration-tests/nghttpx_http1_test.go
+6
-6
integration-tests/nghttpx_http2_test.go
integration-tests/nghttpx_http2_test.go
+6
-6
integration-tests/nghttpx_spdy_test.go
integration-tests/nghttpx_spdy_test.go
+6
-6
src/shrpx_api_downstream_connection.cc
src/shrpx_api_downstream_connection.cc
+1
-1
No files found.
doc/nghttpx.h2r
View file @
81bfb84b
...
...
@@ -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 server
s with the
requested ones. The request m
ust 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 lin
e
separator inside the request body must be single LF (0x0A).
PUT /api/v1beta1/backend
config
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This API replaces the current
backend server setting
s with the
requested ones. The request m
ethod should be PUT, but POST is also
acceptable. The request body must be nghttpx configuration file
format. For configuration file format, see `FILES`_ section. Th
e
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
...
...
integration-tests/nghttpx_http1_test.go
View file @
81bfb84b
...
...
@@ -795,7 +795,7 @@ func TestH1H2RespPhaseReturn(t *testing.T) {
}
}
// TestH1APIBackendReplace exercise backend
/replace
API endpoint
// TestH1APIBackendReplace exercise backend
config
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/backend
config
"
,
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 backend
config
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/backend
config
"
,
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 backend
config 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"
)
...
...
integration-tests/nghttpx_http2_test.go
View file @
81bfb84b
...
...
@@ -1845,7 +1845,7 @@ func TestH2H2RespPhaseReturn(t *testing.T) {
}
}
// TestH2APIBackendReplace exercise backend
/replace
API endpoint
// TestH2APIBackendReplace exercise backend
config
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/backend
config
"
,
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 backend
config
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/backend
config
"
,
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 backend
config 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"
)
...
...
integration-tests/nghttpx_spdy_test.go
View file @
81bfb84b
...
...
@@ -476,7 +476,7 @@ func TestS3H2RespPhaseReturn(t *testing.T) {
}
}
// TestS3APIBackendReplace exercise backend
/replace
API endpoint
// TestS3APIBackendReplace exercise backend
config
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/backend
config
"
,
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 backend
config
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/backend
config
"
,
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 backend
config 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"
)
...
...
src/shrpx_api_downstream_connection.cc
View file @
81bfb84b
...
...
@@ -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/backend
config
"
))
{
send_reply
(
404
,
API_FAILURE
);
return
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment