urlbuilder

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2026 License: MIT Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package urlbuilder wraps teapot-router's urlbuilder.Builder to add virtual-hosted-style URL generation.

Whichever style a generated URL uses mirrors the *inbound* request's style: if the client already reached us via vhost, it gets vhost URLs back, otherwise path-style — keeping presigned URLs, Location headers, and CopyObject sources consistent with however the client is already talking to us.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

Builder generates URLs for S3 API responses, choosing path-style or vhost-style per request.

func New

func New(canonicalDomain string) *Builder

New creates a new Builder. If canonicalDomain is empty, URLs are always built path-style from the request Host header (byte-for-byte the same as upstream's Builder, since vhost resolution is disabled).

func (*Builder) BucketURL

func (b *Builder) BucketURL(r *http.Request, bucket string) string

BucketURL generates a URL for bucket operations, mirroring whether the inbound request itself was vhost- or path-style.

func (*Builder) ObjectURL

func (b *Builder) ObjectURL(r *http.Request, bucket, key string) string

ObjectURL generates a URL for object operations, mirroring whether the inbound request itself was vhost- or path-style.

Jump to

Keyboard shortcuts

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