Commit Graph

72 Commits

Author SHA1 Message Date
Ben Newman
31c0d19019 Style tweaks and a small bug fix.
These checks should still happen when body is an empty string, which (for
better or worse) is falsy in JavaScript.
2017-05-21 12:09:34 -04:00
David Glasser
3dbac9e19c tools: fix Galaxy discovery
1a036553 in 1.4.4.2 expanded on the HTTP error checking added by 30aec9f in
1.4.2. Neither of these changes were aware that discoverGalaxy invokes
httpHelpers.request with json:true, resulting in a `body` that is a parsed JSON
object rather than a string or Buffer.  Before 1.4.4.2, this had no consequences
because body.length is undefined and `undefined < 90` is false, but the change
to Buffer.byteLength actually made the condition true.

It's safe to not check length in the JSON case because a truncated JSON object
is not legal JSON (unless the truncation just drops trailing whitespace, in
white case that's OK).

I check for both string and Buffer because some calls to this function pass in
an encoding option.  Buffer.byteLength works with both types.
2017-05-21 12:09:34 -04:00
Ben Newman
1a036553c1 Fix faulty content-length comparison in utils/http-helpers.js.
Since body is a string, body.length is not necessarily the number of bytes
in the response body.
2017-04-25 16:11:29 -07:00
Ben Newman
ab0f9ba290 Force garbage collection more aggressively during meteor --get-ready.
This is an effort to keep the `meteor --get-ready` command from running
out of memory during Circle CI tests, as mentioned in this comment:
https://github.com/meteor/meteor/pull/8327#issuecomment-284431618
2017-03-06 20:34:56 -05:00
Ben Newman
dd012bf6e5 Tolerate " => awaited here:" in parseStackFrames.
da826064bc
2016-11-01 17:25:42 -04:00
Ben Newman
47d3546b3a Fix problems in request callback that broke getUrlWithResuming tests. 2016-10-21 11:25:17 -04:00
Ben Newman
545493b34a Report an error when HTTP request body is incomplete.
When a download aborts prematurely, the status code is often 200 OK, even
though we probably should not proceed with any further processing of the
downloaded information.

This silent failure leads to problems like the dreaded "Error: ENOENT: no
such file or directory, open... os.json" (#7806 and others), which were
hard to diagnose properly because the failure occurred only later, when
extracting a buffer that downloaded incompletely.

The getUrlWithResuming helper should be able to retry after this error is
thrown, which will result in a more helpful warning, even if in the most
common case, i.e. MaxCDN failure, it will never actually succeed.

Note that this change will not help until Meteor 1.4.2 is officially
released and becomes the implementation used to download later releases.

Mitigates #7806.
2016-10-21 11:25:17 -04:00
Ben Newman
bb8e1a3b9f Implement ConcatStream class instead of using concat-stream npm package. 2016-08-01 14:42:22 -04:00
Tom Coleman
7769951ee8 Switched to concat-stream for performance 2016-08-01 17:55:37 +10:00
Ben Newman
e85cef8e1a Make download resumption test faster and more deterministic.
We now use a smaller file (the `babel-compiler` archive instead of
`meteor-tool`), and we interrupt every 500kB, which leads to three total
interruptions for that file. Also, we only delay one second (instead of
five) between attempts.
2016-07-14 17:00:08 -04:00
Ben Newman
91f203999b Make download resumption test always run (and pass).
This is a test that really needs to run and pass every time we run the
test suite, so I decided it shouldn't be --slow. If it takes too long, we
can always download a smaller test file.

Hard-coding the download length was a recipe for brittleness, so now I'm
downloading the file without interruptions in parallel with the
interrupted/resumed download, so that we can compare the two files when
both have finished downloading.

Follow-up to #7399.
2016-07-14 16:05:35 -04:00
Ben Newman
0c43039f60 Avoid fiberHelpers.bindEnvironment by returning Promise from attempt.
Follow-up to #7399.
2016-07-14 11:47:32 -04:00
Ben Newman
fbfb5b84e2 Avoid exposing httpHelpers._currentRequest.
Follow-up to #7399.
2016-07-14 11:47:32 -04:00
Tom Coleman
2cb3462b6d Minor fixes + added a comment 2016-07-14 11:47:32 -04:00
Tom Coleman
4a28c33dd7 Better logging and progress
Using Console.debug to register messages about retries.
2016-07-14 11:47:31 -04:00
Tom Coleman
36011459fa Made the test work in a sensible way 2016-07-14 11:47:31 -04:00
Tom Coleman
cc07c15b6b First pass at request resuming via buffering the range header
This is still a WIP, but I wanted to get feedback at this point.
Will update the PR with outstanding TODOs.
2016-07-14 11:47:30 -04:00
Ben Newman
e90ce88b0e Fix a bug in tools/utils/http-helpers.js. 2016-07-14 11:27:58 -04:00
Ben Newman
df77c39908 Bump default HTTP timeout to 60 seconds, and allow disabling. 2016-06-23 11:49:23 -04:00
Zoltan Olah
8f86d08827 Merge pull request #7143 from mitar/timeouts
Set timeout for HTTP requests
2016-06-22 08:59:38 +10:00
Mitar
3846c6f45c Changed timeout 30 seconds as instructed by our god Math.random(). 2016-06-16 23:12:08 -07:00
Ben Newman
dce2b20ddb Merge pull request #7033 from meteor/release-1.3.3
Release 1.3.3
2016-06-10 18:18:28 -04:00
chemicstry
512799ed9e Initial IPv6 support 2016-06-06 02:17:36 +03:00
Mitar
853e218a89 Set timeout for HTTP requests. 2016-05-31 23:35:46 +02:00
Ben Newman
d94e7d812d Upgrade dev bundle meteor-promise to 0.7.1. 2016-05-16 18:21:11 -04:00
Tom Coleman
15db86ec3e Minor cleanup 2016-05-05 16:32:10 -07:00
Tom Coleman
88ed8e289a Use longjohn to repair stacktraces on self-test 2016-05-05 15:05:52 -07:00
Tom Coleman
4056111acb Use longjohn to repair stacktraces on self-test 2016-05-05 14:42:05 -07:00
Martijn Walraven
743b740359 Add a trailing slash in utils.formatUrl for consistency with Meteor.absoluteUrl 2016-02-24 12:55:26 +01:00
Martijn Walraven
99e58d72a0 Support modern Cordova whitelist mechanism 2016-01-25 15:02:39 -08:00
Steven Edouard
fd83e399fe Launch processes in a Windows-friendly way
- options.cwd passed through convertToOSPath
- launch processes on Windows using child_process.exec
- parse args for windows into space-delimited string
2016-01-25 15:02:02 -08:00
Ben Newman
f7b2735d23 Reimplement fiberHelpers.parallelEach without explicit Fibers. 2015-12-09 12:06:52 -05:00
Ben Newman
79f82911d0 Avoid having to use Fibers explicitly in buildmessage.forkJoin. 2015-12-09 12:06:52 -05:00
Ben Newman
3cafbc72ac Use async functions to eliminate the need for fiberHelpers.inBareFiber.
The comments for inBareFiber claim that it's for times when you don't want
to inherit the dynamic environment variables of the current Fiber, but
none of the call sites actually relied on this behavior. Still, it may be
worth noting that async functions automatically (and cheaply) inherit the
calling Fiber's dynamics, which is virtually always what you want.
2015-12-09 12:06:51 -05:00
Ben Newman
2d8fbb6c79 Eliminate Future-related utilities from tools/fiber-helpers.js. 2015-12-09 12:06:51 -05:00
Ben Newman
d54410db8e Eliminate Future from tools/service-connection.js. 2015-12-09 12:06:48 -05:00
Ben Newman
7f0156f273 Eliminate Future from tools/http-helpers.js. 2015-12-09 12:06:47 -05:00
Ben Newman
15ef3884cc Eliminate Future from tools/utils.js. 2015-12-09 12:06:46 -05:00
Ben Newman
c815a5b534 Eliminate Future from tools/buildmessage.js. 2015-12-09 12:06:46 -05:00
Tom Coleman
705a7eda1a Switch the semantics - forNpm -> forCordova
Cordova uses npm but is *more* specific so this is less potentially confusing.
2015-11-25 16:27:36 +11:00
Tom Coleman
54396f78b7 Switch semantics to isValidVersion 2015-11-25 16:27:36 +11:00
Tom Coleman
81fff25ecb Don't require npm URLs to have a #commit-ish
Npm says it will default to `master`. That's OK by us.
2015-11-25 16:27:35 +11:00
Tom Coleman
222115665b Refactored isExactVersionto handle npm/cordova
See https://github.com/meteor/meteor/pull/5562/files for a discussion. Basically Cordova doesn't really support

a) Urls with @'s in them
b) Urls that don't point to fixed commits.

