mirror of
https://github.com/kataras/iris.git
synced 2025-01-23 18:51:03 +01:00
Update to version 11.0.4. Read https://github.com/kataras/iris/blob/master/HISTORY.md#fr-09-november-2018--v1104
Former-commit-id: 2c2c32afe31fe94543d145ab8c8475d7b4392ff1
This commit is contained in:
parent
75ead88483
commit
e08d0b4be6
58
HISTORY.md
58
HISTORY.md
|
@ -17,6 +17,64 @@ Developers are not forced to upgrade if they don't really need it. Upgrade whene
|
||||||
|
|
||||||
**How to upgrade**: Open your command-line and execute this command: `go get -u github.com/kataras/iris` or let the automatic updater do that for you.
|
**How to upgrade**: Open your command-line and execute this command: `go get -u github.com/kataras/iris` or let the automatic updater do that for you.
|
||||||
|
|
||||||
|
# Fr, 09 November 2018 | v11.0.4
|
||||||
|
|
||||||
|
Add `Configuration.DisablePathCorrectionRedirection` - `iris.WithoutPathCorrectionRedirection` to support
|
||||||
|
direct handler execution of the matching route without the last `'/'` instead of sending a redirect response when `DisablePathCorrection` is set to false(default behavior).
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
|
||||||
|
For example, CORS needs the allow origin headers in redirect response as well,
|
||||||
|
however is not possible from the router to know what headers a route's handler will send to the client.
|
||||||
|
So the best option we have is to just execute the handler itself instead of sending a redirect response.
|
||||||
|
Add the `app.Run(..., iris.WithoutPathCorrectionRedirection)` on the server side if you wish
|
||||||
|
to directly fire the handler instead of redirection (which is the default behavior)
|
||||||
|
on request paths like `"$yourdomain/v1/mailer/"` when `"/v1/mailer"` route handler is registered.
|
||||||
|
|
||||||
|
Example Code:
|
||||||
|
|
||||||
|
```go
|
||||||
|
package main
|
||||||
|
|
||||||
|
import "github.com/kataras/iris"
|
||||||
|
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
app := iris.New()
|
||||||
|
|
||||||
|
crs := func(ctx iris.Context) {
|
||||||
|
ctx.Header("Access-Control-Allow-Origin", "*")
|
||||||
|
ctx.Header("Access-Control-Allow-Credentials", "true")
|
||||||
|
ctx.Header("Access-Control-Allow-Headers",
|
||||||
|
"Access-Control-Allow-Origin,Content-Type")
|
||||||
|
ctx.Next()
|
||||||
|
}
|
||||||
|
|
||||||
|
v1 := app.Party("/api/v1", crs).AllowMethods(iris.MethodOptions)
|
||||||
|
{
|
||||||
|
v1.Post("/mailer", func(ctx iris.Context) {
|
||||||
|
var any iris.Map
|
||||||
|
err := ctx.ReadJSON(&any)
|
||||||
|
if err != nil {
|
||||||
|
ctx.WriteString(err.Error())
|
||||||
|
ctx.StatusCode(iris.StatusBadRequest)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ctx.Application().Logger().Infof("received %#+v", any)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// HERE:
|
||||||
|
app.Run(iris.Addr(":80"), iris.WithoutPathCorrectionRedirection)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
# Tu, 06 November 2018 | v11.0.3
|
||||||
|
|
||||||
|
- add "part" html view engine's tmpl function: [15bb55d](https://github.com/kataras/iris/commit/15bb55d85eac378bbe0c98c10ffea938cc05fe4d)
|
||||||
|
|
||||||
|
- update pug engine's vendor: [c20bc3b](https://github.com/kataras/iris/commit/c20bc3bceef158ef99931e609123fa0aca2a918c)
|
||||||
|
|
||||||
# Tu, 30 October 2018 | v11.0.2
|
# Tu, 30 October 2018 | v11.0.2
|
||||||
|
|
||||||
Fix [memstore](core/memstore/memstore.go) overflows when build 32 bit app, reported and fixed by [@bouroo](https://github.com/bouroo) at: https://github.com/kataras/iris/issues/1118
|
Fix [memstore](core/memstore/memstore.go) overflows when build 32 bit app, reported and fixed by [@bouroo](https://github.com/bouroo) at: https://github.com/kataras/iris/issues/1118
|
||||||
|
|
|
@ -17,6 +17,10 @@
|
||||||
|
|
||||||
**Πώς να αναβαθμίσετε**: Ανοίξτε την γραμμή εντολών σας και εκτελέστε αυτήν την εντολή: `go get -u github.com/kataras/iris` ή αφήστε το αυτόματο updater να το κάνει αυτό για σας.
|
**Πώς να αναβαθμίσετε**: Ανοίξτε την γραμμή εντολών σας και εκτελέστε αυτήν την εντολή: `go get -u github.com/kataras/iris` ή αφήστε το αυτόματο updater να το κάνει αυτό για σας.
|
||||||
|
|
||||||
|
# Fr, 09 November 2018 | v11.0.4
|
||||||
|
|
||||||
|
Πατήστε [εδώ](https://github.com/kataras/iris/blob/master/HISTORY.md#fr-09-november-2018--v1104) για να διαβάσετε στα αγγλικά τις αλλαγές που φέρνει το τελευταίο patch για την έκδοση 11.
|
||||||
|
|
||||||
# Tu, 30 October 2018 | v11.0.2
|
# Tu, 30 October 2018 | v11.0.2
|
||||||
|
|
||||||
Πατήστε [εδώ](https://github.com/kataras/iris/blob/master/HISTORY.md#tu-30-october-2018--v1102) για να διαβάσετε στα αγγλικά μια σημαντική διόρθωση για τα x32 machines που φέρνει το τελευταίο patch για την έκδοση 11.
|
Πατήστε [εδώ](https://github.com/kataras/iris/blob/master/HISTORY.md#tu-30-october-2018--v1102) για να διαβάσετε στα αγγλικά μια σημαντική διόρθωση για τα x32 machines που φέρνει το τελευταίο patch για την έκδοση 11.
|
||||||
|
|
|
@ -17,6 +17,10 @@ Developers tidak diwajibkan untuk melakukan upgrade apabila mereka tidak membutu
|
||||||
|
|
||||||
**Cara Upgrade**: Bukan command-line anda dan eksekuis perintah ini: `go get -u github.com/kataras/iris` atau biarkan updater otomatis melakukannya untuk anda.
|
**Cara Upgrade**: Bukan command-line anda dan eksekuis perintah ini: `go get -u github.com/kataras/iris` atau biarkan updater otomatis melakukannya untuk anda.
|
||||||
|
|
||||||
|
# Fr, 09 November 2018 | v11.0.4
|
||||||
|
|
||||||
|
This history entry is not translated yet to the Indonesian language yet, please refer to the english version of the [HISTORY entry](https://github.com/kataras/iris/blob/master/HISTORY.md#fr-09-november-2018--v1104) instead.
|
||||||
|
|
||||||
# Tu, 30 October 2018 | v11.0.2
|
# Tu, 30 October 2018 | v11.0.2
|
||||||
|
|
||||||
This history entry is not translated yet to the Indonesian language yet, please refer to the english version of the [HISTORY entry](https://github.com/kataras/iris/blob/master/HISTORY.md#tu-30-october-2018--v1102) instead.
|
This history entry is not translated yet to the Indonesian language yet, please refer to the english version of the [HISTORY entry](https://github.com/kataras/iris/blob/master/HISTORY.md#tu-30-october-2018--v1102) instead.
|
||||||
|
|
|
@ -17,6 +17,10 @@
|
||||||
|
|
||||||
**如何升级**: 打开命令行执行以下命令: `go get -u github.com/kataras/iris` 或者等待自动更新。
|
**如何升级**: 打开命令行执行以下命令: `go get -u github.com/kataras/iris` 或者等待自动更新。
|
||||||
|
|
||||||
|
# Fr, 09 November 2018 | v11.0.4
|
||||||
|
|
||||||
|
This history entry is not translated yet to the Chinese language yet, please refer to the english version of the [HISTORY entry](https://github.com/kataras/iris/blob/master/HISTORY.md#fr-09-november-2018--v1104) instead.
|
||||||
|
|
||||||
# Tu, 30 October 2018 | v11.0.2
|
# Tu, 30 October 2018 | v11.0.2
|
||||||
|
|
||||||
This history entry is not translated yet to the Chinese language yet, please refer to the english version of the [HISTORY entry](https://github.com/kataras/iris/blob/master/HISTORY.md#tu-30-october-2018--v1102) instead.
|
This history entry is not translated yet to the Chinese language yet, please refer to the english version of the [HISTORY entry](https://github.com/kataras/iris/blob/master/HISTORY.md#tu-30-october-2018--v1102) instead.
|
||||||
|
|
|
@ -1013,7 +1013,7 @@ Iris, unlike others, is 100% compatible with the standards and that's why the ma
|
||||||
|
|
||||||
## Support
|
## Support
|
||||||
|
|
||||||
- [HISTORY](HISTORY.md#tu-30-october-2018--v1102) file is your best friend, it contains information about the latest features and changes
|
- [HISTORY](HISTORY.md#fr-09-november-2018--v1104) file is your best friend, it contains information about the latest features and changes
|
||||||
- Did you happen to find a bug? Post it at [github issues](https://github.com/kataras/iris/issues)
|
- Did you happen to find a bug? Post it at [github issues](https://github.com/kataras/iris/issues)
|
||||||
- Do you have any questions or need to speak with someone experienced to solve a problem at real-time? Join us to the [community chat](https://chat.iris-go.com)
|
- Do you have any questions or need to speak with someone experienced to solve a problem at real-time? Join us to the [community chat](https://chat.iris-go.com)
|
||||||
- Complete our form-based user experience report by clicking [here](https://docs.google.com/forms/d/e/1FAIpQLSdCxZXPANg_xHWil4kVAdhmh7EBBHQZ_4_xSZVDL-oCC_z5pA/viewform?usp=sf_link)
|
- Complete our form-based user experience report by clicking [here](https://docs.google.com/forms/d/e/1FAIpQLSdCxZXPANg_xHWil4kVAdhmh7EBBHQZ_4_xSZVDL-oCC_z5pA/viewform?usp=sf_link)
|
||||||
|
|
|
@ -108,7 +108,7 @@ _Η τελευταία ενημέρωση έγινε την [Τρίτη, 21 Νο
|
||||||
|
|
||||||
## Υποστήριξη
|
## Υποστήριξη
|
||||||
|
|
||||||
- To [HISTORY](HISTORY_GR.md#tu-30-october-2018--v1102) αρχείο είναι ο καλύτερος σας φίλος, περιέχει πληροφορίες σχετικά με τις τελευταίες λειτουργίες(features) και αλλαγές
|
- To [HISTORY](HISTORY_GR.md#fr-09-november-2018--v1104) αρχείο είναι ο καλύτερος σας φίλος, περιέχει πληροφορίες σχετικά με τις τελευταίες λειτουργίες(features) και αλλαγές
|
||||||
- Μήπως τυχαίνει να βρήκατε κάποιο bug; Δημοσιεύστε το στα [github issues](https://github.com/kataras/iris/issues)
|
- Μήπως τυχαίνει να βρήκατε κάποιο bug; Δημοσιεύστε το στα [github issues](https://github.com/kataras/iris/issues)
|
||||||
- Έχετε οποιεσδήποτε ερωτήσεις ή πρέπει να μιλήσετε με κάποιον έμπειρο για την επίλυση ενός προβλήματος σε πραγματικό χρόνο; Ελάτε μαζί μας στην [συνομιλία κοινότητας](https://chat.iris-go.com)
|
- Έχετε οποιεσδήποτε ερωτήσεις ή πρέπει να μιλήσετε με κάποιον έμπειρο για την επίλυση ενός προβλήματος σε πραγματικό χρόνο; Ελάτε μαζί μας στην [συνομιλία κοινότητας](https://chat.iris-go.com)
|
||||||
- Συμπληρώστε την αναφορά εμπειρίας χρήστη κάνοντας κλικ [εδώ](https://docs.google.com/forms/d/e/1FAIpQLSdCxZXPANg_xHWil4kVAdhmh7EBBHQZ_4_xSZVDL-oCC_z5pA/viewform?usp=sf_link)
|
- Συμπληρώστε την αναφορά εμπειρίας χρήστη κάνοντας κλικ [εδώ](https://docs.google.com/forms/d/e/1FAIpQLSdCxZXPANg_xHWil4kVAdhmh7EBBHQZ_4_xSZVDL-oCC_z5pA/viewform?usp=sf_link)
|
||||||
|
|
|
@ -106,7 +106,7 @@ _Diperbarui pada: [Tuesday, 21 November 2017](_benchmarks/README_UNIX.md)_
|
||||||
|
|
||||||
## Dukungan
|
## Dukungan
|
||||||
|
|
||||||
- File [HISTORY](HISTORY_ID.md#tu-30-october-2018--v1102) adalah sahabat anda, file tersebut memiliki informasi terkait fitur dan perubahan terbaru
|
- File [HISTORY](HISTORY_ID.md#fr-09-november-2018--v1104) adalah sahabat anda, file tersebut memiliki informasi terkait fitur dan perubahan terbaru
|
||||||
- Apakah anda menemukan bug? Laporkan itu melalui [github issues](https://github.com/kataras/iris/issues)
|
- Apakah anda menemukan bug? Laporkan itu melalui [github issues](https://github.com/kataras/iris/issues)
|
||||||
- Apakah anda memiliki pertanyaan atau butuh untuk bicara kepada seseorang yang sudah berpengalaman untuk menyelesaikan masalah secara langsung? Gabung bersama kami di [community chat](https://chat.iris-go.com)
|
- Apakah anda memiliki pertanyaan atau butuh untuk bicara kepada seseorang yang sudah berpengalaman untuk menyelesaikan masalah secara langsung? Gabung bersama kami di [community chat](https://chat.iris-go.com)
|
||||||
- Lengkapi laporan user-experience berbasis formulir kami dengan tekan [disini](https://docs.google.com/forms/d/e/1FAIpQLSdCxZXPANg_xHWil4kVAdhmh7EBBHQZ_4_xSZVDL-oCC_z5pA/viewform?usp=sf_link)
|
- Lengkapi laporan user-experience berbasis formulir kami dengan tekan [disini](https://docs.google.com/forms/d/e/1FAIpQLSdCxZXPANg_xHWil4kVAdhmh7EBBHQZ_4_xSZVDL-oCC_z5pA/viewform?usp=sf_link)
|
||||||
|
|
|
@ -106,7 +106,7 @@ _Updated at: [Tuesday, 21 November 2017](_benchmarks/README_UNIX.md)_
|
||||||
|
|
||||||
## 支援
|
## 支援
|
||||||
|
|
||||||
- [HISTORY](HISTORY.md#tu-30-october-2018--v1102)ファイルはあなたの友人です。このファイルには、機能に関する最新の情報や変更点が記載されています。
|
- [HISTORY](HISTORY.md#fr-09-november-2018--v1104)ファイルはあなたの友人です。このファイルには、機能に関する最新の情報や変更点が記載されています。
|
||||||
- バグを発見しましたか?[github issues](https://github.com/kataras/iris/issues)に投稿をお願い致します。
|
- バグを発見しましたか?[github issues](https://github.com/kataras/iris/issues)に投稿をお願い致します。
|
||||||
- 質問がありますか?または問題を即時に解決するため、熟練者に相談する必要がありますか?[community chat](https://chat.iris-go.com)に参加しましょう。
|
- 質問がありますか?または問題を即時に解決するため、熟練者に相談する必要がありますか?[community chat](https://chat.iris-go.com)に参加しましょう。
|
||||||
- [here](https://docs.google.com/forms/d/e/1FAIpQLSdCxZXPANg_xHWil4kVAdhmh7EBBHQZ_4_xSZVDL-oCC_z5pA/viewform?usp=sf_link)をクリックしてユーザーとしての体験を報告しましょう。
|
- [here](https://docs.google.com/forms/d/e/1FAIpQLSdCxZXPANg_xHWil4kVAdhmh7EBBHQZ_4_xSZVDL-oCC_z5pA/viewform?usp=sf_link)をクリックしてユーザーとしての体験を報告しましょう。
|
||||||
|
|
|
@ -106,7 +106,7 @@ _Atualizado em : [Terça, 21 de Novembro de 2017](_benchmarks/README_UNIX.md)_
|
||||||
|
|
||||||
## Apoie
|
## Apoie
|
||||||
|
|
||||||
- [HISTORY](HISTORY.md#tu-30-october-2018--v1102) o arquivo HISTORY é o seu melhor amigo, ele contém informações sobre as últimas features e mudanças.
|
- [HISTORY](HISTORY.md#fr-09-november-2018--v1104) o arquivo HISTORY é o seu melhor amigo, ele contém informações sobre as últimas features e mudanças.
|
||||||
- Econtrou algum bug ? Poste-o nas [issues](https://github.com/kataras/iris/issues)
|
- Econtrou algum bug ? Poste-o nas [issues](https://github.com/kataras/iris/issues)
|
||||||
- Possui alguma dúvida ou gostaria de falar com alguém experiente para resolver seu problema em tempo real ? Junte-se ao [chat da nossa comunidade](https://chat.iris-go.com).
|
- Possui alguma dúvida ou gostaria de falar com alguém experiente para resolver seu problema em tempo real ? Junte-se ao [chat da nossa comunidade](https://chat.iris-go.com).
|
||||||
- Complete nosso formulário de experiência do usuário clicando [aqui](https://docs.google.com/forms/d/e/1FAIpQLSdCxZXPANg_xHWil4kVAdhmh7EBBHQZ_4_xSZVDL-oCC_z5pA/viewform?usp=sf_link)
|
- Complete nosso formulário de experiência do usuário clicando [aqui](https://docs.google.com/forms/d/e/1FAIpQLSdCxZXPANg_xHWil4kVAdhmh7EBBHQZ_4_xSZVDL-oCC_z5pA/viewform?usp=sf_link)
|
||||||
|
|
|
@ -106,7 +106,7 @@ _Обновлено: [Вторник, 21 ноября 2017 г.](_benchmarks/READ
|
||||||
|
|
||||||
## Поддержка
|
## Поддержка
|
||||||
|
|
||||||
- Файл [HISTORY](HISTORY.md#tu-30-october-2018--v1102) - ваш лучший друг, он содержит информацию о последних особенностях и всех изменениях
|
- Файл [HISTORY](HISTORY.md#fr-09-november-2018--v1104) - ваш лучший друг, он содержит информацию о последних особенностях и всех изменениях
|
||||||
- Вы случайно обнаружили ошибку? Опубликуйте ее на [Github вопросы](https://github.com/kataras/iris/issues)
|
- Вы случайно обнаружили ошибку? Опубликуйте ее на [Github вопросы](https://github.com/kataras/iris/issues)
|
||||||
- У Вас есть какие-либо вопросы или Вам нужно поговорить с кем-то, кто бы смог решить Вашу проблему в режиме реального времени? Присоединяйтесь к нам в [чате сообщества](https://chat.iris-go.com)
|
- У Вас есть какие-либо вопросы или Вам нужно поговорить с кем-то, кто бы смог решить Вашу проблему в режиме реального времени? Присоединяйтесь к нам в [чате сообщества](https://chat.iris-go.com)
|
||||||
- Заполните наш отчет о пользовательском опыте на основе формы, нажав [здесь](https://docs.google.com/forms/d/e/1FAIpQLSdCxZXPANg_xHWil4kVAdhmh7EBBHQZ_4_xSZVDL-oCC_z5pA/viewform?usp=sf_link)
|
- Заполните наш отчет о пользовательском опыте на основе формы, нажав [здесь](https://docs.google.com/forms/d/e/1FAIpQLSdCxZXPANg_xHWil4kVAdhmh7EBBHQZ_4_xSZVDL-oCC_z5pA/viewform?usp=sf_link)
|
||||||
|
|
|
@ -102,7 +102,7 @@ _更新于: [2017年11月21日星期二](_benchmarks/README_UNIX.md)_
|
||||||
|
|
||||||
## 支持
|
## 支持
|
||||||
|
|
||||||
- [更新记录](HISTORY_ZH.md#tu-30-october-2018--v1102) 是您最好的朋友,它包含有关最新功能和更改的信息
|
- [更新记录](HISTORY_ZH.md#fr-09-november-2018--v1104) 是您最好的朋友,它包含有关最新功能和更改的信息
|
||||||
- 你碰巧找到了一个错误? 请提交 [github issues](https://github.com/kataras/iris/issues)
|
- 你碰巧找到了一个错误? 请提交 [github issues](https://github.com/kataras/iris/issues)
|
||||||
- 您是否有任何疑问或需要与有经验的人士交谈以实时解决问题? [加入我们的聊天](https://chat.iris-go.com)
|
- 您是否有任何疑问或需要与有经验的人士交谈以实时解决问题? [加入我们的聊天](https://chat.iris-go.com)
|
||||||
- [点击这里完成我们基于表单的用户体验报告](https://docs.google.com/forms/d/e/1FAIpQLSdCxZXPANg_xHWil4kVAdhmh7EBBHQZ_4_xSZVDL-oCC_z5pA/viewform?usp=sf_link)
|
- [点击这里完成我们基于表单的用户体验报告](https://docs.google.com/forms/d/e/1FAIpQLSdCxZXPANg_xHWil4kVAdhmh7EBBHQZ_4_xSZVDL-oCC_z5pA/viewform?usp=sf_link)
|
||||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
11.0.2:https://github.com/kataras/iris/blob/master/HISTORY.md#tu-30-october-2018--v1102
|
11.0.4:https://github.com/kataras/iris/blob/master/HISTORY.md#fr-09-november-2018--v1104
|
|
@ -44,5 +44,11 @@ func main() {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
app.Run(iris.Addr(":80"))
|
// iris.WithoutPathCorrectionRedirection | iris#Configuration.DisablePathCorrectionRedirection:
|
||||||
|
// CORS needs the allow origin headers in the redirect response as well, we have a solution for this:
|
||||||
|
// If you use iris >= v11.0.4 then add the `app.Run(..., iris.WithoutPathCorrectionRedirection)`
|
||||||
|
// on the server side if you wish
|
||||||
|
// to directly fire the handler instead of redirection (which is the default behavior)
|
||||||
|
// on request paths like "/v1/mailer/" when "/v1/mailer" route handler is registered.
|
||||||
|
app.Run(iris.Addr(":80"), iris.WithoutPathCorrectionRedirection)
|
||||||
}
|
}
|
||||||
|
|
|
@ -229,6 +229,14 @@ var WithoutPathCorrection = func(app *Application) {
|
||||||
app.config.DisablePathCorrection = true
|
app.config.DisablePathCorrection = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WithoutPathCorrectionRedirection disables the PathCorrectionRedirection setting.
|
||||||
|
//
|
||||||
|
// See `Configuration`.
|
||||||
|
var WithoutPathCorrectionRedirection = func(app *Application) {
|
||||||
|
app.config.DisablePathCorrection = false
|
||||||
|
app.config.DisablePathCorrectionRedirection = true
|
||||||
|
}
|
||||||
|
|
||||||
// WithoutBodyConsumptionOnUnmarshal disables BodyConsumptionOnUnmarshal setting.
|
// WithoutBodyConsumptionOnUnmarshal disables BodyConsumptionOnUnmarshal setting.
|
||||||
//
|
//
|
||||||
// See `Configuration`.
|
// See `Configuration`.
|
||||||
|
@ -380,14 +388,24 @@ type Configuration struct {
|
||||||
// Defaults to false.
|
// Defaults to false.
|
||||||
DisableInterruptHandler bool `json:"disableInterruptHandler,omitempty" yaml:"DisableInterruptHandler" toml:"DisableInterruptHandler"`
|
DisableInterruptHandler bool `json:"disableInterruptHandler,omitempty" yaml:"DisableInterruptHandler" toml:"DisableInterruptHandler"`
|
||||||
|
|
||||||
// DisablePathCorrection corrects and redirects the requested path to the registered path
|
// DisablePathCorrection corrects and redirects or executes directly the handler of
|
||||||
|
// the requested path to the registered path
|
||||||
// for example, if /home/ path is requested but no handler for this Route found,
|
// for example, if /home/ path is requested but no handler for this Route found,
|
||||||
// then the Router checks if /home handler exists, if yes,
|
// then the Router checks if /home handler exists, if yes,
|
||||||
// (permant)redirects the client to the correct path /home
|
// (permant)redirects the client to the correct path /home.
|
||||||
|
//
|
||||||
|
// See `DisablePathCorrectionRedirection` to enable direct handler execution instead of redirection.
|
||||||
//
|
//
|
||||||
// Defaults to false.
|
// Defaults to false.
|
||||||
DisablePathCorrection bool `json:"disablePathCorrection,omitempty" yaml:"DisablePathCorrection" toml:"DisablePathCorrection"`
|
DisablePathCorrection bool `json:"disablePathCorrection,omitempty" yaml:"DisablePathCorrection" toml:"DisablePathCorrection"`
|
||||||
|
|
||||||
|
// DisablePathCorrectionRedirection works whenever configuration.DisablePathCorrection is set to false
|
||||||
|
// and if DisablePathCorrectionRedirection set to true then it will fire the handler of the matching route without
|
||||||
|
// the last slash ("/") instead of send a redirection status.
|
||||||
|
//
|
||||||
|
// Defaults to false.
|
||||||
|
DisablePathCorrectionRedirection bool `json:"disablePathCorrectionRedirection,omitempty" yaml:"DisablePathCorrectionRedirection" toml:"DisablePathCorrectionRedirection"`
|
||||||
|
|
||||||
// EnablePathEscape when is true then its escapes the path, the named parameters (if any).
|
// EnablePathEscape when is true then its escapes the path, the named parameters (if any).
|
||||||
// Change to false it if you want something like this https://github.com/kataras/iris/issues/135 to work
|
// Change to false it if you want something like this https://github.com/kataras/iris/issues/135 to work
|
||||||
//
|
//
|
||||||
|
@ -527,6 +545,13 @@ func (c Configuration) GetDisablePathCorrection() bool {
|
||||||
return c.DisablePathCorrection
|
return c.DisablePathCorrection
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetDisablePathCorrectionRedirection returns the Configuration#DisablePathCorrectionRedirection field.
|
||||||
|
// If DisablePathCorrectionRedirection set to true then it will fire the handler of the matching route without
|
||||||
|
// the last slash ("/") instead of send a redirection status.
|
||||||
|
func (c Configuration) GetDisablePathCorrectionRedirection() bool {
|
||||||
|
return c.DisablePathCorrectionRedirection
|
||||||
|
}
|
||||||
|
|
||||||
// GetEnablePathEscape is the Configuration#EnablePathEscape,
|
// GetEnablePathEscape is the Configuration#EnablePathEscape,
|
||||||
// returns true when its escapes the path, the named parameters (if any).
|
// returns true when its escapes the path, the named parameters (if any).
|
||||||
func (c Configuration) GetEnablePathEscape() bool {
|
func (c Configuration) GetEnablePathEscape() bool {
|
||||||
|
@ -668,6 +693,10 @@ func WithConfiguration(c Configuration) Configurator {
|
||||||
main.DisablePathCorrection = v
|
main.DisablePathCorrection = v
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if v := c.DisablePathCorrectionRedirection; v {
|
||||||
|
main.DisablePathCorrectionRedirection = v
|
||||||
|
}
|
||||||
|
|
||||||
if v := c.EnablePathEscape; v {
|
if v := c.EnablePathEscape; v {
|
||||||
main.EnablePathEscape = v
|
main.EnablePathEscape = v
|
||||||
}
|
}
|
||||||
|
|
|
@ -142,6 +142,7 @@ func TestConfigurationYAML(t *testing.T) {
|
||||||
|
|
||||||
yamlConfigurationContents := `
|
yamlConfigurationContents := `
|
||||||
DisablePathCorrection: false
|
DisablePathCorrection: false
|
||||||
|
DisablePathCorrectionRedirection: true
|
||||||
EnablePathEscape: false
|
EnablePathEscape: false
|
||||||
FireMethodNotAllowed: true
|
FireMethodNotAllowed: true
|
||||||
EnableOptimizations: true
|
EnableOptimizations: true
|
||||||
|
@ -167,6 +168,10 @@ Other:
|
||||||
t.Fatalf("error on TestConfigurationYAML: Expected DisablePathCorrection %v but got %v", expected, c.DisablePathCorrection)
|
t.Fatalf("error on TestConfigurationYAML: Expected DisablePathCorrection %v but got %v", expected, c.DisablePathCorrection)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if expected := true; c.DisablePathCorrectionRedirection != expected {
|
||||||
|
t.Fatalf("error on TestConfigurationYAML: Expected DisablePathCorrectionRedirection %v but got %v", expected, c.DisablePathCorrectionRedirection)
|
||||||
|
}
|
||||||
|
|
||||||
if expected := false; c.EnablePathEscape != expected {
|
if expected := false; c.EnablePathEscape != expected {
|
||||||
t.Fatalf("error on TestConfigurationYAML: Expected EnablePathEscape %v but got %v", expected, c.EnablePathEscape)
|
t.Fatalf("error on TestConfigurationYAML: Expected EnablePathEscape %v but got %v", expected, c.EnablePathEscape)
|
||||||
}
|
}
|
||||||
|
@ -235,6 +240,7 @@ func TestConfigurationTOML(t *testing.T) {
|
||||||
}()
|
}()
|
||||||
|
|
||||||
tomlConfigurationContents := `
|
tomlConfigurationContents := `
|
||||||
|
DisablePathCorrectionRedirection = true
|
||||||
EnablePathEscape = false
|
EnablePathEscape = false
|
||||||
FireMethodNotAllowed = true
|
FireMethodNotAllowed = true
|
||||||
EnableOptimizations = true
|
EnableOptimizations = true
|
||||||
|
@ -262,6 +268,10 @@ Charset = "UTF-8"
|
||||||
t.Fatalf("error on TestConfigurationTOML: Expected DisablePathCorrection %v but got %v", expected, c.DisablePathCorrection)
|
t.Fatalf("error on TestConfigurationTOML: Expected DisablePathCorrection %v but got %v", expected, c.DisablePathCorrection)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if expected := true; c.DisablePathCorrectionRedirection != expected {
|
||||||
|
t.Fatalf("error on TestConfigurationTOML: Expected DisablePathCorrectionRedirection %v but got %v", expected, c.DisablePathCorrectionRedirection)
|
||||||
|
}
|
||||||
|
|
||||||
if expected := false; c.EnablePathEscape != expected {
|
if expected := false; c.EnablePathEscape != expected {
|
||||||
t.Fatalf("error on TestConfigurationTOML: Expected EnablePathEscape %v but got %v", expected, c.EnablePathEscape)
|
t.Fatalf("error on TestConfigurationTOML: Expected EnablePathEscape %v but got %v", expected, c.EnablePathEscape)
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,11 @@ type ConfigurationReadOnly interface {
|
||||||
// (permant)redirects the client to the correct path /home.
|
// (permant)redirects the client to the correct path /home.
|
||||||
GetDisablePathCorrection() bool
|
GetDisablePathCorrection() bool
|
||||||
|
|
||||||
|
// GetDisablePathCorrectionRedirection returns the Configuration#DisablePathCorrectionRedirection field.
|
||||||
|
// If DisablePathCorrectionRedirection set to true then it will fire the handler of the matching route without
|
||||||
|
// the last slash ("/") instead of send a redirection status.
|
||||||
|
GetDisablePathCorrectionRedirection() bool
|
||||||
|
|
||||||
// GetEnablePathEscape is the configuration.EnablePathEscape,
|
// GetEnablePathEscape is the configuration.EnablePathEscape,
|
||||||
// returns true when its escapes the path, the named parameters (if any).
|
// returns true when its escapes the path, the named parameters (if any).
|
||||||
GetEnablePathEscape() bool
|
GetEnablePathEscape() bool
|
||||||
|
|
|
@ -152,7 +152,10 @@ func (h *routerHandler) HandleRequest(ctx context.Context) {
|
||||||
r := ctx.Request()
|
r := ctx.Request()
|
||||||
// use Trim to ensure there is no open redirect due to two leading slashes
|
// use Trim to ensure there is no open redirect due to two leading slashes
|
||||||
path = "/" + strings.Trim(path, "/")
|
path = "/" + strings.Trim(path, "/")
|
||||||
|
|
||||||
r.URL.Path = path
|
r.URL.Path = path
|
||||||
|
if !ctx.Application().ConfigurationReadOnly().GetDisablePathCorrectionRedirection() {
|
||||||
|
// do redirect, else continue with the modified path without the last "/".
|
||||||
url := r.URL.String()
|
url := r.URL.String()
|
||||||
|
|
||||||
// Fixes https://github.com/kataras/iris/issues/921
|
// Fixes https://github.com/kataras/iris/issues/921
|
||||||
|
@ -177,6 +180,8 @@ func (h *routerHandler) HandleRequest(ctx context.Context) {
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for i := range h.trees {
|
for i := range h.trees {
|
||||||
|
|
2
doc.go
2
doc.go
|
@ -35,7 +35,7 @@ Source code and other details for the project are available at GitHub:
|
||||||
|
|
||||||
Current Version
|
Current Version
|
||||||
|
|
||||||
11.0.1
|
11.0.4
|
||||||
|
|
||||||
Installation
|
Installation
|
||||||
|
|
||||||
|
|
2
iris.go
2
iris.go
|
@ -33,7 +33,7 @@ import (
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// Version is the current version number of the Iris Web Framework.
|
// Version is the current version number of the Iris Web Framework.
|
||||||
Version = "11.0.1"
|
Version = "11.0.4"
|
||||||
)
|
)
|
||||||
|
|
||||||
// HTTP status codes as registered with IANA.
|
// HTTP status codes as registered with IANA.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user