Commit graph

37 commits

Author SHA1 Message Date
Ed Page e4e10f2393 chore: Fix typos
This is a repeat of #11561
2023-09-19 15:28:48 -05:00
Deadbeef 3d50f47197 Add fields for bindeps on the registry 2023-08-25 01:43:29 +00:00
Weihang Lo 31b500c7c0
refactor(crates-io): use thiserror
Optionally use `thiserror` to reduce boilerplates but this part can
be dropped if we don't want.
2023-07-18 22:22:47 +01:00
Weihang Lo b4499af4e9
refactor(crates-io): remove anyhow
This removes the dependency `anyhow` and uses our own custom Error
enum, so that crates-io consumer can access `Error::API::challenge`
field.
2023-07-18 22:22:47 +01:00
Weihang Lo a561e8b781
feat(crates-io): use our own Result wrapper everywhere 2023-07-18 22:22:47 +01:00
Weihang Lo ed6692b1c6
refactor(crates-io): rename ResponseError to Error 2023-07-18 22:22:47 +01:00
Weihang Lo 00a872740a
fix(crates-io): don't let server sneak extra lines anywhere
From 5febbe5587/src/cargo/sources/registry/http_remote.rs (L234-L237)
2023-07-18 22:22:46 +01:00
Weihang Lo 6805944715
feat(crates-io): expose headers for ResponseError::Api
In response to RFC 3231 [^1], our registry client need to return headers
to caller, so that the caller (cargo binary) can continue parsing
challenge headers.

[^1]: https://rust-lang.github.io/rfcs/3231-cargo-asymmetric-tokens.html#the-authentication-process
2023-07-18 22:22:46 +01:00
bors 33c64109fe Auto merge of #12055 - QiangHeisenberg:crates-io-doc-test, r=weihanglo
fix:  doc-test failures

### What does this PR try to resolve?

When I read the source code, I found that the `Registry::new_handle` document test failed and seemed to be missing parameters;

There is no change in this [PR](https://github.com/rust-lang/cargo/pull/10592/files#diff-12973056cf99e8de997011a8738a6740a7dfd06142a73f122f3b35218db37351).
2023-05-04 14:30:42 +00:00
QiangHeisenberg 796f9acbcb fix test failed 2023-04-28 17:08:04 +08:00
cassaundra 5554889f88
Include rust-version in publish request
crates.io reads rust-version from the tarball directly, but we can include it in
the publish request for the sake of consistency for third-party registries.
2023-04-26 11:59:29 -07:00
bors c429784fd5 Auto merge of #11951 - ehuss:check-token-tab, r=hi-rustin
Fix credential token format validation.

The existing validation incorrectly excluded tab because of a missing backslash. This updates to add the backslash.

This also rewords the comments. I found the current comments to be a little confusing.

This also extends the test to verify more valid inputs.

cc #11600
2023-04-10 04:02:43 +00:00
Eric Huss 35f5862979 Validate token on publish. 2023-04-09 12:15:40 -07:00
Eric Huss 57264ed433 Fix credential token format validation. 2023-04-09 11:53:46 -07:00
akida31 823ab52f19
Address review comments
* moved `is_empty` check into `check_token`
* improved error message (is quite long now but should explain the error
  well)
* removed one helper function from new test
2023-02-16 19:12:46 +01:00
akida31 3d2e107b5a
Error on invalid token for registry auth
When using registry operations with authentication there will be now an
error if the given token is not valid.
This is a technically a breaking change because a registry might give
some tokens which will be denied by these new checks.
In practice these tokens cause issues with HTTP so no registry should
generate them.
2023-02-16 16:42:30 +01:00
Jacob Finkelman 6d1c07bcc5 Send asymmetric tokens with mutations 2022-12-12 20:11:26 +00:00
Arlo Siemsen 9827412fee Implement RFC 3139: alternative registry authentication support 2022-11-16 14:36:19 -06:00
Scott Schafer 251a2c7915 cargo-test-support: Make publish http api write to file system 2022-09-22 10:00:49 -06:00
Eric Huss 43a063c80a Stabilize namespaced and weak dependency features. 2022-01-06 15:56:56 -08:00
Eric Huss 10eb56f2c4 Update clippy lint allow set. 2021-04-13 09:02:07 -07:00
Eric Huss c9bd6e12e1 Minor update to registry API error messages. 2021-02-27 12:38:17 -08:00
Eric Huss 196673bb1e Add a schema version to the index. 2021-02-10 10:58:07 -08:00
Eric Huss 06b8d1cac1 Add a ResponseError for registry API interaction.
The intent here is to make it easier to work with API errors.

This also includes some new tests for checking network errors.
2021-02-02 17:44:57 -08:00
Eric Huss eaa5896405 Remove Registry::new. 2021-01-22 11:06:51 -08:00
Eric Huss eb081ed301 Workaround fs issue in cargo publish. 2020-12-05 14:10:29 -08:00
Igor Matuszewski aab416f6e6 Use u32/64::to/from_le_bytes instead of bit fiddling 2020-11-09 23:32:39 +01:00
Eric Huss 65274ea7d5 Add a warning when using registry.token with source replacement. 2020-04-19 09:25:32 -07:00
Eric Huss 944f5049f1 Re-implement proc-macro feature decoupling. 2020-03-22 15:08:02 -07:00
Eric Huss 5a1862cd36 Add proc-macro to the index. 2020-03-15 10:10:25 -07:00
Alex Tokarev 45ad3f9986 Remove unused imports 2020-02-20 23:58:10 +03:00
Alex Crichton d0430dd2b1 Run rustfmt 2020-01-07 20:01:34 -08:00
Alex Crichton 3a18c89a55 Migrate from the failure crate to anyhow
The `anyhow` crate interoperates with the `std::error::Error` trait
rather than a custom `Fail` trait, and this is the general trend of
error handling in Rust as well.

Note that this is mostly mechanical (sed) and intended to get the test
suite passing. As usual there's still more idiomatic cleanup that can
happen, but that's left to later commits.
2020-01-07 16:50:09 -08:00
Alex Crichton 0f751deffb Remove dependency on winapi 0.2
This commit removes Cargo's dependency on `winapi` 0.2 which takes an
excessively long time to build, slowing down Windows builds. The
`winapi` 0.2 crate was pulled in via a dependency chain that looked
like:

    cargo
    \- crates-io
       \- http
          \- bytes
             \- iovec
                \- winapi 0.2

The fix implemented here was to remove the `http` crate dependency from
`crates-io` which is only used for rendering status codes, but it's easy
enough to inline that function locally.
2019-09-19 11:53:24 -07:00
Alex Crichton 3c67dc8430 Update the url crate to 2.0
Looks like minor API changes, primarily around percent encoding.
2019-07-24 08:26:28 -07:00
Matthias Krüger 51a56a452d format crates-io and cargo-test-macro subcrates 2019-06-23 00:29:52 +02:00
Alex Crichton e449cb23e3 Move the crates-io crate to a crates directory
That way when we add more crates we've got a place to put them!
2019-06-18 10:47:44 -07:00
Renamed from src/crates-io/lib.rs (Browse further)