aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/filetransfer.cc
AgeCommit message (Collapse)Author
2021-01-27Drop trailing whitespaceEelco Dolstra
2021-01-25Merge pull request #4467 from edolstra/error-formattingEelco Dolstra
Improve error formatting
2021-01-22Handle missing etag in 304 Not Modified responseMatthew Bauer
GitHub now omits the etag, but 304 implies it matches the one we provided. Just use that one to avoid having an etag-less resource. Fixes #4469
2021-01-21Improve error formattingEelco Dolstra
Changes: * The divider lines are gone. These were in practice a bit confusing, in particular with --show-trace or --keep-going, since then there were multiple lines, suggesting a start/end which wasn't the case. * Instead, multi-line error messages are now indented to align with the prefix (e.g. "error: "). * The 'description' field is gone since we weren't really using it. * 'hint' is renamed to 'msg' since it really wasn't a hint. * The error is now printed *before* the location info. * The 'name' field is no longer printed since most of the time it wasn't very useful since it was just the name of the exception (like EvalError). Ideally in the future this would be a unique, easily googleable error ID (like rustc). * "trace:" is now just "…". This assumes error contexts start with something like "while doing X". Example before: error: --- AssertionError ---------------------------------------------------------------------------------------- nix at: (7:7) in file: /home/eelco/Dev/nixpkgs/pkgs/applications/misc/hello/default.nix 6| 7| x = assert false; 1; | ^ 8| assertion 'false' failed ----------------------------------------------------- show-trace ----------------------------------------------------- trace: while evaluating the attribute 'x' of the derivation 'hello-2.10' at: (192:11) in file: /home/eelco/Dev/nixpkgs/pkgs/stdenv/generic/make-derivation.nix 191| // (lib.optionalAttrs (!(attrs ? name) && attrs ? pname && attrs ? version)) { 192| name = "${attrs.pname}-${attrs.version}"; | ^ 193| } // (lib.optionalAttrs (stdenv.hostPlatform != stdenv.buildPlatform && !dontAddHostSuffix && (attrs ? name || (attrs ? pname && attrs ? version)))) { Example after: error: assertion 'false' failed at: (7:7) in file: /home/eelco/Dev/nixpkgs/pkgs/applications/misc/hello/default.nix 6| 7| x = assert false; 1; | ^ 8| … while evaluating the attribute 'x' of the derivation 'hello-2.10' at: (192:11) in file: /home/eelco/Dev/nixpkgs/pkgs/stdenv/generic/make-derivation.nix 191| // (lib.optionalAttrs (!(attrs ? name) && attrs ? pname && attrs ? version)) { 192| name = "${attrs.pname}-${attrs.version}"; | ^ 193| } // (lib.optionalAttrs (stdenv.hostPlatform != stdenv.buildPlatform && !dontAddHostSuffix && (attrs ? name || (attrs ? pname && attrs ? version)))) {
2020-12-02Sink: Use std::string_viewEelco Dolstra
2020-10-06Remove static variable name clashesEelco Dolstra
This was useful for an experiment with building Nix as a single compilation unit. It's not very useful otherwise but also doesn't hurt...
2020-09-25Merge remote-tracking branch 'origin/master' into github-api-tokenGregory Hale
2020-09-21Move Callback into its own headerEelco Dolstra
This gets rid of the inclusion of <future> in util.hh, cutting compilation time by ~20s (CPU time). Issue #4045.
2020-09-16Fetch commits from github/gitlab using Auth headerGreg Hale
`nix flake info` calls the github 'commits' API, which requires authorization when the repository is private. Currently this request fails with a 404. This commit adds an authorization header when calling the 'commits' API. It also changes the way that the 'tarball' API authenticates, moving the user's token from a query parameter into the Authorization header. The query parameter method is recently deprecated and will be disallowed in November 2020. Using them today triggers a warning email.
2020-07-20Use heuristics to decide when to show the responseCarlo Nucera
Due to https://github.com/NixOS/nix/issues/3841 we don't know how print different messages for different verbosity levels.
2020-07-16Merge branch 'master' of github.com:NixOS/nix into add-body-to-network-errorsCarlo Nucera
2020-07-15Merge branch 'master' of github.com:NixOS/nix into add-body-to-network-errorsCarlo Nucera
2020-06-26Merge remote-tracking branch 'origin/master' into flakesEelco Dolstra
2020-06-18Fix bugsJohn Ericson
- Bad dynamic cast target ...classic - std::shared_ptr need explicit deref
2020-06-18Merge remote-tracking branch 'obsidian/fix-url-format' into ↵John Ericson
add-body-to-network-errors
2020-06-18Prevent '%' in URL from causing crashesJohn Ericson
We have a larger problem that passsing computed strings to the first variable argument of many exception constructors is unsafe because that first variable argument is interpreted not as a plain string, but format string, and if it contains '%' boost::format will abort, since there are no arguments to the format string. In this particular instance '%' was used as part of an escape code in a URL, which, when the download failed, caused Nix to abort displaying the `FileTransferError`.
2020-06-18Adjust FileTransferError message to use opt responseJohn Ericson
2020-06-17Add HTTP responses to FileTransferErrorsCarlo Nucera
2020-06-17Replace `TransferItem::status` with a local variableCarlo Nucera
Everywhere seems to use `getHTTPStatus` now.
2020-06-17Include review commentsCarlo Nucera
2020-06-17Make successful states coherentCarlo Nucera
The successful states used in these two places in the code were slightly different. Should they be the same list?
2020-06-17Fix coverage buildEelco Dolstra
2020-06-17Merge remote-tracking branch 'origin/master' into flakesEelco Dolstra
2020-06-16Fix FTP supportEelco Dolstra
Fixes #3618.
2020-06-15Remove trailing whitespaceEelco Dolstra
2020-06-09Show HTTP status messageEelco Dolstra
For example: warning: unable to download 'https://api.github.com/repos/edolstra/dwarffs/commits/master': HTTP error 403 ('rate limit exceeded'); using cached version
2020-06-09FileTransfer: Don't store status since curl already does thatEelco Dolstra
2020-06-02elide the 'ErrorInfo' in logError and logWarning callsBen Burdette
2020-05-13consistent capitalizationBen Burdette
2020-05-11Merge branch 'master' into errors-phase-2Ben Burdette
2020-04-08datatransfer.{cc,hh} -> filetransfer.{cc,hh}Nikola Knezevic