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

Middleware regression: Port mixup and infinite loop #1987

Closed
Krinkle opened this issue Mar 12, 2016 · 3 comments · May be fixed by Omrisnyk/npm-lockfiles#122 or Omrisnyk/npm-lockfiles#132
Closed

Middleware regression: Port mixup and infinite loop #1987

Krinkle opened this issue Mar 12, 2016 · 3 comments · May be fixed by Omrisnyk/npm-lockfiles#122 or Omrisnyk/npm-lockfiles#132

Comments

@Krinkle
Copy link
Contributor

Krinkle commented Mar 12, 2016

Enviroment Details

  • Karma version: v0.13.22
  • Relevant part of your Gruntfile.js file

        karma: {
            options: {
                proxies: { '/w': 'http://krinkle.dev/w' }
                files: [ {
                    pattern: 'http://krinkle.dev/w/index.php?title=Special:JavaScriptTest/qunit/export',
                    watched: false,
                    included: true,
                    served: false
                } ],
                logLevel: 'DEBUG',
                frameworks: [ 'qunit' ],
                reporters: [ 'progress' ],
                singleRun: true,
                autoWatch: false, ..

Steps to reproduce the behaviour

When the test page make requests that hit the proxy, as of recent (v1.13.x somewhere) the proxy destination wrongly include the Karma server's port (which is irrelevant to my server).

E.g. instead of making requests to http://krinkle.dev/w/foo it ends up requesting /w/foo from krinkle.dev:9876. This resolving to localhost then causes an infinite loop.

Actual behavior

$ grunt qunit
Running "assert-mw-env" task
{ '/w': 'http://alpha.wikipedia.krinkle.dev/w' }

Running "karma:main" (karma) task
12 03 2016 03:08:43.823:DEBUG [plugin]: Loading karma-* from /Users/krinkle/Development/mediawiki/core/node_modules
12 03 2016 03:08:43.826:DEBUG [plugin]: Loading plugin /Users/krinkle/Development/mediawiki/core/node_modules/karma-chrome-launcher.
12 03 2016 03:08:43.829:DEBUG [plugin]: Loading plugin /Users/krinkle/Development/mediawiki/core/node_modules/karma-firefox-launcher.
12 03 2016 03:08:43.831:DEBUG [plugin]: Loading plugin /Users/krinkle/Development/mediawiki/core/node_modules/karma-qunit.
12 03 2016 03:08:43.876:INFO [karma]: Karma v0.13.22 server started at http://localhost:9876/
12 03 2016 03:08:43.881:INFO [launcher]: Starting browser Chrome
12 03 2016 03:08:43.882:DEBUG [temp-dir]: Creating temp dir at /var/folders/5g/w6rp8_3d56s7jmxjz8p6fznw0000gn/T/karma-37263408
12 03 2016 03:08:43.882:DEBUG [launcher]: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome --user-data-dir=/var/folders/5g/w6rp8_3d56s7jmxjz8p6fznw0000gn/T/karma-37263408 --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-background-timer-throttling http://localhost:9876/?id=37263408
12 03 2016 03:08:44.570:DEBUG [web-server]: serving: /Users/krinkle/Development/mediawiki/core/node_modules/karma/static/client.html
12 03 2016 03:08:44.591:DEBUG [web-server]: serving: /Users/krinkle/Development/mediawiki/core/node_modules/karma/static/karma.js
12 03 2016 03:08:44.771:DEBUG [karma]: A browser has connected on socket /#MmzbKyrWPLCFsxhDAAAA
12 03 2016 03:08:44.786:DEBUG [web-server]: upgrade /socket.io/?EIO=3&transport=websocket&sid=MmzbKyrWPLCFsxhDAAAA
12 03 2016 03:08:44.786:DEBUG [proxy]: NOT upgrading proxyWebSocketRequest /socket.io/?EIO=3&transport=websocket&sid=MmzbKyrWPLCFsxhDAAAA
12 03 2016 03:08:44.814:DEBUG [web-server]: serving: /Users/krinkle/Development/mediawiki/core/node_modules/karma/static/favicon.ico
12 03 2016 03:08:44.836:INFO [Chrome 49.0.2623 (Mac OS X 10.10.5)]: Connected on socket /#MmzbKyrWPLCFsxhDAAAA with id 37263408
12 03 2016 03:08:44.837:DEBUG [launcher]: Chrome (id 37263408) captured in 0.96 secs
12 03 2016 03:08:44.856:DEBUG [web-server]: serving: /Users/krinkle/Development/mediawiki/core/node_modules/karma/static/context.html
12 03 2016 03:08:44.871:DEBUG [middleware:source-files]: Requesting /base/node_modules/qunitjs/qunit/qunit.js?a0a54a55df055bd6be9ffbf07ec09ac17504d374 /
12 03 2016 03:08:44.872:DEBUG [middleware:source-files]: Fetching /Users/krinkle/Development/mediawiki/core/node_modules/qunitjs/qunit/qunit.js
12 03 2016 03:08:44.874:DEBUG [web-server]: serving (cached): /Users/krinkle/Development/mediawiki/core/node_modules/qunitjs/qunit/qunit.js
12 03 2016 03:08:44.877:DEBUG [middleware:source-files]: Requesting /base/node_modules/karma-qunit/lib/adapter.js?2cc5e3594a3b8ae53e8218929324788866ad223b /
12 03 2016 03:08:44.877:DEBUG [middleware:source-files]: Fetching /Users/krinkle/Development/mediawiki/core/node_modules/karma-qunit/lib/adapter.js
12 03 2016 03:08:44.878:DEBUG [web-server]: serving (cached): /Users/krinkle/Development/mediawiki/core/node_modules/karma-qunit/lib/adapter.js
12 03 2016 03:08:45.584:DEBUG [middleware:source-files]: Requesting /w/load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=vector&version=qsOUMuwT /
12 03 2016 03:08:45.584:DEBUG [middleware:source-files]: Fetching /w/load.php
12 03 2016 03:08:45.585:DEBUG [proxy]: proxying request - /w/load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=vector&version=qsOUMuwT to alpha.wikipedia.krinkle.dev:9876
12 03 2016 03:08:45.594:DEBUG [middleware:source-files]: Requesting /w/load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=vector&version=qsOUMuwT /
12 03 2016 03:08:45.594:DEBUG [middleware:source-files]: Fetching /w/load.php
12 03 2016 03:08:45.595:DEBUG [proxy]: proxying request - /w/load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=vector&version=qsOUMuwT to alpha.wikipedia.krinkle.dev:9876
12 03 2016 03:08:45.599:DEBUG [middleware:source-files]: Requesting /w/load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=vector&version=qsOUMuwT /
12 03 2016 03:08:45.599:DEBUG [middleware:source-files]: Fetching /w/load.php
12 03 2016 03:08:45.599:DEBUG [proxy]: proxying request - /w/load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=vector&version=qsOUMuwT to alpha.wikipedia.krinkle.dev:9876
12 03 2016 03:08:45.602:DEBUG [middleware:source-files]: Requesting /w/load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=vector&version=qsOUMuwT /
12 03 2016 03:08:45.603:DEBUG [middleware:source-files]: Fetching /w/load.php
12 03 2016 03:08:45.603:DEBUG [proxy]: proxying request - /w/load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=vector&version=qsOUMuwT to alpha.wikipedia.krinkle.dev:9876
12 03 2016 03:08:45.610:DEBUG [middleware:source-files]: Requesting /w/load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=vector&version=qsOUMuwT /
12 03 2016 03:08:45.610:DEBUG [middleware:source-files]: Fetching /w/load.php
12 03 2016 03:08:45.610:DEBUG [proxy]: proxying request - /w/load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=vector&version=qsOUMuwT to alpha.wikipedia.krinkle.dev:9876
12 03 2016 03:08:45.616:DEBUG [middleware:source-files]: Requesting /w/load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=vector&version=qsOUMuwT /
12 03 2016 03:08:45.616:DEBUG [middleware:source-files]: Fetching /w/load.php
12 03 2016 03:08:45.617:DEBUG [proxy]: proxying request - /w/load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=vector&version=qsOUMuwT to alpha.wikipedia.krinkle.dev:9876
12 03 2016 03:08:45.622:DEBUG [middleware:source-files]: Requesting /w/load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=vector&version=qsOUMuwT /
12 03 2016 03:08:45.622:DEBUG [middleware:source-files]: Fetching /w/load.php
12 03 2016 03:08:45.622:DEBUG [proxy]: proxying request - /w/load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=vector&version=qsOUMuwT to alpha.wikipedia.krinkle.dev:9876
12 03 2016 03:08:45.624:DEBUG [middleware:source-files]: Requesting /w/load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=vector&version=qsOUMuwT /
12 03 2016 03:08:45.624:DEBUG [middleware:source-files]: Fetching /w/load.php
12 03 2016 03:08:45.625:DEBUG [proxy]: proxying request - /w/load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=vector&version=qsOUMuwT to alpha.wikipedia.krinkle.dev:9876
12 03 2016 03:08:45.627:DEBUG [middleware:source-files]: Requesting /w/load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=vector&version=qsOUMuwT /
12 03 2016 03:08:45.627:DEBUG [middleware:source-files]: Fetching /w/load.php
12 03 2016 03:08:45.628:DEBUG [proxy]: proxying request - /w/load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=vector&version=qsOUMuwT to alpha.wikipedia.krinkle.dev:9876
..

[middleware:source-files]: Requesting /w/load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=vector&version=qsOUMuwT /
[middleware:source-files]: Fetching /w/load.php
[proxy]: proxying request - /w/load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=vector&version=qsOUMuwT to alpha.wikipedia.krinkle.dev:9876
[middleware:source-files]: Requesting /w/load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=vector&version=qsOUMuwT /
[middleware:source-files]: Fetching /w/load.php
[proxy]: proxying request - /w/load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=vector&version=qsOUMuwT to alpha.wikipedia.krinkle.dev:9876
[middleware:source-files]: Requesting /w/load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=vector&version=qsOUMuwT /
[middleware:source-files]: Fetching /w/load.php
[proxy]: proxying request - /w/load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=vector&version=qsOUMuwT to alpha.wikipedia.krinkle.dev:9876
[middleware:source-files]: Requesting /w/load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=vector&version=qsOUMuwT /

You get the idea :)

@dignifiedquire
Copy link
Member

Thanks for the report.

budde377 added a commit to budde377/karma that referenced this issue Mar 21, 2016
Derive port from proxy-protocol if present.

Closes karma-runner#1987
budde377 added a commit to budde377/karma that referenced this issue Mar 22, 2016
Derive port from proxy-protocol if present.

Closes karma-runner#1987
budde377 added a commit to budde377/karma that referenced this issue Mar 22, 2016
Derive port from proxy-protocol if present.

Closes karma-runner#1987
@zzo
Copy link
Contributor

zzo commented Apr 20, 2016

@dignifiedquire are you waiting in something else to release this?

@dignifiedquire
Copy link
Member

@zzo the time to prepare everything

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants