httpreserve: github.com/httpreserve/httpreserve Index | Files

package httpreserve

import "github.com/httpreserve/httpreserve"

Index

Package Files

404.go defaultserver.go defaultserverpages.go errors.go httphandler.go httpreserve.go httpreservehandler.go httpreservestructs.go linkstathandler.go optionshandler.go version.go

Variables

var GenerateSnapshotErr = "error generating snapshot"

GenerateSnapshotErr tells us we've something else wrong

var ResponseIncorrect = "snapshots not created for response codes zero or greater than 400"

ResponseIncorrect tells us we haven't created a screenshot because the domain is no longer in existence...

var SnapshotNotEnabled = "snapshots are not currently enabled"

SnapshotNotEnabled helps end users verify server status

func Dedication Uses

func Dedication() string

Dedication will return a dedication string for a colleague's dear brother who was lost on the day I first figured out this code.

func DefaultServer Uses

func DefaultServer(port string, method string) error

DefaultServer is our call to standup a default server for the httpreserve resolver service to be queried by our other apps.

func GetDefaultServerPage Uses

func GetDefaultServerPage(method string) string

GetDefaultServerPage will print an example server page with the template filled in using the given method. Useful for folk who want to learn about this app. A bit of Ajax and a pretty decent way of encoding Base64 data hyperlinks.

func GetLinkStatsHeader Uses

func GetLinkStatsHeader(ls LinkStats) string

GetLinkStatsHeader allows us to do some debug on the information returned from the server. First it mocks a response, and then adds some of our own information to it to enable DumpResponse prettyprint. We will consider its use in future As two pretty printed responses have been added to the struct.

func GetLinkStatsURL Uses

func GetLinkStatsURL(ls LinkStats) *url.URL

GetLinkStatsURL returns the originally parsed URL as was sent to the server for a response.

func GetPrettyRequest Uses

func GetPrettyRequest(ls LinkStats) string

GetPrettyRequest returns the original request but pretty printed..

func GetPrettyResponse Uses

func GetPrettyResponse(ls LinkStats) string

GetPrettyResponse returns the original response but pretty printed.

func MakeLinkStatsJSON Uses

func MakeLinkStatsJSON(ls LinkStats) string

MakeLinkStatsJSON will output a LinkStats struct as a JSON object to be used in our applications...

func Version Uses

func Version() string

Version will return a simple version number for the app.

func VersionNumber Uses

func VersionNumber() string

VersionNumber is a synonym for Version()

func VersionText Uses

func VersionText() string

VersionText will return the full text version information e.g. for the useragent to query our websites.

type LinkStats Uses

type LinkStats struct {
    FileName                    string // If a filename is provided
    AnalysisVersionNumber       string
    AnalysisVersionText         string
    SimpleRequestVersion        string
    Link                        string
    Title                       string
    ContentType                 string
    ResponseCode                int
    ResponseText                string
    ScreenShot                  string // HREF to screenshot
    InternetArchiveLinkLatest   string
    InternetArchiveLinkEarliest string // Earliest link in Internet Archive
    InternetArchiveSaveLink     string // Link to use to save from the Internet
    InternetArchiveResponseCode int
    InternetArchiveResponseText string
    Archived                    bool // Has the Internet Archive saved the page or not?
    Error                       bool
    ErrorMessage                string
    StatsCreationTime           string
    // contains filtered or unexported fields
}

LinkStats Table structure to be returned from our requests Can be fairly liberal in its expansion

func GenerateLinkStats Uses

func GenerateLinkStats(link string, fname string, screengrab bool) (LinkStats, error)

GenerateLinkStats is used to return a JSON object for a URL specified in link variable passed to the function.

func HTTPFromSimpleRequest Uses

func HTTPFromSimpleRequest(sr simplerequest.SimpleRequest) (LinkStats, error)

HTTPFromSimpleRequest is another mechanism we can use to retrieve some basic information out from a web resource. Call handlehttp from a SimpleRequest object instead of calling function directly...

Package httpreserve imports 14 packages (graph). Updated 2017-05-22. Refresh now. Tools for package owners.