Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
caddy
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
caddy
Commits
c4e65df2
Commit
c4e65df2
authored
Apr 16, 2016
by
Eric Drechsel
Committed by
Nimi Wariboko Jr
Aug 01, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Proxy: Add a failing test which replicates #763
2 websocket connections are made instead of one
parent
db4cd8ee
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
caddyhttp/proxy/proxy_test.go
caddyhttp/proxy/proxy_test.go
+5
-1
No files found.
caddyhttp/proxy/proxy_test.go
View file @
c4e65df2
...
@@ -102,7 +102,8 @@ func TestReverseProxyInsecureSkipVerify(t *testing.T) {
...
@@ -102,7 +102,8 @@ func TestReverseProxyInsecureSkipVerify(t *testing.T) {
func
TestWebSocketReverseProxyServeHTTPHandler
(
t
*
testing
.
T
)
{
func
TestWebSocketReverseProxyServeHTTPHandler
(
t
*
testing
.
T
)
{
// No-op websocket backend simply allows the WS connection to be
// No-op websocket backend simply allows the WS connection to be
// accepted then it will be immediately closed. Perfect for testing.
// accepted then it will be immediately closed. Perfect for testing.
wsNop
:=
httptest
.
NewServer
(
websocket
.
Handler
(
func
(
ws
*
websocket
.
Conn
)
{}))
var
connCount
int
wsNop
:=
httptest
.
NewServer
(
websocket
.
Handler
(
func
(
ws
*
websocket
.
Conn
)
{
connCount
++
}))
defer
wsNop
.
Close
()
defer
wsNop
.
Close
()
// Get proxy to use for the test
// Get proxy to use for the test
...
@@ -135,6 +136,9 @@ func TestWebSocketReverseProxyServeHTTPHandler(t *testing.T) {
...
@@ -135,6 +136,9 @@ func TestWebSocketReverseProxyServeHTTPHandler(t *testing.T) {
if
!
bytes
.
Equal
(
actual
,
expected
)
{
if
!
bytes
.
Equal
(
actual
,
expected
)
{
t
.
Errorf
(
"Expected backend to accept response:
\n
'%s'
\n
Actually got:
\n
'%s'"
,
expected
,
actual
)
t
.
Errorf
(
"Expected backend to accept response:
\n
'%s'
\n
Actually got:
\n
'%s'"
,
expected
,
actual
)
}
}
if
connCount
!=
1
{
t
.
Errorf
(
"Expected 1 websocket connection, got %d"
,
connCount
)
}
}
}
func
TestWebSocketReverseProxyFromWSClient
(
t
*
testing
.
T
)
{
func
TestWebSocketReverseProxyFromWSClient
(
t
*
testing
.
T
)
{
...
...
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