conanhttp

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 16, 2026 License: MIT Imports: 29 Imported by: 0

Documentation

Overview

Package conanhttp serves the Conan revision protocol at /artifactory/api/conan/{repoKey}, for Conan 2 and for Conan 1 with revisions enabled: ping, the credential exchange and check, recipe search, recipe and package revision lists and latest revisions, file lists, file download and upload, package search, and revision deletion. A revision becomes visible once its conanmanifest.txt is uploaded, which is accepted only when its MD5 entries match the uploaded files or the unpacked archive. Revision paths and the write policy are the format package's (artifacts/ecosystem/conan); this package answers HTTP with them.

Role

artifacts module, ecosystem layer: the native Conan revision protocol of the Conan slice. It is named conanhttp so that it does not shadow net/http. Outside tests, only its own http subtree, the module's http adapters and app may import it (decision 0044, dependency rule 9).

Inputs

  • Driving: the server, which mounts Protocol through the router kit (pkgroute) for repositories of package type conan, local, federated, virtual or remote. A repository with forceConanAuthentication challenges an anonymous caller first, and the repository's reindex ({repoKey}/reindex) is a JFrog operation beside the protocol, which the protocol reserves.
  • Driven: the router kit (pkgroute.Kit), whose store (pkgroute.Store) the handlers also reach through DB(), and which resolves the repository and the caller, checks permissions, reads, stores and deletes items and writes errors; the token contract in Options (access/api), which issues the token a password login is exchanged for; the remote source service (Options.RemoteSources), which fetches upstream metadata and files into the remote cache; and the format package.

Outputs

  • Protocol and Options: the routes, the source of each repository class, the reserved reindex path, the authentication challenge and the Artifactory error profile.
  • Answers: the JSON documents Conan reads (revision lists, latest revisions, file lists, search results and package search maps), the files, the token or user name as plain text, 201 for an upload and 204 for a deletion.

Invariants

  • A revision's files stay hidden until its manifest is stored, and a package revision's until its recipe revision's manifest is stored too. A manifest must list conanfile.py (a recipe) or conaninfo.txt (a package), each entry must match an uploaded file or the unpacked archive, and the archive may hold nothing the manifest does not list.
  • A revision file outside metadata/ is written once: different content at the same path is refused with 409.
  • A remote's metadata must be a complete, bounded JSON object before it is cached, and every file it serves is pinned to the digest its manifest gives; names and bytes reach a caller only through the caller's permissions.
  • A virtual repository reads its members in order, and uploads only to its default deployment repository, which must be one of its members, local or federated, and writable by the caller.
  • The download policy (#1251), after read permission: a blacked-out repository refuses the revision lists, latest revisions and file lists before they are built, with the blackout's 404 naming the request's path; the patterns do not refuse them, and they list a revision or file the patterns reject. Every file, the manifest and conaninfo.txt included, is checked at its own path, whether its revision exists or not; a remote's lookups of a manifest for a download or a list check its blackout alone. Searches keep their answers, but a virtual repository's search passes over a blacked-out remote member. A virtual repository leaves a blacked-out member out of its revisions, passes over a member that refuses a file, and its own patterns refuse a file with "No repository found to serve the request".
  • A password login gets a revocable token that lasts at most an hour; a token login gets its own token back. The login's Basic user name must name the authenticated user in any case (accessapi.SameUsername, #1432), since the Conan client sends it as typed. The login reads Basic as the authentication does (accessapi.BasicCredentials, #1451), so a value 7.x reads no credential from is never exchanged.
  • Statuses and error texts stay byte-identical.

References

Status

Implemented P9c, which delivered the plan's P31 group (issues #770 to #775). Moved here in P9d.

Testing

  • validation_test.go: the credential exchange's boundaries (a Basic user name in another case among them), manifest parsing, permission errors, remote metadata checks and archive safety.

The routes are also tested end to end from test/server/artifacts/conan: conan_test.go; conan_client_test.go and conan_client_remote_test.go with the pinned Conan 2 and Conan 1 clients, which make conan-accept runs; conan_remote_test.go; and username_case_test.go, the login under any spelling of the user name.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Protocol

func Protocol(o Options) pkgroute.Protocol

Protocol returns the Conan protocol for the router kit. One dispatcher serves every method of every path under /artifactory/api/conan/{repoKey}: local and federated repositories from their own items, virtual ones from their members, and remote ones through o.RemoteSources when it is set. A repository with forceConanAuthentication answers an anonymous caller 401 before it is routed. {repoKey}/reindex is reserved for the JFrog reindex operation beside the protocol. The virtual class's source supports no single-item lookup, because the protocol reads a virtual repository's members itself.

Types

type Options

type Options struct {
	// RemoteSources serves remote repositories. Nil leaves the remote class
	// without a source, so a remote repository answers 501.
	RemoteSources *source.Service
	// Tokens issues the token Conan's authenticate exchanges a password
	// for. Nil answers that exchange 501; a caller that sent a token gets
	// it back either way.
	Tokens accessapi.Tokens
}

Options configures the Conan protocol.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL