Skip to content

Commit

Permalink
fix: PWSL's URL parsing
Browse files Browse the repository at this point in the history
This commit fixes PWSL's URL parsing, which was not including search/query params.
  • Loading branch information
ThePedroo committed Nov 22, 2023
1 parent 7df6c4d commit 8b5700c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/ws.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ function parseFrameHeader(buffer) {
mask = buffer.subarray(startIndex, startIndex + 4)
startIndex += 4

buffer = buffer.subarray(startIndex, startIndex + payloadLength)

for (let i = 0; i < buffer.length; i++) {
buffer[i] ^= mask[i & 3]
buffer[i] ^= mask[i & 3];
}
} else {
buffer = buffer.subarray(startIndex, startIndex + payloadLength)
Expand Down Expand Up @@ -65,7 +67,7 @@ class WebSocket extends EventEmitter {
const agent = isSecure ? https : http
const key = crypto.randomBytes(16).toString('base64')

const request = agent.request((isSecure ? 'https://' : 'http://') + parsedUrl.hostname + parsedUrl.pathname, {
const request = agent.request((isSecure ? 'https://' : 'http://') + parsedUrl.hostname + parsedUrl.pathname + parsedUrl.search, {
port: parsedUrl.port || (isSecure ? 443 : 80),
timeout: this.options?.timeout || 0,
createConnection: (options) => {
Expand Down

0 comments on commit 8b5700c

Please sign in to comment.