As this branch allows both of the above (and our NPM support does reasonably handle a+b), we split the way we handle cordova + npm URLs a little.
2015-11-25 16:27:35 +11:00
Tom Coleman
58cbe65060 Allow the other types of URLs that npm supports.
See for instance #844 for people running into the
fact that our lack of support for git protocols means
dealing with private npm packages is a pain.
2015-11-25 16:27:11 +11:00
Ben Newman
ed17924940 Add braces to every if/for(-in)/while statement in tools directory. 2015-11-13 12:25:19 -05:00
Blake Bourque
0aa1291fd6 Patch to allow users to override root cert list
Fixes #4757
Uses environment variable CAFILE (to match NPM) which must contain a fully qualified path to a pem format root certificate to include in the list of trusted root certs.

This additional root certificate will be needed for those behind an SSL inspection proxy which acts as an SSL termination point and resigns the traffic with its own root certificate.
2015-10-27 13:39:18 -07:00
Martijn Walraven
76bb1a183e Make buildmessage.exception() deal with the case where an error has no stack trace 2015-09-24 12:03:51 +02:00
Sashko Stubailo
550489cea8 Intelligently decide which stack trace to use 2015-09-14 17:51:43 -07:00
Sashko Stubailo
e2d4556479 Special-case http imports in LESS package 2015-09-14 11:53:58 -07:00
Martijn Walraven
b274e5390a Fix bug in execFileAsync that meant options were ignored without args 2015-09-11 18:44:17 +02:00