Skip to content
Snippets Groups Projects
Commit 70085b39 authored by David Maus's avatar David Maus
Browse files

Remove old README

parent e492d953
No related merge requests found
* Proxy service API
The terms MUST NOT, SHOULD NOT, SHOULD, MUST, and MAY are used as defined by [RFC2119].
The proxy service provides access to HTTP-based internal and external resources. The services can be
configured to proxy requests to external resources identified by the host part of the http URI.
The following hosts are considered as as internal resources:
- localhost (IPv4 local host)
- 127/8 (IPv4 loopback network addresses)
- [::1] (IPv6 loopback address)
Other VF2 components SHOULD use the proxy service in order to integrate in environments that require
proxy access.
* Public API
The proxy service implements the following public methods:
** get(string URL[, array PARAMS[, float TIMEOUT]])
Performs a GET request to URL using optional PARAMS and TIMEOUT, and returns the response.
PARAMS is an array of request parameters. It can either be an associative array of parameter names
and associated values or a numeric array with properly URL-encoded name-value pairs in the form
`NAME=VALUE'
In the first case the query string is created with PHP's built-in http_build_query() function
([BUILDQUERY]), in the latter case the name-value pairs are simply concatenated to form the query
string.
TIMEOUT is a float with the request timeout in seconds.
** postForm(string URL[, array PARAMS[, float TIMEOUT]])
Performs a POST request of regular form data to URL using optional PARAMS and optional
HEADERS. PARAMS is converted to a query string using the same rules as in get() and send inside a
POST request body with a content type of `application/x-www-form-urlencoded'.
TIMEOUT is a float with the request timeout in seconds.
** post(string URL[, mixed BODY[, string TYPE[, float TIMEOUT]]])
Performs a POST request of optional BODY of TYPE to URL and returns the repose.
BODY is casted to string.
A component using the service SHOULD provide an appropriate Content-Type header for the POST request
body in accordance with [MIMETYPES]. The default MIME type is `application/octet-stream'. The proxy
service calculates the Content-Length request header value by performing `strlen()' on the request
body.
TIMEOUT is a float with the request timeout in seconds.
** proxify(Zend\Http\Client CLIENT[, array OPTIONS])
Add proxy settings to CLIENT with optional OPTIONS.
CLIENT is an existing Zend HTTP client. The proxify() method replaces the HTTP connection adapter by
a Zend Framework HTTP proxy adapter. OPTIONS is an array of Zend HTTP proxy options that should be
used in addition to the service's proxy configuration. The proxy service proxy configuration is
superior to the ones supplied via OPTIONS.
** createClient(string URL[, string METHOD, [float TIMEOUT]])
Return new Zend HTTP client to access URI by optional METHOD with optional TIMEOUT. CLIENT is
proxified using the service's proxify() function.
* Error handling
The proxy service uses a marker interface [MARKER INTERFACE] to mark its exception. The proxy
service catches all exceptions from the Zend HTTP client and wraps them in either a proxy service
specific RuntimeException or InvalidArgumentException. The proxy service does not catch or emit any
other exceptions.
* Configuration
The proxy service is configured by an PHP array in `conf/proxy.conf.php'. This array MUST contain
the key `proxy' which points to an associative array with proxy configuration and MAY contain a key
`adapter' with the name or an instance of a Zend HTTP client adapter class.
The `proxy' configuration array has the same semantics as the Zend HTTP proxy adapter
configuration[ZEND ADAPTER]. No proxying is done if the proxy configuration array is empty.
The class denoted in the `adapter' key is used as the HTTP connection adapter for get(), post(), and
postForm().
* Extension points
The proxy service does not provide any extensions points.
* Service identifier
The proxy service registers under the name `VuFind\Http' in the web application's top level
service manager.
* Implementation
A first implementation of this specification can be found at [VF2 PROXY].
* References
[BUILDQUERY] : http://php.net/manual/de/function.http-build-query.php
[MARKER INTERFACE] : Marker interface pattern, http://en.wikipedia.org/wiki/Marker_interface_pattern
[MIMETYPES] : MIME Media Types, http://www.iana.org/assignments/media-types/index.html
[RFC2119] : Key words for use in RFCs to Indicate Requirement Levels, http://www.ietf.org/rfc/rfc2119.txt
[VF2 PROXY] : https://github.com/dmj/vf2-proxy
[ZEND ADAPTER] : Zend_Http_Client - Connection Adapters, http://packages.zendframework.com/docs/latest/manual/en/modules/zend.http.client.adapters.html
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment