mirror of
https://github.com/cypress-io/cypress.git
synced 2026-03-15 13:50:28 -05:00
End proxied responses for 1xx, 204, 304 with no body, fix bug where cy server could be proxied (#4358)
* release 3.2.0 [skip ci] * add failing test for 304 * always end response on 1xx, 204, or 304 * add http req spec * add test that 1xx, 204, 304 always pass thru immediately * cleanup * skip stubborn test * cleanup, tests * fix stopping debugproxy where it hasn't been started fix stopping debugproxy where it hasn't been started * Never proxy websocket port * e2e test now works * unnecesary this * e2e works in ci Co-authored-by: Brian Mann <brian.mann86@gmail.com>
This commit is contained in:
committed by
Brian Mann
parent
f26c5a9c6f
commit
0c8df29def
@@ -98,13 +98,18 @@ class Server
|
||||
res.end()
|
||||
.pipe(res)
|
||||
|
||||
_getProxyForUrl: (url) ->
|
||||
if url == "https://localhost:#{@_sniPort}"
|
||||
_getProxyForUrl: (urlStr) ->
|
||||
port = Number(_.get(url.parse(urlStr), 'port'))
|
||||
|
||||
debug('getting proxy URL %o', { port, serverPort: @_port, sniPort: @_sniPort, url: urlStr })
|
||||
|
||||
if [@_sniPort, @_port].includes(port)
|
||||
## https://github.com/cypress-io/cypress/issues/4257
|
||||
## this is a tunnel to the SNI server, it should never go through a proxy
|
||||
## this is a tunnel to the SNI server or to the main server,
|
||||
## it should never go through a proxy
|
||||
return undefined
|
||||
|
||||
getProxyForUrl(url)
|
||||
getProxyForUrl(urlStr)
|
||||
|
||||
_makeDirectConnection: (req, browserSocket, head) ->
|
||||
{ port, hostname } = url.parse("https://#{req.url}")
|
||||
@@ -167,7 +172,7 @@ class Server
|
||||
return makeConnection(@_port)
|
||||
|
||||
## else spin up the SNI server
|
||||
{ hostname } = url.parse("http://#{req.url}")
|
||||
{ hostname } = url.parse("https://#{req.url}")
|
||||
|
||||
if sslServer = sslServers[hostname]
|
||||
return makeConnection(sslServer.port)
|
||||
|
||||
Reference in New Issue
Block a user