bowerhttp

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: 34 Imported by: 0

Documentation

Overview

Package bowerhttp serves the Bower registry and bower-art-resolver 2.0 protocol at /artifactory/api/bower/{repoKey}: the package list, search and lookup, which name a package by an art:// URL, the refs that list a package's versions as tags, the binaries that deliver a version's archive, and registration of a package's Git URL with a remote or virtual repository.

Role

artifacts module, ecosystem layer: the native Bower registry and bower-art-resolver protocol of the Bower slice. It is named bowerhttp 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 bower, local, federated, virtual or remote. 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 items and blobs, keeps Bower registrations and writes errors; the remote source service (Options.RemoteSources), which fetches registry pointers, Git refs and archives, or an upstream Artifactory's refs and binaries, into the remote cache; and the format package, whose rules check every name, version, path and manifest.

Outputs

  • Protocol and Options: the routes, the source of each repository class, the reserved reindex path and the Artifactory error profile.
  • Answers: package entries as JSON, refs as text lines, version archives, and 201 for a registration, or 403 for a name already registered.

Invariants

  • A local or federated version's archive is built from its stored tree only when the caller may read every file in it, within 4096 files and 128 MiB, and only when its bower.json is stored.
  • The download policy (#1251), after read permission: a binary is refused before its version is looked up, a hosted repository's by the version's bower.json and then by any file the archive holds, a virtual repository's own patterns with "No repository found to serve the request", and a remote's at the path its cache keeps the archive at. The package lookup and refs of a blacked-out repository answer the blackout, naming the request's path, while the package list and search keep their answers. A version whose files the patterns reject stays listed, and a remote's metadata reads check its blackout alone. A virtual repository resolves without a blacked-out member, passes over a member that refuses any file of the archive, and refuses an external dependency's archive its own patterns reject.
  • A Git remote follows a registry pointer only within the configured Git origin and path, and an archive enters the remote cache only after its paths, size, file count, manifest and gzip integrity pass; a stated manifest version must agree with the selected tag.
  • A registration is immutable, needs write permission on the package in the addressed repository and the selected remote, and treats a private Stash SSH address as a locator, never as a transport.
  • A virtual repository resolves its members in order, and, when it rewrites external dependencies, admits only sources its allowlist patterns match, through its selected remote's cache.
  • Statuses and error texts stay byte-identical.

References

Status

Implemented P9c, which delivered the plan's P30 group (issues #762 to #768). Moved here in P9d.

Testing

The tests are in the package, by concern: bower_test.go (local, federated and virtual resolution, remote refs and archives), security_test.go (disclosure, virtual catalogs and archive permissions), git_test.go and remote_security_test.go (Git and Artifactory remotes), register_test.go (registration), the dependency_* and dependencies_test.go files (the external dependency rewrite), and archive_fault_test.go, failure_paths_test.go and source_fault_test.go (corrupt archives and failing sources), served_copy_fault_test.go (a cached catalog, search or refs copy that fails a read answers 500 and stays cached), and download_policy_test.go (the blackout and the patterns of local, virtual, Artifactory and Git remote repositories on every route, and of the dependency rewrite).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Protocol

func Protocol(o Options) pkgroute.Protocol

Protocol returns the Bower registry protocol for the router kit, under /artifactory/api/bower/{repoKey}: GET and HEAD of the package list, search and lookup, refs and binaries, and POST /packages to register a package. Local and federated repositories are served from their own items, virtual ones from their members, and remote ones through o.RemoteSources when it is set; a class without a source answers 501. It reserves {repoKey}/reindex 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 *source.Service }

Options configures the Bower protocol. RemoteSources serves remote repositories and fetches through them; nil leaves the remote class without a source, so a remote repository answers 501.

Jump to

Keyboard shortcuts

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