Update to 4.4.7

This commit is contained in:
Gerasimos Maropoulos 2016-10-05 13:21:40 +03:00
parent 2090eb4d83
commit bffd2074eb
4 changed files with 20 additions and 10 deletions

View File

@ -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`. **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**: 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) - **FIX**: Unexpected Party root's route slash when `DisablePathCorrection` is false(default), as reported [here](https://github.com/kataras/iris/issues/453)

View File

@ -19,7 +19,7 @@
<br/> <br/>
<a href="https://github.com/kataras/iris/releases"><img src="https://img.shields.io/badge/%20version%20-%204.4.6%20-blue.svg?style=flat-square" alt="Releases"></a> <a href="https://github.com/kataras/iris/releases"><img src="https://img.shields.io/badge/%20version%20-%204.4.7%20-blue.svg?style=flat-square" alt="Releases"></a>
<a href="https://github.com/iris-contrib/examples"><img src="https://img.shields.io/badge/%20examples-repository-3362c2.svg?style=flat-square" alt="Examples"></a> <a href="https://github.com/iris-contrib/examples"><img src="https://img.shields.io/badge/%20examples-repository-3362c2.svg?style=flat-square" alt="Examples"></a>
@ -870,7 +870,7 @@ I recommend writing your API tests using this new library, [httpexpect](https://
Versioning Versioning
------------ ------------
Current: **v4.4.6** Current: **v4.4.7**
> Iris is an active project > 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 [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 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 [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 [Release]: https://github.com/kataras/iris/releases
[Chat Widget]: https://img.shields.io/badge/community-chat%20-00BCD4.svg?style=flat-square [Chat Widget]: https://img.shields.io/badge/community-chat%20-00BCD4.svg?style=flat-square
[Chat]: https://kataras.rocket.chat/channel/iris [Chat]: https://kataras.rocket.chat/channel/iris

10
iris.go
View File

@ -79,7 +79,7 @@ import (
const ( const (
// Version is the current version of the Iris web framework // Version is the current version of the Iris web framework
Version = "4.4.6" Version = "4.4.7"
banner = ` _____ _ banner = ` _____ _
|_ _| (_) |_ _| (_)
@ -1348,11 +1348,13 @@ func (api *muxAPI) Handle(method string, registedPath string, handlers ...Handle
subdomain = fullpath[0 : dotWSlashIdx+1] // admin. subdomain = fullpath[0 : dotWSlashIdx+1] // admin.
path = fullpath[dotWSlashIdx+1:] // / 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, // we splitted the path and subdomain parts so we're ready to check only the path,
// otherwise we will had problems with subdomains // 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("//") // if the user wants beta:= iris.Party("/beta"); beta.Get("/") to be registered as
// 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/ //: /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 if api.mux.correctPath && registedPath == slash { // check the given relative path
// remove last "/" if any, "/xyz/" // remove last "/" if any, "/xyz/"
if len(path) > 1 { // if it's the root, then keep it* if len(path) > 1 { // if it's the root, then keep it*

View File

@ -58,8 +58,11 @@ func (s *WebsocketServer) Handler(ctx *Context) {
// receives the websocket configuration and the iris station // receives the websocket configuration and the iris station
func (s *WebsocketServer) RegisterTo(station *Framework, c WebsocketConfiguration) { 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 // is just a conversional type for kataras/go-websocket.Connection
s.upgrader = irisWebsocket.Custom(s.Server.HandleConnection, c.ReadBufferSize, c.WriteBufferSize, false) 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 // OnConnection this is the main event you, as developer, will work with each of the websocket connections
func (s *WebsocketServer) OnConnection(connectionListener func(WebsocketConnection)) { func (s *WebsocketServer) OnConnection(connectionListener func(WebsocketConnection)) {
if s.Server == nil { 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. // 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 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 // config is empty here because are setted on the RegisterTo