routing

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2020 License: Apache-2.0 Imports: 33 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Download

func Download(
	w http.ResponseWriter,
	req *http.Request,
	origin gomatrixserverlib.ServerName,
	mediaID types.MediaID,
	cfg *config.MediaAPI,
	db storage.Database,
	client *gomatrixserverlib.Client,
	activeRemoteRequests *types.ActiveRemoteRequests,
	activeThumbnailGeneration *types.ActiveThumbnailGeneration,
	isThumbnailRequest bool,
	customFilename string,
)

Download implements GET /download and GET /thumbnail Files from this server (i.e. origin == cfg.ServerName) are served directly Files from remote servers (i.e. origin != cfg.ServerName) are cached locally. If they are present in the cache, they are served directly. If they are not present in the cache, they are obtained from the remote server and simultaneously served back to the client and written into the cache.

func Setup

func Setup(
	publicAPIMux *mux.Router,
	cfg *config.MediaAPI,
	db storage.Database,
	userAPI userapi.UserInternalAPI,
	client *gomatrixserverlib.Client,
)

Setup registers the media API HTTP handlers

Due to Setup being used to call many other functions, a gocyclo nolint is applied: nolint: gocyclo

func Upload

func Upload(req *http.Request, cfg *config.MediaAPI, dev *userapi.Device, db storage.Database, activeThumbnailGeneration *types.ActiveThumbnailGeneration) util.JSONResponse

Upload implements POST /upload This endpoint involves uploading potentially significant amounts of data to the homeserver. This implementation supports a configurable maximum file size limit in bytes. If a user tries to upload more than this, they will receive an error that their upload is too large. Uploaded files are processed piece-wise to avoid DoS attacks which would starve the server of memory. TODO: We should time out requests if they have not received any data within a configured timeout period.

Types

This section is empty.

Jump to

Keyboard shortcuts

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