pydhttp

package
v0.0.0-...-b99a58d Latest Latest
Warning

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

Go to latest
Published: May 10, 2017 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Overview

Package pydhttp contains all http related work

Copyright 2007-2016 Abstrium <contact (at) pydio.com>
* This file is part of Pydio.
*
* Pydio is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Pydio is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Pydio.  If not, see <http://www.gnu.org/licenses/>.
*
* The latest code can be found at <https://pydio.com/>.

Package pydhttp contains all http related work

Copyright 2007-2016 Abstrium <contact (at) pydio.com>
* This file is part of Pydio.
*
* Pydio is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Pydio is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Pydio.  If not, see <http://www.gnu.org/licenses/>.
*
* The latest code can be found at <https://pydio.com/>.

Package pydhttp contains all http related work

  • Copyright 2007-2016 Abstrium <contact (at) pydio.com>
  • This file is part of Pydio. *
  • Pydio is free software: you can redistribute it and/or modify
  • it under the terms of the GNU Affero General Public License as published by
  • the Free Software Foundation, either version 3 of the License, or
  • (at your option) any later version. *
  • Pydio is distributed in the hope that it will be useful,
  • but WITHOUT ANY WARRANTY; without even the implied warranty of
  • MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  • GNU Affero General Public License for more details. *
  • You should have received a copy of the GNU Affero General Public License
  • along with Pydio. If not, see <http://www.gnu.org/licenses/>. *
  • The latest code can be found at <https://pydio.com/>.

Package pydhttp contains all http related work

  • Copyright 2007-2016 Abstrium <contact (at) pydio.com>
  • This file is part of Pydio. *
  • Pydio is free software: you can redistribute it and/or modify
  • it under the terms of the GNU Affero General Public License as published by
  • the Free Software Foundation, either version 3 of the License, or
  • (at your option) any later version. *
  • Pydio is distributed in the hope that it will be useful,
  • but WITHOUT ANY WARRANTY; without even the implied warranty of
  • MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  • GNU Affero General Public License for more details. *
  • You should have received a copy of the GNU Affero General Public License
  • along with Pydio. If not, see <http://www.gnu.org/licenses/>. *
  • The latest code can be found at <https://pydio.com/>.

Package pydhttp contains all http related work

  • Copyright 2007-2016 Abstrium <contact (at) pydio.com>
  • This file is part of Pydio. *
  • Pydio is free software: you can redistribute it and/or modify
  • it under the terms of the GNU Affero General Public License as published by
  • the Free Software Foundation, either version 3 of the License, or
  • (at your option) any later version. *
  • Pydio is distributed in the hope that it will be useful,
  • but WITHOUT ANY WARRANTY; without even the implied warranty of
  • MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  • GNU Affero General Public License for more details. *
  • You should have received a copy of the GNU Affero General Public License
  • along with Pydio. If not, see <http://www.gnu.org/licenses/>. *
  • The latest code can be found at <https://pydio.com/>.

Package pydhttp contains all http related work

  • Copyright 2007-2016 Abstrium <contact (at) pydio.com>
  • This file is part of Pydio. *
  • Pydio is free software: you can redistribute it and/or modify
  • it under the terms of the GNU Affero General Public License as published by
  • the Free Software Foundation, either version 3 of the License, or
  • (at your option) any later version. *
  • Pydio is distributed in the hope that it will be useful,
  • but WITHOUT ANY WARRANTY; without even the implied warranty of
  • MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  • GNU Affero General Public License for more details. *
  • You should have received a copy of the GNU Affero General Public License
  • along with Pydio. If not, see <http://www.gnu.org/licenses/>. *
  • The latest code can be found at <https://pydio.com/>.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrRedirectViaPydioClient is the error used on CheckRedirect
	ErrRedirectViaPydioClient = errors.New("Redirection is handled by the Pydio HTTP Client")
)

Functions

func FromContext

func FromContext(ctx context.Context, key interface{}, value interface{}) (err error)

FromContext value of the given key

func NewContext

func NewContext(ctx context.Context, key interface{}, value interface{}) context.Context

NewContext with the key value

Types

type API

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

API data

func NewAPI

func NewAPI(url url.URL, auth ...interface{}) (api *API, err error)

NewAPI reference

func (*API) GetBaseURL

func (api *API) GetBaseURL() (*url.URL, error)

GetBaseURL returns the api base url

func (*API) GetQueryArgs

func (api *API) GetQueryArgs(uri string) *Auth

GetQueryArgs based on the uri given for the API auth

type Auth

type Auth struct {
	Token string
	Hash  string
	Key   string
}

Auth data format for a query

type Client

type Client http.Client

Client extension to the http client

func NewClient

func NewClient() *Client

NewClient with Redirection handling

func (*Client) Do

func (c *Client) Do(req *http.Request) (resp *http.Response, err error)

Do the Request through Client

type ContextValue

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

ContextValue Pipe and buffer

func NewContextValue

func NewContextValue() *ContextValue

NewContextValue object

func (*ContextValue) Close

func (c *ContextValue) Close() error

Close the pipe writer

func (*ContextValue) Read

func (c *ContextValue) Read(p []byte) (n int, err error)

Read a context value, first from the Pipe if it hasn't been read, then from the buffer

func (*ContextValue) Write

func (c *ContextValue) Write(p []byte) (n int, err error)

Write content to the pipe end

type Cookie http.Cookie

Cookie type

func (Cookie) Matches

func (c Cookie) Matches(other string) bool

Matches the cookie name to the string given

type CookieMatcher

type CookieMatcher string

CookieMatcher type

func (CookieMatcher) Match

func (cm CookieMatcher) Match(c *http.Cookie) bool

Match satisfies RequestMatcher.

type Decoder

type Decoder interface {
	Decode(interface{}) error
}

Decoder for the context value

type Encoder

type Encoder interface {
	Encode(interface{}) error
}

Encoder for the context value

type Status

type Status struct {
	Context    context.Context
	StatusCode int
	Err        error
}

Status structure

func NewStatusErr

func NewStatusErr(code int, err error) *Status

NewStatusErr response

func NewStatusOK

func NewStatusOK(r *http.Request, context ...context.Context) *Status

NewStatusOK response

type Token

type Token struct {
	T string
	P string
}

Token public and private parts

func NewToken

func NewToken(token string, password string) *Token

NewToken for the API

func NewTokenFromJWT

func NewTokenFromJWT(str string, signatureSecret string) (token *Token, err error)

NewTokenFromJWT creates a token based on a JWT token string

func NewTokenFromURLWithBasicAuth

func NewTokenFromURLWithBasicAuth(url *url.URL, username string, password string) (token *Token, err error)

NewTokenFromURLWithBasicAuth retrieves a token pair by sending a message with query arguments

func NewTokenFromURLWithCookie

func NewTokenFromURLWithCookie(url *url.URL, cookie *http.Cookie) (token *Token, err error)

NewTokenFromURLWithCookie retrieves a token pair by sending a message containing a cookie to a specific URL

func (*Token) GetQueryArgs

func (t *Token) GetQueryArgs(uri string) *Auth

GetQueryArgs for the token

func (*Token) JWT

func (t *Token) JWT(signatureSecret string, hoursBeforeExpiry int) (string, error)

JWT representation of the Token

func (*Token) Write

func (t *Token) Write(w io.Writer)

Jump to

Keyboard shortcuts

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