This replaces the enormous free-form docstring at the top with something
that's at least syntax highlighted and collapsible. I'm a little worried
about discoverability, but "oh well."
In order to expose a convenient API, it's unfortunately necessary to
lean on Go's interface{} quite a bit: in reality we only accept a
handful of types at each call site, but it's impossible to express this
using the type system.
Prior to this commit (as well as the ParsePattern commit), I exposed all
of this type information in the form of an enormous comment on web.Mux,
however this was pretty gross. Instead, let's use "vanity" type aliases
for interface{} to provide documentation about which types are accepted
where. This will hopefully make the API documentation easier to skim,
but doesn't affect any existing uses of Goji.
This commit also clarifies a couple other parts of the documentation.
This is a major breaking change to web.C, the Goji context object. The
Env key has been changed from a map[string]interface{} to a
map[interface{}]interface{} in order to better support package-private
environment values and to make the context value more compatible with
golang.org/x/net/context's Context.
Since strings support equality, most existing uses of web.C should
continue to function. Users who construct Env by hand (i.e., by calling
"make") will need to update their code as instructed by their compiler.
Users who iterate over the environment will need to update their code to
take into account the fact that keys may no longer be strings.
This allows users to escalate a graceful shutdown to a forceful one if
there are active connections that are taking too long to finish their
requests.
Fixes#94.
This backends to the listener.DrainAll functionality I just added,
allowing impatient users to shut down their services immediately and
un-gracefully if they want.
This is now controlled at the top level goji package: these packages are
not even compiled in when using App Engine. This is sensible, since
neither package is of any use there.
This change makes package graceful/listener track all connections that
have been Accepted, not just the ones considered idle. The motivation
here is to support a DrainAll function on graceful listeners, allowing
users an alternative to patiently waiting (potentially forever) for
in-use connections to become idle.
It was exposed mostly for documentation of a Go 1.2 polyfill, and really
doesn't feel like it should be exposed long-term, since it hasn't done
anything in frightfully long.
This is a breaking change for advanced users of package graceful, for
which there is unfortunately no easy workaround (at least for Go 1.2
users, which are the ~only ones affected).
Go's regular expressions don't allow you to create a capturing group
named "*", which previously made using SubRouter with regular expression
patterns impossible. This change introduces the alternate key "_", which
happens to be a legal capturing group name.
Fixes#98.
This change addresses the POODLE vulnerability [0]. Unfortunately it
makes package graceful's behavior here slightly different than the stock
net/http methods of the same name, but I think that's fine in this
situation.
[0]: https://www.openssl.org/~bodo/ssl-poodle.pdf
Thanks to @ekanna for reporting this. Fixes#101.
This change refactors package graceful into two packages: one very well
tested package that deals with graceful shutdown of arbitrary
net.Listeners in the abstract, and one less-well-tested package that
works with the nitty-gritty details of net/http and signal handling.
This is a breaking API change for advanced users of package graceful:
the WrapConn function no longer exists. This shouldn't affect most users
or use cases.
In particular, these started failing when running tests under the race
detector in Go 1.4 [0], probably due to some kind of (GC?) hijinks
clearing out the sync.Pool.
[0]: these tests might have also failed in 1.3, but I didn't check
"util" is a really bad name for a package since it isn't very
descriptive and so often collides with other names.
Unfortunately, this is a breaking change, but it's both very easy to fix
and perhaps more importantly also better to do now than later.
This is pretty frustrating: it doesn't look like it's going to be easy
to get the "cover" tool to work across both 1.3 and 1.4, since they
aren't able to agree on where to install the tool from. I'm sure there's
a way to work around this, but in the meantime let's just disable
coverage testing entirely.
Previously, a route like "/:a.png" would match "/foo/bar/baz.png".
This was incorrect, as all matches should be restricted to path segments
(or smaller, as dictated by a break character).
This bug was introduced in 1a390aba1c.
Fixes#75.
This middleware makes it much easier to write sub-routes, allowing you
to make the sub-router ignorant of its parent router's matched prefix.
The example app has also been modified to use this functionality for its
admin pages.
Fixes#65.
This is a breaking API change that changes how wildcard patterns are
treated. In particular, wildcards are no longer allowed to appear at
arbitrary places in the URL, and are only allowed to appear immediately
after a path separator. This change effectively changes the wildcard
sigil from "*" to "/*".
Users who use wildcard routes like "/hello*" will have to switch to
regular expression based routes to preserve the old semantics.
The motivation for this change is that it allows the router to publish a
special "tail" key which represents the unmatched portion of the URL.
This is placed into URLParams under the key "*", and includes a leading
"/" to make it easier to write sub-routers.