Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow circular structures to be sent over the websocket, make it an error to send circular request bodies #4407

Merged
merged 18 commits into from
Jun 13, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Revert "use a parser that supports circular json"
This reverts commit c052f44.
  • Loading branch information
flotwig committed Jun 12, 2019
commit 91c24aa628fc4afe65c166346d9051bcdec7c021
7 changes: 1 addition & 6 deletions packages/extension/app/background.coffee
Original file line number Diff line number Diff line change
@@ -2,7 +2,6 @@ map = require("lodash/map")
pick = require("lodash/pick")
once = require("lodash/once")
Promise = require("bluebird")
{ circularParser } = require("@packages/socket")

HOST = "CHANGE_ME_HOST"
PATH = "CHANGE_ME_PATH"
@@ -42,11 +41,7 @@ connect = (host, path, io) ->

## cannot use required socket here due
## to bug in socket io client with browserify
client = io.connect(host, {
path: path,
transports: ["websocket"]
parser: circularParser
})
client = io.connect(host, {path: path, transports: ["websocket"]})

client.on "automation:request", (id, msg, data) ->
switch msg
1 change: 0 additions & 1 deletion packages/runner/src/lib/event-manager.js
Original file line number Diff line number Diff line change
@@ -12,7 +12,6 @@ import $Cypress, { $ } from '@packages/driver'
const channel = io.connect({
path: '/__socket.io',
transports: ['websocket'],
parser: io.circularParser,
})

channel.on('connect', () => {
1 change: 0 additions & 1 deletion packages/server/lib/socket.coffee
Original file line number Diff line number Diff line change
@@ -124,7 +124,6 @@ class Socket
destroyUpgrade: false
serveClient: false
cookie: cookie
parser: socketIo.circularParser
})

startListening: (server, automation, config, options) ->
6 changes: 0 additions & 6 deletions packages/server/test/integration/websockets_spec.coffee
Original file line number Diff line number Diff line change
@@ -175,8 +175,6 @@ describe "Web Sockets", ->
@wsClient = socketIo.client(@cfg.proxyUrl, {
path: @cfg.socketIoRoute
transports: ["websocket"]
parser: socketIo.circularParser
rejectUnauthorized: false
})
@wsClient.on "connect", -> done()

@@ -199,8 +197,6 @@ describe "Web Sockets", ->
agent: agent
path: @cfg.socketIoRoute
transports: ["websocket"]
parser: socketIo.circularParser
rejectUnauthorized: false
})
@wsClient.on "connect", -> done()

@@ -224,8 +220,6 @@ describe "Web Sockets", ->
@wsClient = socketIo.client("https://localhost:#{wssPort}", {
agent: agent
path: @cfg.socketIoRoute
parser: socketIo.circularParser
rejectUnauthorized: false
})
@wsClient.on "connect", -> done()

4 changes: 0 additions & 4 deletions packages/socket/lib/client.js
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
const circularParser = require('socket.io-circular-parser')

module.exports = require('socket.io-client')

module.exports.circularParser = circularParser
3 changes: 0 additions & 3 deletions packages/socket/lib/socket.js
Original file line number Diff line number Diff line change
@@ -4,15 +4,12 @@ const server = require('socket.io')
const version = require('socket.io-client/package.json').version
const clientPath = require.resolve('socket.io-client')
const client = require('./client')
const circularParser = require('socket.io-circular-parser')

module.exports = {
server,

client,

circularParser,

getPathToClientSource () {
// clientPath returns the path to socket.io-client/lib/index.js
// so walk up two levels to get to the root
5 changes: 2 additions & 3 deletions packages/socket/package.json
Original file line number Diff line number Diff line change
@@ -17,9 +17,8 @@
"lib"
],
"dependencies": {
"socket.io": "2.2.0",
"socket.io-circular-parser": "3.1.2",
"socket.io-client": "2.2.0"
"socket.io": "1.7.4",
"socket.io-client": "1.7.4"
},
"devDependencies": {
"bin-up": "1.2.0",