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

Remove legacy code path for noteId in socket io connections #58

Closed
ccoenen opened this issue Apr 20, 2019 · 1 comment

Comments

@ccoenen
Copy link
Member

commented Apr 20, 2019

socket-io used to use the referer field to determine the note-id. This was changed over a year ago towards the query part of the url. A backwards compatibility was left in place. I think it's time to remove that.

server/lib/realtime.js

Lines 280 to 289 in 321114d

} else if (socket.handshake.headers) {
// this part is only for backward compatibility only; current code
// should be using noteId query parameter instead.
var referer = socket.handshake.headers.referer
if (!referer) {
return false
}
var hostUrl = url.URL.parse(referer)
var noteId = config.urlPath ? hostUrl.pathname.slice(config.urlPath.length + 1, hostUrl.pathname.length).split('/')[1] : hostUrl.pathname.split('/')[1]
return noteId

This was originally discussed in hackmdio/codimd#623 and changed in c4f8fb7

@SISheogorath SISheogorath added bug enhancement and removed bug labels Apr 27, 2019
@Amolith

This comment has been minimized.

Copy link
Contributor

commented Oct 3, 2019

I can take a look at this one!

Amolith added a commit to Amolith/server that referenced this issue Oct 3, 2019
Signed-off-by: Amolith <amolith@nixnet.xyz>
Amolith added a commit to Amolith/server that referenced this issue Oct 3, 2019
Signed-off-by: Amolith <amolith@nixnet.xyz>
SISheogorath added a commit that referenced this issue Oct 5, 2019
remove legacy code to solve #58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.