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

Handle all valid URL path characters for rootURL/baseURL in tests-server #5909

Merged
merged 2 commits into from
May 26, 2016

Conversation

les2
Copy link
Contributor

@les2 les2 commented May 20, 2016

The previous implementation used a regular expression for matching the
beginning of the request path against the baseURL + 'tests' but did
not escape the baseURL. Because RFC 3986 allows some characters that
are not valid in regexes, this caused problems when using them for
the baseURL.

Closes #5876

@@ -41,7 +41,8 @@ TestsServerAddon.prototype.serverMiddleware = function(config) {
var filePath = path.join(results.directory, assetPath);

if (!existsSync(filePath) || !fs.statSync(filePath).isFile()) {
var newURL = baseURL + '/tests/index.html';
// N.B., `baseURL` will end with a slash as it went through `cleanBaseURL`
var newURL = baseURL + 'tests/index.html';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appeared to be an existing bug. Without this change I got a double /, making my assertions fail: /braden/+//tests/index.html.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, no need for that code comment though IMHO

@stefanpenner
Copy link
Contributor

@rwjblue r?

@Turbo87 Turbo87 added the bug label May 20, 2016
@les2
Copy link
Contributor Author

les2 commented May 20, 2016

The AppVeyor problem is related to phantomjs-prebuilt not being installed (for the Environment: nodejs_version=4.2). Does not seem related to these changes.

retest this

> phantomjs-prebuilt@2.1.6 install C:\projects\ember-cli\node_modules\phantomjs-prebuilt
> node install.js

PhantomJS not found on PATH
Downloading https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-windows.zip
Saving to C:\Users\appveyor\AppData\Local\Temp\1\phantomjs\phantomjs-2.1.1-windows.zip
Receiving...

Error requesting archive.
Status: 403
Request options: {
  "uri": "https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-windows.zip",
  "encoding": null,
  "followRedirect": true,
  "headers": {
    "User-Agent": "npm/2.14.12 node/v4.2.6 win32 ia32"
  },
  "strictSSL": true
}
Response headers: {
  "x-amz-request-id": "19079527EFA0EDBF",
  "x-amz-id-2": "noVWU6FJkOI40JJ+Ynl4d3/xz/r9h8h9GgCwL6Q+d8/+7oW0FUb2xJig0ODzQ6xyxBc4wdpiZws=",
  "content-type": "application/xml",
  "transfer-encoding": "chunked",
  "date": "Fri, 20 May 2016 02:49:24 GMT",
  "server": "AmazonS3",
  "connection": "close"
}
Make sure your network and proxy settings are correct.

If you continue to have issues, please report this full log at https://github.com/Medium/phantomjs
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "phantomjs-prebuilt"
npm ERR! node v4.2.6
npm ERR! npm  v2.14.12
npm ERR! code ELIFECYCLE

@les2
Copy link
Contributor Author

les2 commented May 20, 2016

This works for me. The appveyor build probably needs a re-run to get around a temporary network problem?

curl -L https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-windows.zip > phantomjs-2.1.1-windows.zip

@stefanpenner
Copy link
Contributor

kicking appveyor now

@les2 les2 force-pushed the test-server-base-url-escaping branch from 900b15a to d8607dd Compare May 20, 2016 19:30
@les2
Copy link
Contributor Author

les2 commented May 20, 2016

Pushed a change to a comment to make build run again.

@Turbo87
Copy link
Member

Turbo87 commented May 21, 2016

Looks good in general 👍

Not sure what's up with CI at the moment...

@Turbo87
Copy link
Member

Turbo87 commented May 24, 2016

@les2 could you rebase on the current master branch? hopefully that should solve the CI issues...

@les2
Copy link
Contributor Author

les2 commented May 25, 2016

@Turbo87 rebasing ...

les2 added 2 commits May 25, 2016 17:01
Unit test demonstrating bug caused by `+` in baseURL or rootURL.
The previous implementation used a regular expression for matching the
beginning of the request path against the baseURL + 'tests' but did
not escape the baseURL. Because RFC 3986 allows some characters that
are not valid in regexes, this caused problems when using them for
the baseURL.

Closes ember-cli#5876
@les2 les2 force-pushed the test-server-base-url-escaping branch from d8607dd to 17465cd Compare May 25, 2016 21:01
@les2
Copy link
Contributor Author

les2 commented May 26, 2016

@Turbo87 @stefanpenner CI passes now

@Turbo87
Copy link
Member

Turbo87 commented May 26, 2016

@les2 awesome, thanks!

@homu r+

@homu
Copy link
Contributor

homu commented May 26, 2016

📌 Commit 17465cd has been approved by Turbo87

@homu
Copy link
Contributor

homu commented May 26, 2016

⚡ Test exempted - status

@homu homu merged commit 17465cd into ember-cli:master May 26, 2016
homu added a commit that referenced this pull request May 26, 2016
Handle all valid URL path characters for rootURL/baseURL in tests-server

The previous implementation used a regular expression for matching the
beginning of the request path against the baseURL + 'tests' but did
not escape the baseURL. Because RFC 3986 allows some characters that
are not valid in regexes, this caused problems when using them for
the baseURL.

Closes #5876
@Turbo87
Copy link
Member

Turbo87 commented May 26, 2016

@stefanpenner @nathanhammond I'd like to pull this into the beta branch unless there are any objections

@les2 les2 deleted the test-server-base-url-escaping branch May 26, 2016 14:23
homu added a commit that referenced this pull request Jun 2, 2016
"tests-server" test cleanup

This PR cleans up the "tests-server" unit test now that #5909 is merged.
@nathanhammond
Copy link
Contributor

Late to seeing this. It's in beta now! 😛

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

Successfully merging this pull request may close these issues.

None yet

5 participants