Skip to content

Commit

Permalink
remove unnecessary hack
Browse files Browse the repository at this point in the history
  • Loading branch information
mshustov committed Jun 10, 2021
1 parent 7917e3c commit 80ecbd2
Showing 1 changed file with 1 addition and 18 deletions.
19 changes: 1 addition & 18 deletions src/core/server/http/lifecycle/on_pre_routing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,24 +102,7 @@ export function adoptToHapiOnRequest(fn: OnPreRoutingHandler, log: Logger) {
appState.rewrittenUrl = appState.rewrittenUrl ?? request.url;

const { url } = result;

// TODO: Remove once we upgrade to Node.js 12!
//
// Warning: The following for-loop took 10 days to write, and is a hack
// to force V8 to make a copy of the string in memory.
//
// The reason why we need this is because of what appears to be a bug
// in V8 that caused some URL paths to not be routed correctly once
// `request.setUrl` was called with the path.
//
// The details can be seen in this discussion on Twitter:
// https://twitter.com/wa7son/status/1319992632366518277
let urlCopy = '';
for (let i = 0; i < url.length; i++) {
urlCopy += url[i];
}

request.setUrl(urlCopy);
request.setUrl(url);

// We should update raw request as well since it can be proxied to the old platform
request.raw.req.url = url;
Expand Down

0 comments on commit 80ecbd2

Please sign in to comment.