Releases: pfrazee/local
v0.6.2
This release adds the function main(req, res)
interface for workers, autodestroys workers which were autospawned to handle a request ("temp" workers) and includes redesigned documentation, now hosted at httplocal.com.
Other changes:
importScripts
now uses the main worker's origin to resolve relative URIs.importScripts
is disabled after the first execution of the Worker in order to prevent information-leaking.
v0.6.1
In this release, the project has been restructured to build with Browserify. This release also adds support for the host "source path" in httpl URIs, enabling workers to be automatically fetched and spawned on first request.
- Browserified!
- Added httpl://worker-bridge as global default server to workers
- Added setHostLookup() to handle worker and webrtc bridge auto-spawning
- Added automatic worker spawning
- Added the host 'source path' to URL parsing
Automated Worker spawning with host source paths
The "source path" is a new part of HTTPL hostnames. It looks like this:
httpl://subdomain.domain.com(source/path.js)/resource/path
For instance, httpl://gmail.com(inbox.js)/
. When parsed, the bracketed area is included in the hostname, meaning it factors into security decisions. Inside the brackets, there should be a typical URI path without the preceding slash.
If a request is sent to a URI with a source path, and the host doesn't exist in the local hostmap, Local will use the source path to fetch the worker. The source URI is created by appending the source path to the rest of the hostname. For instance, httpl://gmail.com(inbox.js)/
would resolve to https://gmail.com/inbox.js
. Local will try https first, then fallback to http.
If the Worker is successfully loaded, Local will send the request on to the server so that it can be handled.
To disable this feature, environments can use the following snippet:
local.setHostLookup(function(req, res) {
// Don't attempt a lookup -- respond 404
return false;
});
v0.6
This release adds new API features, refines the HTTPL message format, and (as always) fixes a few bugs.
New Request Sugars
A request formerly written as:
local.dispatch({
method: 'POST',
url: 'http://github.com',
body: { project_title: 'Super Cool Widget' },
headers: {
accept: '*/*',
'content-type': 'application/json'
}
})
Can now be simplified into:
local.dispatch({
method: 'POST',
url: 'http://github.com',
body: { project_title: 'Super Cool Widget' },
Accept: '*/*',
Content_Type: 'application/json'
})
Or even further to:
local.POST(
{ project_title: 'Super Cool Widget' }, // body
{ url: 'http://github.com', Accept: '*/*', Content_Type: 'application/json' }
})
And since
- Content-Type is inferred to be JSON for objects
- Accept defaults to
*/*
The request options can be reduced to just the URL string:
local.POST({ project_title: 'Super Cool Widget' }, 'http://github.com')
HTTPL updates
- Removed {query:} from HTTPL messages; params are now serialized in the path as in HTTP/1.1
- Moved the request.host attribute into request.headers in order to conform with HTTP/1.1.
API updates
- Added request sugars (
local.GET
,local.POST
, etc) - Added support for upper-cased headers in request and response options (eg
local.GET({ url:, Accept: })
) - Added request.header() and response.header() to simplify header access (was having issues of case-sensitivity)
- Added Proxy-Tmpl (and noproxy link attr) support to agents for automated proxy URI construction
- Limited nav:|| URIs to 5 navigations to mitigate flooding attacks
- Added function attributes to queryLink() queries
- Added data scheme to isAbsUri
- Added Via header parsing
- Added local.makeProxyUri
- Added response.processHeaders to do header massaging in the client (things like making relative Link header HREFs absolute)
- Added httpl://self to workers
v0.5.1 beta
This release adds a few new features to the API and includes a number of bugfixes.
- Added local.util.nextTick to optimize async
- Added timeout to requests
- Added "close" message to HTTPL as a distinct event separate from "end". This enables the requester to close the stream after ending the request.
- Added data-local-alias="a" to the request dom-events
- Altered webrtc peer URI semantics to always refer to the 4th item as the 'sid' (instead of the ambiguous 'stream' or 'streamId')
- Simplified gwr.io reltypes
v0.5 beta
This release includes the addition of guests, patchXHR, some API refinements, and bugfixes.
- Added local.util.nextTick to optimize async
- Changed relay.getDomain() to .getAssignedDomain() for clarity
- Added relay.getAssignedUrl()
- Updated gwr.io protocols to no longer combine semantics (gwr.io/user item -> gwr.io/user/item)
- Altered peer URI scheme to support ports in relay and application hosts
- Added "host" attribute to requests given to local servers
- Added non-standard "method" attr to requests extracted from anchor elements
- Added opt.guestof to Relay requestAccessToken
- Added Relay event "outOfStreams" to handle 420 response (no more allocatable streams)
- Added local.patchXHR