Skip to content

Commit

Permalink
Fix request line parse error if url contains http #543
Browse files Browse the repository at this point in the history
  • Loading branch information
Huachao committed Mar 10, 2020
1 parent ed02b44 commit 6cfd071
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/utils/httpRequestParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,7 @@ export class HttpRequestParser implements IRequestParser {
// Provides both request method and url
method = words.shift()!;
url = line.trim().substring(method.length).trim();
const match = words[words.length - 1].match(/HTTP\/.*/gi);
if (match) {
if (/^HTTP\/.*$/i.test(words[words.length - 1])) {
url = url.substring(0, url.lastIndexOf(words[words.length - 1])).trim();
}
}
Expand Down

0 comments on commit 6cfd071

Please sign in to comment.