diff --git a/HISTORY.md b/HISTORY.md index b39e4415..eecf76e3 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -2,7 +2,11 @@ **How to upgrade**: remove your `$GOPATH/src/github.com/kataras` folder, open your command-line and execute this command: `go get -u github.com/kataras/iris/iris`. -## 4.4.1 -> 4.4.5 +## 4.4.6 -> 4.4.7 + +- **small fix**: websocket server is nil when more than the default websocket station tries to be registered before `OnConnection` called[*](https://github.com/kataras/iris/issues/460) + +## 4.4.1 -> 4.4.6 - **FIX**: CORS not worked for all http methods - **FIX**: Unexpected Party root's route slash when `DisablePathCorrection` is false(default), as reported [here](https://github.com/kataras/iris/issues/453) diff --git a/README.md b/README.md index 3352aad0..d26ea408 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@
-Releases +Releases Examples @@ -870,7 +870,7 @@ I recommend writing your API tests using this new library, [httpexpect](https:// Versioning ------------ -Current: **v4.4.6** +Current: **v4.4.7** > Iris is an active project @@ -906,7 +906,7 @@ This project is licensed under the [MIT License](LICENSE), Copyright (c) 2016 Ge [Travis]: http://travis-ci.org/kataras/iris [License Widget]: https://img.shields.io/badge/license-MIT%20%20License%20-E91E63.svg?style=flat-square [License]: https://github.com/kataras/iris/blob/master/LICENSE -[Release Widget]: https://img.shields.io/badge/release-4.4.6%20-blue.svg?style=flat-square +[Release Widget]: https://img.shields.io/badge/release-4.4.7%20-blue.svg?style=flat-square [Release]: https://github.com/kataras/iris/releases [Chat Widget]: https://img.shields.io/badge/community-chat%20-00BCD4.svg?style=flat-square [Chat]: https://kataras.rocket.chat/channel/iris diff --git a/iris.go b/iris.go index f2fa30dc..5cb56f38 100644 --- a/iris.go +++ b/iris.go @@ -79,7 +79,7 @@ import ( const ( // Version is the current version of the Iris web framework - Version = "4.4.6" + Version = "4.4.7" banner = ` _____ _ |_ _| (_) @@ -1348,11 +1348,13 @@ func (api *muxAPI) Handle(method string, registedPath string, handlers ...Handle subdomain = fullpath[0 : dotWSlashIdx+1] // admin. path = fullpath[dotWSlashIdx+1:] // / } - // not needed after the redirect status change for POST methods + // we splitted the path and subdomain parts so we're ready to check only the path, // otherwise we will had problems with subdomains - // if the user wants beta:= iris.Party("/beta"); beta.Get("/") to be registered as : /beta/ then should disable the path correction OR register it like: beta.Get("//") - // this is only for the party's roots in order to have expected paths, as we do with iris.Get("/") which is localhost:8080 as RFC points, not localhost:8080/ + // if the user wants beta:= iris.Party("/beta"); beta.Get("/") to be registered as + //: /beta/ then should disable the path correction OR register it like: beta.Get("//") + // this is only for the party's roots in order to have expected paths, + // as we do with iris.Get("/") which is localhost:8080 as RFC points, not localhost:8080/ if api.mux.correctPath && registedPath == slash { // check the given relative path // remove last "/" if any, "/xyz/" if len(path) > 1 { // if it's the root, then keep it* diff --git a/websocket.go b/websocket.go index ffcc3266..3f8204e3 100644 --- a/websocket.go +++ b/websocket.go @@ -58,8 +58,11 @@ func (s *WebsocketServer) Handler(ctx *Context) { // receives the websocket configuration and the iris station func (s *WebsocketServer) RegisterTo(station *Framework, c WebsocketConfiguration) { - // Note: s.Server should be initialize on the first OnConnection, which is called before this func always. - + // Note: s.Server should be initialize on the first OnConnection, which is called before this func when Default websocket server. + // When not: when calling this function before OnConnection, when we have more than one websocket server running + if s.Server == nil { + s.Server = websocket.New() + } // is just a conversional type for kataras/go-websocket.Connection s.upgrader = irisWebsocket.Custom(s.Server.HandleConnection, c.ReadBufferSize, c.WriteBufferSize, false) @@ -95,6 +98,7 @@ type WebsocketConnection interface { // OnConnection this is the main event you, as developer, will work with each of the websocket connections func (s *WebsocketServer) OnConnection(connectionListener func(WebsocketConnection)) { if s.Server == nil { + // for default webserver this is the time when the websocket server will be init // let's initialize here the ws server, the user/dev is free to change its config before this step. s.Server = websocket.New() // we need that in order to use the Iris' WebsocketConnnection, which // config is empty here because are setted on the RegisterTo