From 113ce190e69bebf948ca06a0eb4cd7ac4a182bdb Mon Sep 17 00:00:00 2001 From: "Gerasimos (Makis) Maropoulos" Date: Thu, 18 Jan 2024 03:11:54 +0200 Subject: [PATCH] release version 12.2.10 --- HISTORY.md | 5 + README.md | 4 +- README_ES.md | 4 +- README_FA.md | 4 +- README_FR.md | 4 +- README_GR.md | 4 +- README_JA.md | 4 +- README_KO.md | 4 +- README_PT_BR.md | 4 +- README_RU.md | 4 +- README_VN.md | 4 +- README_ZH_HANS.md | 2 +- README_ZH_HANT.md | 4 +- .../main_test.go | 2 +- .../assets/favicon.ico | Bin 0 -> 15086 bytes .../embedding-files-into-app/main_test.go | 5 + _examples/logging/json-logger/main_test.go | 15 +- configuration.go | 11 +- configuration_test.go | 4 +- context/handler.go | 2 +- core/host/proxy_test.go | 15 +- core/host/supervisor.go | 127 +++++++++-------- core/host/supervisor_task_example_test.go | 75 ---------- core/host/supervisor_test.go | 2 +- core/host/task.go | 4 +- core/host/waiter.go | 134 ++++++++++++++++++ doc.go | 2 +- go.mod | 4 +- go.sum | 12 +- httptest/httptest.go | 4 +- iris.go | 51 ++++--- 31 files changed, 313 insertions(+), 207 deletions(-) create mode 100644 _examples/file-server/embedding-files-into-app/assets/favicon.ico create mode 100644 core/host/waiter.go diff --git a/HISTORY.md b/HISTORY.md index 0c8dde07cc..eab2ec0f31 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -19,10 +19,15 @@ 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 github.com/kataras/iris/v12@latest` and `go mod tidy -compat=1.21`. + # Next Changes apply to `main` branch. +# Thu, 18 Jan 2024 | v12.2.10 + +- Simplify the `/core/host` subpackage and remove its `DeferFlow` and `RestoreFlow` methods. +- Fix internal `trimHandlerName` and other minor stuff. - New `iris.NonBlocking()` configuration option to run the server without blocking the main routine, `Application.Wait(context.Context) error` method can be used to block and wait for the server to be up and running. Example: ```go diff --git a/README.md b/README.md index db77875de2..0fd36b095f 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Try the official [Iris Command Line Interface](https://github.com/kataras/iris-c # Iris Web Framework -[![build status](https://img.shields.io/github/actions/workflow/status/kataras/iris/ci.yml?branch=main&style=for-the-badge)](https://github.com/kataras/iris/actions/workflows/ci.yml) [![view examples](https://img.shields.io/badge/examples%20-285-a83adf.svg?style=for-the-badge&logo=go)](https://github.com/kataras/iris/tree/main/_examples) [![chat](https://img.shields.io/gitter/room/iris_go/community.svg?color=cc2b5e&logo=gitter&style=for-the-badge)](https://gitter.im/iris_go/community) [![donate](https://img.shields.io/badge/support-Iris-blue.svg?style=for-the-badge&logo=paypal)](https://iris-go.com/donate) +[![build status](https://img.shields.io/github/actions/workflow/status/kataras/iris/ci.yml?branch=main&style=for-the-badge)](https://github.com/kataras/iris/actions/workflows/ci.yml) [![view examples](https://img.shields.io/badge/examples%20-285-a83adf.svg?style=for-the-badge&logo=go)](https://github.com/kataras/iris/tree/main/_examples) [![chat](https://img.shields.io/gitter/room/iris_go/community.svg?color=cc2b5e&logo=gitter&style=for-the-badge)](https://gitter.im/iris_go/community) [![donate](https://img.shields.io/badge/support-Iris-blue.svg?style=for-the-badge&logo=paypal)](https://iris-go.com/donate) Iris is a fast, simple yet fully featured and very efficient web framework for Go. @@ -586,7 +586,7 @@ The only requirement is the [Go Programming Language](https://go.dev/dl/). $ mkdir myapp $ cd myapp $ go mod init myapp -$ go get github.com/kataras/iris/v12@latest # or @v12.2.9 +$ go get github.com/kataras/iris/v12@latest # or @v ```
Install on existing project diff --git a/README_ES.md b/README_ES.md index 6940e7e2e0..622b9ac087 100644 --- a/README_ES.md +++ b/README_ES.md @@ -1,6 +1,6 @@ # Iris Web Framework -[![build status](https://img.shields.io/github/actions/workflow/status/kataras/iris/ci.yml?branch=main&style=for-the-badge)](https://github.com/kataras/iris/actions/workflows/ci.yml) [![FOSSA Status](https://img.shields.io/badge/LICENSE%20SCAN-PASSING❤️-CD2956?style=for-the-badge&logo=fossa)](https://app.fossa.io/projects/git%2Bgithub.com%2Fkataras%2Firis?ref=badge_shield) [![view examples](https://img.shields.io/badge/learn%20by-examples-0C8EC5.svg?style=for-the-badge&logo=go)](https://github.com/kataras/iris/tree/main/_examples) [![chat](https://img.shields.io/gitter/room/iris_go/community.svg?color=7E18DD&logo=gitter&style=for-the-badge)](https://gitter.im/iris_go/community) +[![build status](https://img.shields.io/github/actions/workflow/status/kataras/iris/ci.yml?branch=main&style=for-the-badge)](https://github.com/kataras/iris/actions/workflows/ci.yml) [![FOSSA Status](https://img.shields.io/badge/LICENSE%20SCAN-PASSING❤️-CD2956?style=for-the-badge&logo=fossa)](https://app.fossa.io/projects/git%2Bgithub.com%2Fkataras%2Firis?ref=badge_shield) [![view examples](https://img.shields.io/badge/learn%20by-examples-0C8EC5.svg?style=for-the-badge&logo=go)](https://github.com/kataras/iris/tree/main/_examples) [![chat](https://img.shields.io/gitter/room/iris_go/community.svg?color=7E18DD&logo=gitter&style=for-the-badge)](https://gitter.im/iris_go/community) Iris es un framework web rápido, simple pero con muchas funcionalidades y muy eficiente para Go. Proporciona una base bellamente expresiva y fácil de usar para su próximo sitio web o API. @@ -49,7 +49,7 @@ $ go run ejemplo.go Iris contiene un extenso y completo **[wiki](https://www.iris-go.com/#ebookDonateForm)** que facilita comenzar con el framework. -Para obtener una documentación técnica más detallada, puede dirigirse a nuestros [godocs](https://pkg.go.dev/github.com/kataras/iris/v12@v12.2.9). Y para código ejecutable siempre puede visitar el subdirectorio del repositorio [\_examples](_examples/). +Para obtener una documentación técnica más detallada, puede dirigirse a nuestros [godocs](https://pkg.go.dev/github.com/kataras/iris/v12@v). Y para código ejecutable siempre puede visitar el subdirectorio del repositorio [\_examples](_examples/). ### ¿Te gusta leer mientras viajas? diff --git a/README_FA.md b/README_FA.md index eb6f939538..2cdc42a69a 100644 --- a/README_FA.md +++ b/README_FA.md @@ -10,7 +10,7 @@ # Iris Web Framework -[![build status](https://img.shields.io/github/actions/workflow/status/kataras/iris/ci.yml?branch=main&style=for-the-badge)](https://github.com/kataras/iris/actions/workflows/ci.yml) [![FOSSA Status](https://img.shields.io/badge/LICENSE%20SCAN-PASSING❤️-CD2956?style=for-the-badge&logo=fossa)](https://app.fossa.io/projects/git%2Bgithub.com%2Fkataras%2Firis?ref=badge_shield) [![view examples](https://img.shields.io/badge/learn%20by-examples-0C8EC5.svg?style=for-the-badge&logo=go)](https://github.com/kataras/iris/tree/main/_examples) [![chat](https://img.shields.io/gitter/room/iris_go/community.svg?color=7E18DD&logo=gitter&style=for-the-badge)](https://gitter.im/iris_go/community) +[![build status](https://img.shields.io/github/actions/workflow/status/kataras/iris/ci.yml?branch=main&style=for-the-badge)](https://github.com/kataras/iris/actions/workflows/ci.yml) [![FOSSA Status](https://img.shields.io/badge/LICENSE%20SCAN-PASSING❤️-CD2956?style=for-the-badge&logo=fossa)](https://app.fossa.io/projects/git%2Bgithub.com%2Fkataras%2Firis?ref=badge_shield) [![view examples](https://img.shields.io/badge/learn%20by-examples-0C8EC5.svg?style=for-the-badge&logo=go)](https://github.com/kataras/iris/tree/main/_examples) [![chat](https://img.shields.io/gitter/room/iris_go/community.svg?color=7E18DD&logo=gitter&style=for-the-badge)](https://gitter.im/iris_go/community) آیریس یک چارچوب وب پر سرعت ، ساده و در عین حال کاملاً برجسته و بسیار کارآمد برای Go است. @@ -137,7 +137,7 @@ func (c *userController) PutBy(id uint64, req request) response { $ mkdir myapp $ cd myapp $ go mod init myapp -$ go get github.com/kataras/iris/v12@latest # or @v12.2.9 +$ go get github.com/kataras/iris/v12@latest # or @v ```
diff --git a/README_FR.md b/README_FR.md index 6d8c7327e8..0f7c7065bf 100644 --- a/README_FR.md +++ b/README_FR.md @@ -1,6 +1,6 @@ # Iris Web Framework -[![build status](https://img.shields.io/github/actions/workflow/status/kataras/iris/ci.yml?branch=main&style=for-the-badge)](https://github.com/kataras/iris/actions/workflows/ci.yml) [![FOSSA Status](https://img.shields.io/badge/LICENSE%20SCAN-PASSING❤️-CD2956?style=for-the-badge&logo=fossa)](https://app.fossa.io/projects/git%2Bgithub.com%2Fkataras%2Firis?ref=badge_shield) [![view examples](https://img.shields.io/badge/learn%20by-examples-0C8EC5.svg?style=for-the-badge&logo=go)](https://github.com/kataras/iris/tree/main/_examples) [![chat](https://img.shields.io/gitter/room/iris_go/community.svg?color=7E18DD&logo=gitter&style=for-the-badge)](https://gitter.im/iris_go/community) +[![build status](https://img.shields.io/github/actions/workflow/status/kataras/iris/ci.yml?branch=main&style=for-the-badge)](https://github.com/kataras/iris/actions/workflows/ci.yml) [![FOSSA Status](https://img.shields.io/badge/LICENSE%20SCAN-PASSING❤️-CD2956?style=for-the-badge&logo=fossa)](https://app.fossa.io/projects/git%2Bgithub.com%2Fkataras%2Firis?ref=badge_shield) [![view examples](https://img.shields.io/badge/learn%20by-examples-0C8EC5.svg?style=for-the-badge&logo=go)](https://github.com/kataras/iris/tree/main/_examples) [![chat](https://img.shields.io/gitter/room/iris_go/community.svg?color=7E18DD&logo=gitter&style=for-the-badge)](https://gitter.im/iris_go/community) @@ -57,7 +57,7 @@ Iris possède un **[wiki](https://www.iris-go.com/#ebookDonateForm)** complet et -Pour une documentation encore plus complète vous pouvez visiter notre [godocs](https://pkg.go.dev/github.com/kataras/iris/v12@v12.2.9) (en Anglais). Et vous trouverez du code executable dans le dossier [\_examples](_examples/). +Pour une documentation encore plus complète vous pouvez visiter notre [godocs](https://pkg.go.dev/github.com/kataras/iris/v12@v) (en Anglais). Et vous trouverez du code executable dans le dossier [\_examples](_examples/). ### Vous préférez une version PDF? diff --git a/README_GR.md b/README_GR.md index 3e3f4338b4..29b196c950 100644 --- a/README_GR.md +++ b/README_GR.md @@ -1,6 +1,6 @@ # Iris Web Framework -[![build status](https://img.shields.io/github/actions/workflow/status/kataras/iris/ci.yml?branch=main&style=for-the-badge)](https://github.com/kataras/iris/actions/workflows/ci.yml) [![FOSSA Status](https://img.shields.io/badge/LICENSE%20SCAN-PASSING❤️-CD2956?style=for-the-badge&logo=fossa)](https://app.fossa.io/projects/git%2Bgithub.com%2Fkataras%2Firis?ref=badge_shield) [![view examples](https://img.shields.io/badge/learn%20by-examples-0C8EC5.svg?style=for-the-badge&logo=go)](https://github.com/kataras/iris/tree/main/_examples) [![chat](https://img.shields.io/gitter/room/iris_go/community.svg?color=7E18DD&logo=gitter&style=for-the-badge)](https://gitter.im/iris_go/community) +[![build status](https://img.shields.io/github/actions/workflow/status/kataras/iris/ci.yml?branch=main&style=for-the-badge)](https://github.com/kataras/iris/actions/workflows/ci.yml) [![FOSSA Status](https://img.shields.io/badge/LICENSE%20SCAN-PASSING❤️-CD2956?style=for-the-badge&logo=fossa)](https://app.fossa.io/projects/git%2Bgithub.com%2Fkataras%2Firis?ref=badge_shield) [![view examples](https://img.shields.io/badge/learn%20by-examples-0C8EC5.svg?style=for-the-badge&logo=go)](https://github.com/kataras/iris/tree/main/_examples) [![chat](https://img.shields.io/gitter/room/iris_go/community.svg?color=7E18DD&logo=gitter&style=for-the-badge)](https://gitter.im/iris_go/community) Το Iris είναι ένα γρήγορο, απλό αλλά και πλήρως λειτουργικό και πολύ αποδοτικό web framework για τη Go γλώσσα προγραμματισμού. Παρέχει ένα εκφραστικό και εύχρηστο υπόβαθρο για την επόμενη ιστοσελίδα σας. @@ -53,7 +53,7 @@ $ go run example.go Το Iris περιέχει εκτενείς και λεπτομερείς **[book](https://www.iris-go.com/#ebookDonateForm)** καθιστώντας το εύκολο στην εκμάθηση. -Για λεπτομερέστερη τεχνική τεκμηρίωση μπορείτε να κατευθυνθείτε προς τα [godocs](https://pkg.go.dev/github.com/kataras/iris/v12@v12.2.9) μας. Και για εκτελέσιμο κώδικα μπορείτε πάντα να επισκέπτεστε τα [παραδείγματα](_examples/). +Για λεπτομερέστερη τεχνική τεκμηρίωση μπορείτε να κατευθυνθείτε προς τα [godocs](https://pkg.go.dev/github.com/kataras/iris/v12@v) μας. Και για εκτελέσιμο κώδικα μπορείτε πάντα να επισκέπτεστε τα [παραδείγματα](_examples/). ### Σας αρέσει να διαβάζετε ενώ ταξιδεύετε; diff --git a/README_JA.md b/README_JA.md index 600c9953c5..e7218e712a 100644 --- a/README_JA.md +++ b/README_JA.md @@ -6,7 +6,7 @@ Try the official [Iris Command Line Interface](https://github.com/kataras/iris-c # Iris Web Framework -[![build status](https://img.shields.io/github/actions/workflow/status/kataras/iris/ci.yml?branch=main&style=for-the-badge)](https://github.com/kataras/iris/actions/workflows/ci.yml) [![view examples](https://img.shields.io/badge/examples%20-285-a83adf.svg?style=for-the-badge&logo=go)](https://github.com/kataras/iris/tree/main/_examples) [![chat](https://img.shields.io/gitter/room/iris_go/community.svg?color=cc2b5e&logo=gitter&style=for-the-badge)](https://gitter.im/iris_go/community) [![donate](https://img.shields.io/badge/support-Iris-blue.svg?style=for-the-badge&logo=paypal)](https://iris-go.com/donate) +[![build status](https://img.shields.io/github/actions/workflow/status/kataras/iris/ci.yml?branch=main&style=for-the-badge)](https://github.com/kataras/iris/actions/workflows/ci.yml) [![view examples](https://img.shields.io/badge/examples%20-285-a83adf.svg?style=for-the-badge&logo=go)](https://github.com/kataras/iris/tree/main/_examples) [![chat](https://img.shields.io/gitter/room/iris_go/community.svg?color=cc2b5e&logo=gitter&style=for-the-badge)](https://gitter.im/iris_go/community) [![donate](https://img.shields.io/badge/support-Iris-blue.svg?style=for-the-badge&logo=paypal)](https://iris-go.com/donate) Irisは、高速でシンプルでありながら、十分な機能を備えた、非常に効率的なGo用Webフレームワークです。 @@ -219,7 +219,7 @@ Irisが提供する機能の一部: $ mkdir myapp $ cd myapp $ go mod init myapp -$ go get github.com/kataras/iris/v12@latest # or @v12.2.9 +$ go get github.com/kataras/iris/v12@latest # or @v ```
既存のプロジェクトにインストールする場合 diff --git a/README_KO.md b/README_KO.md index 05c594d7b8..d4be33216e 100644 --- a/README_KO.md +++ b/README_KO.md @@ -1,6 +1,6 @@ # Iris Web Framework -[![build status](https://img.shields.io/github/actions/workflow/status/kataras/iris/ci.yml?branch=main&style=for-the-badge)](https://github.com/kataras/iris/actions/workflows/ci.yml) [![FOSSA Status](https://img.shields.io/badge/LICENSE%20SCAN-PASSING❤️-CD2956?style=for-the-badge&logo=fossa)](https://app.fossa.io/projects/git%2Bgithub.com%2Fkataras%2Firis?ref=badge_shield) [![view examples](https://img.shields.io/badge/learn%20by-examples-0C8EC5.svg?style=for-the-badge&logo=go)](https://github.com/kataras/iris/tree/main/_examples) [![chat](https://img.shields.io/gitter/room/iris_go/community.svg?color=7E18DD&logo=gitter&style=for-the-badge)](https://gitter.im/iris_go/community) +[![build status](https://img.shields.io/github/actions/workflow/status/kataras/iris/ci.yml?branch=main&style=for-the-badge)](https://github.com/kataras/iris/actions/workflows/ci.yml) [![FOSSA Status](https://img.shields.io/badge/LICENSE%20SCAN-PASSING❤️-CD2956?style=for-the-badge&logo=fossa)](https://app.fossa.io/projects/git%2Bgithub.com%2Fkataras%2Firis?ref=badge_shield) [![view examples](https://img.shields.io/badge/learn%20by-examples-0C8EC5.svg?style=for-the-badge&logo=go)](https://github.com/kataras/iris/tree/main/_examples) [![chat](https://img.shields.io/gitter/room/iris_go/community.svg?color=7E18DD&logo=gitter&style=for-the-badge)](https://gitter.im/iris_go/community) Iris는 단순하고 빠르며 좋은 성능과 모든 기능을 갖춘 Go언어용 웹 프레임워크입니다. 당신의 웹사이트나 API를 위해서 아름답고 사용하기 쉬운 기반을 제공합니다. @@ -49,7 +49,7 @@ $ go run example.go Iris는 광범위하고 꼼꼼한 **[wiki](https://www.iris-go.com/#ebookDonateForm)** 를 가지고 있기 때문에 쉽게 프레임워크를 시작할 수 있습니다. -더 자세한 기술문서를 보시려면 [godocs](https://pkg.go.dev/github.com/kataras/iris/v12@v12.2.9)를 방문하세요. 그리고 실행가능한 예제코드는 [\_examples](_examples/) 하위 디렉토리에 있습니다. +더 자세한 기술문서를 보시려면 [godocs](https://pkg.go.dev/github.com/kataras/iris/v12@v)를 방문하세요. 그리고 실행가능한 예제코드는 [\_examples](_examples/) 하위 디렉토리에 있습니다. ### 여행하면서 독서를 즐기세요? diff --git a/README_PT_BR.md b/README_PT_BR.md index c605b19a10..e3ac80e5aa 100644 --- a/README_PT_BR.md +++ b/README_PT_BR.md @@ -2,7 +2,7 @@ # Iris Web Framework -[![build status](https://img.shields.io/github/actions/workflow/status/kataras/iris/ci.yml?branch=main&style=for-the-badge)](https://github.com/kataras/iris/actions/workflows/ci.yml) [![view examples](https://img.shields.io/badge/examples%20-270-a83adf.svg?style=for-the-badge&logo=go)](https://github.com/kataras/iris/tree/main/_examples) [![chat](https://img.shields.io/gitter/room/iris_go/community.svg?color=cc2b5e&logo=gitter&style=for-the-badge)](https://gitter.im/iris_go/community) [![donate](https://img.shields.io/badge/support-Iris-blue.svg?style=for-the-badge&logo=paypal)](https://iris-go.com/donate) +[![build status](https://img.shields.io/github/actions/workflow/status/kataras/iris/ci.yml?branch=main&style=for-the-badge)](https://github.com/kataras/iris/actions/workflows/ci.yml) [![view examples](https://img.shields.io/badge/examples%20-270-a83adf.svg?style=for-the-badge&logo=go)](https://github.com/kataras/iris/tree/main/_examples) [![chat](https://img.shields.io/gitter/room/iris_go/community.svg?color=cc2b5e&logo=gitter&style=for-the-badge)](https://gitter.im/iris_go/community) [![donate](https://img.shields.io/badge/support-Iris-blue.svg?style=for-the-badge&logo=paypal)](https://iris-go.com/donate) @@ -226,7 +226,7 @@ O único requisito é a [Linguagem de programação Go](https://go.dev/dl/). $ mkdir myapp $ cd myapp $ go mod init myapp -$ go get github.com/kataras/iris/v12@latest # or @v12.2.9 +$ go get github.com/kataras/iris/v12@latest # or @v ```
Instalar num projeto existente diff --git a/README_RU.md b/README_RU.md index 37766319d8..41674d83d7 100644 --- a/README_RU.md +++ b/README_RU.md @@ -1,6 +1,6 @@ # Iris Web Framework -[![build status](https://img.shields.io/github/actions/workflow/status/kataras/iris/ci.yml?branch=main&style=for-the-badge)](https://github.com/kataras/iris/actions/workflows/ci.yml) [![FOSSA Status](https://img.shields.io/badge/LICENSE%20SCAN-PASSING❤️-CD2956?style=for-the-badge&logo=fossa)](https://app.fossa.io/projects/git%2Bgithub.com%2Fkataras%2Firis?ref=badge_shield) [![view examples](https://img.shields.io/badge/learn%20by-examples-0C8EC5.svg?style=for-the-badge&logo=go)](https://github.com/kataras/iris/tree/main/_examples) [![chat](https://img.shields.io/gitter/room/iris_go/community.svg?color=7E18DD&logo=gitter&style=for-the-badge)](https://gitter.im/iris_go/community) +[![build status](https://img.shields.io/github/actions/workflow/status/kataras/iris/ci.yml?branch=main&style=for-the-badge)](https://github.com/kataras/iris/actions/workflows/ci.yml) [![FOSSA Status](https://img.shields.io/badge/LICENSE%20SCAN-PASSING❤️-CD2956?style=for-the-badge&logo=fossa)](https://app.fossa.io/projects/git%2Bgithub.com%2Fkataras%2Firis?ref=badge_shield) [![view examples](https://img.shields.io/badge/learn%20by-examples-0C8EC5.svg?style=for-the-badge&logo=go)](https://github.com/kataras/iris/tree/main/_examples) [![chat](https://img.shields.io/gitter/room/iris_go/community.svg?color=7E18DD&logo=gitter&style=for-the-badge)](https://gitter.im/iris_go/community) Iris — это быстрый, простой, но полнофункциональный и эффективный веб-фреймворк для Go. Он обеспечивает красивую, выразительную и простую в использовании основу для вашего следующего веб-сайта или API. Узнайте, что [говорят другие люди об Iris](https://iris-go.com/testimonials/) и поставьте **[звёздочку](https://github.com/kataras/iris/stargazers)** этому проекту с открытым исходным кодом, чтобы поддержать его потенциал. @@ -50,7 +50,7 @@ $ go run example.go -Для получения более подробной технической документации вы можете обратиться к нашему [godoc](https://pkg.go.dev/github.com/kataras/iris/v12@v12.2.9). А для живых примеров кода — вы всегда можете посетить [\_examples](_examples/) в поддиректории этого репозитория. +Для получения более подробной технической документации вы можете обратиться к нашему [godoc](https://pkg.go.dev/github.com/kataras/iris/v12@v). А для живых примеров кода — вы всегда можете посетить [\_examples](_examples/) в поддиректории этого репозитория. ### Вы любите читать во время путешествий? diff --git a/README_VN.md b/README_VN.md index 5550319da0..4dc792ad51 100644 --- a/README_VN.md +++ b/README_VN.md @@ -6,7 +6,7 @@ Try the official [Iris Command Line Interface](https://github.com/kataras/iris-c # Iris Web Framework -[![build status](https://img.shields.io/github/actions/workflow/status/kataras/iris/ci.yml?branch=main&style=for-the-badge)](https://github.com/kataras/iris/actions/workflows/ci.yml) [![view examples](https://img.shields.io/badge/examples%20-285-a83adf.svg?style=for-the-badge&logo=go)](https://github.com/kataras/iris/tree/main/_examples) [![chat](https://img.shields.io/gitter/room/iris_go/community.svg?color=cc2b5e&logo=gitter&style=for-the-badge)](https://gitter.im/iris_go/community) [![donate](https://img.shields.io/badge/support-Iris-blue.svg?style=for-the-badge&logo=paypal)](https://iris-go.com/donate) +[![build status](https://img.shields.io/github/actions/workflow/status/kataras/iris/ci.yml?branch=main&style=for-the-badge)](https://github.com/kataras/iris/actions/workflows/ci.yml) [![view examples](https://img.shields.io/badge/examples%20-285-a83adf.svg?style=for-the-badge&logo=go)](https://github.com/kataras/iris/tree/main/_examples) [![chat](https://img.shields.io/gitter/room/iris_go/community.svg?color=cc2b5e&logo=gitter&style=for-the-badge)](https://gitter.im/iris_go/community) [![donate](https://img.shields.io/badge/support-Iris-blue.svg?style=for-the-badge&logo=paypal)](https://iris-go.com/donate) Iris là một khung web nhanh, đơn giản nhưng đầy đủ tính năng và rất hiệu quả dành cho Go. @@ -220,7 +220,7 @@ Yêu cầu duy nhất là [Ngôn ngữ lập trình Go](https://go.dev/dl/). $ mkdir myapp $ cd myapp $ go mod init myapp -$ go get github.com/kataras/iris/v12@latest # or @v12.2.9 +$ go get github.com/kataras/iris/v12@latest # or @v ```
Cài đặt trên dự án hiện có diff --git a/README_ZH_HANS.md b/README_ZH_HANS.md index 613845e9cd..8046c1bb25 100644 --- a/README_ZH_HANS.md +++ b/README_ZH_HANS.md @@ -10,7 +10,7 @@ # Iris Web Framework -[![build status](https://img.shields.io/github/actions/workflow/status/kataras/iris/ci.yml?branch=main&style=for-the-badge)](https://github.com/kataras/iris/actions/workflows/ci.yml) [![view examples](https://img.shields.io/badge/examples%20-253-a83adf.svg?style=for-the-badge&logo=go)](https://github.com/kataras/iris/tree/main/_examples) [![chat](https://img.shields.io/gitter/room/iris_go/community.svg?color=cc2b5e&logo=gitter&style=for-the-badge)](https://gitter.im/iris_go/community) [![donate](https://img.shields.io/badge/support-Iris-blue.svg?style=for-the-badge&logo=paypal)](https://iris-go.com/donate) +[![build status](https://img.shields.io/github/actions/workflow/status/kataras/iris/ci.yml?branch=main&style=for-the-badge)](https://github.com/kataras/iris/actions/workflows/ci.yml) [![view examples](https://img.shields.io/badge/examples%20-253-a83adf.svg?style=for-the-badge&logo=go)](https://github.com/kataras/iris/tree/main/_examples) [![chat](https://img.shields.io/gitter/room/iris_go/community.svg?color=cc2b5e&logo=gitter&style=for-the-badge)](https://gitter.im/iris_go/community) [![donate](https://img.shields.io/badge/support-Iris-blue.svg?style=for-the-badge&logo=paypal)](https://iris-go.com/donate) diff --git a/README_ZH_HANT.md b/README_ZH_HANT.md index 52f2387439..3c9aded282 100644 --- a/README_ZH_HANT.md +++ b/README_ZH_HANT.md @@ -12,7 +12,7 @@ # Iris Web 框架 -[![組建狀態](https://img.shields.io/github/actions/workflow/status/kataras/iris/ci.yml?branch=main&style=for-the-badge)](https://github.com/kataras/iris/actions/workflows/ci.yml) [![查看範例](https://img.shields.io/badge/examples%20-285-a83adf.svg?style=for-the-badge&logo=go)](https://github.com/kataras/iris/tree/main/_examples) [![聊天室](https://img.shields.io/gitter/room/iris_go/community.svg?color=cc2b5e&logo=gitter&style=for-the-badge)](https://gitter.im/iris_go/community) [![捐助](https://img.shields.io/badge/support-Iris-blue.svg?style=for-the-badge&logo=paypal)](https://iris-go.com/donate) +[![組建狀態](https://img.shields.io/github/actions/workflow/status/kataras/iris/ci.yml?branch=main&style=for-the-badge)](https://github.com/kataras/iris/actions/workflows/ci.yml) [![查看範例](https://img.shields.io/badge/examples%20-285-a83adf.svg?style=for-the-badge&logo=go)](https://github.com/kataras/iris/tree/main/_examples) [![聊天室](https://img.shields.io/gitter/room/iris_go/community.svg?color=cc2b5e&logo=gitter&style=for-the-badge)](https://gitter.im/iris_go/community) [![捐助](https://img.shields.io/badge/support-Iris-blue.svg?style=for-the-badge&logo=paypal)](https://iris-go.com/donate) @@ -237,7 +237,7 @@ Iris 提供了至少這些功能: $ mkdir myapp $ cd myapp $ go mod init myapp -$ go get github.com/kataras/iris/v12@latest # 或 @v12.2.9 +$ go get github.com/kataras/iris/v12@latest # 或 @v ```
在現有專案安裝 diff --git a/_examples/file-server/embedding-files-into-app-bindata/main_test.go b/_examples/file-server/embedding-files-into-app-bindata/main_test.go index fc546e557f..03e32d338a 100644 --- a/_examples/file-server/embedding-files-into-app-bindata/main_test.go +++ b/_examples/file-server/embedding-files-into-app-bindata/main_test.go @@ -50,11 +50,11 @@ func (r resource) loadFromBase(dir string) string { } result := string(b) - if runtime.GOOS != "windows" { result = strings.ReplaceAll(result, "\n", "\r\n") result = strings.ReplaceAll(result, "\r\r", "") } + return result } diff --git a/_examples/file-server/embedding-files-into-app/assets/favicon.ico b/_examples/file-server/embedding-files-into-app/assets/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..c370da518ec542579b7cc0d5d30f4778b4a96318 GIT binary patch literal 15086 zcmeHOd2p50760;HNB{!~AhNgwD|W0M6=&Sqp@rI3TCD}AT5D@d+Zj9R*hO1s+FA`T z9a|JFi=v_+0>XO%S(L2^%A#S>B7{987$_lO&Gx>x<-K?M`LT>nUnjy z``vrax#ym9?z!iFF^oLJX_S;0sD~I2<{QRMhG7gDV*PfZeHPk=4U7K1(lBo8Zx~mh z4_;w})sD(A(C=IqPkFx6<8s{RSzwF@lqt9!sPoD^^YNR&XP4u5c)lL*9e`MAnQj!A zZ(q7R@X2Em*gZ}Hm46fO%CCrb)in~>@h1iE>TAVZItcAo*Lz&fhg;t?@;$CR#nCvy zDDb{}%kqf#sIY|U-WLCspG)}kRtX(ltiWgg=ATJ$-!tOdG^Ppkf8=o&7#_F7XdhoE zkzlj?*Z^I##7#{oxZO@+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R|Dg{`0A0Tv`=%b-CH^@t-l>5ObnSXn2ybByg^J2`y invalid + // localhost -> invalid + // sub.mydomain.com -> valid + // sub.localhost -> valid + // we need the host (without port if 80 or 443) in order to validate these, so: + app.setVHost(netutil.ResolveVHost(srv.Addr)) + } else { + context.GetDomain = func(_ string) string { // #1886 + return app.config.VHost // GetVHost: here we don't need mutex protection as it's request-time and all modifications are already made. + } + } // before lock. + app.mu.Lock() defer app.mu.Unlock() @@ -551,21 +579,6 @@ func (app *Application) NewHost(srv *http.Server) *host.Supervisor { // create the new host supervisor // bind the constructed server and return it su := host.New(srv) - - if app.config.GetVHost() == "" { // vhost now is useful for router subdomain on wildcard subdomains, - // in order to correct decide what to do on: - // mydomain.com -> invalid - // localhost -> invalid - // sub.mydomain.com -> valid - // sub.localhost -> valid - // we need the host (without port if 80 or 443) in order to validate these, so: - app.config.SetVHost(netutil.ResolveVHost(srv.Addr)) - } else { - context.GetDomain = func(_ string) string { // #1886 - return app.config.VHost // GetVHost: here we don't need mutex protection as it's request-time and all modifications are already made. - } - } - // app.logger.Debugf("Host: virtual host is %s", app.config.VHost) // the below schedules some tasks that will run among the server @@ -1142,7 +1155,7 @@ func (app *Application) tryConnect(ctx stdContext.Context, maxRetries int, retry // Context is canceled, return the context error. return ctx.Err() default: - address := app.config.GetVHost() // Get this server's listening address. + address := app.getVHost() // Get this server's listening address. if address == "" { i-- // Note that this may be modified at another go routine of the serve method. So it may be empty at first chance. So retry fetching the VHost every 1 second. time.Sleep(time.Second) @@ -1200,7 +1213,7 @@ func (app *Application) tryStartTunneling() { publicAddr := publicAddrs[0] // to make subdomains resolution still based on this new remote, public addresses. - app.config.SetVHost(publicAddr[strings.Index(publicAddr, "://")+3:]) + app.setVHost(publicAddr[strings.Index(publicAddr, "://")+3:]) directLog := []byte(fmt.Sprintf("• Public Address: %s\n", publicAddr)) app.logger.Printer.Write(directLog) // nolint:errcheck