From a1f6c0f4fe4fc0bf9c8f7eb5081481e217ed73d7 Mon Sep 17 00:00:00 2001 From: Sec32fun32 <175652414+Sec32fun32@users.noreply.github.com> Date: Tue, 5 Nov 2024 12:45:33 -0900 Subject: [PATCH] Revert "chore: bump deps and misc improvements (#1135)" This reverts commit 75dab8f33db98c10735f2fba8dd30fba0607ee9f. --- CONTRIBUTING.md | 2 +- caddy/go.mod | 2 +- caddy/go.sum | 4 +- caddy/php-server.go | 4 +- cgi.go | 86 ++++++++++++++++++++--------------------- docs/cn/README.md | 2 +- docs/cn/known-issues.md | 4 +- docs/compile.md | 2 +- docs/fr/README.md | 2 +- docs/fr/docker.md | 2 +- docs/fr/known-issues.md | 9 +++-- docs/known-issues.md | 1 + docs/tr/README.md | 28 +++++++------- docs/tr/docker.md | 2 +- docs/tr/production.md | 4 +- frankenphp.go | 2 +- frankenphp_test.go | 10 ++--- go.mod | 2 +- go.sum | 4 +- recorder_test.go | 2 +- request_options.go | 2 +- testdata/load-test.js | 2 +- worker.go | 2 +- worker_test.go | 8 ++-- 24 files changed, 94 insertions(+), 94 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8d703002c4..b36ae3a877 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -209,7 +209,7 @@ follow these steps: 1. Create a new directory named with the language's 2-character ISO code in this repository's `docs/` directory 2. Copy all the `.md` files in the root of the `docs/` directory into the new directory (always use the English version as source for translation, as it's always up to date) 3. Copy the `README.md` and `CONTRIBUTING.md` files from the root directory to the new directory -4. Translate the content of the files, but don't change the filenames, also don't translate strings starting with `> [!` (it's special markup for GitHub) +4. Translate the content of the files, but don't change the filenames, also don't translates strings starting with `> [!` (it's special markup for GitHub) 5. Create a Pull Request with the translations 6. In the [site repository](https://github.com/dunglas/frankenphp-website/tree/main), copy and translate the translation files in the `content/`, `data/` and `i18n/` directories 7. Translate the values in the created YAML file diff --git a/caddy/go.mod b/caddy/go.mod index d0caea8b3c..0bb37e9b94 100644 --- a/caddy/go.mod +++ b/caddy/go.mod @@ -124,7 +124,7 @@ require ( github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.60.1 // indirect + github.com/prometheus/common v0.60.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect github.com/quic-go/qpack v0.5.1 // indirect github.com/quic-go/quic-go v0.48.0 // indirect diff --git a/caddy/go.sum b/caddy/go.sum index 32c5e85f5c..3a43b70ff0 100644 --- a/caddy/go.sum +++ b/caddy/go.sum @@ -345,8 +345,8 @@ github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+ github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= -github.com/prometheus/common v0.60.1 h1:FUas6GcOw66yB/73KC+BOZoFJmbo/1pojoILArPAaSc= -github.com/prometheus/common v0.60.1/go.mod h1:h0LYf1R1deLSKtD4Vdg8gy4RuOvENW2J/h19V5NADQw= +github.com/prometheus/common v0.60.0 h1:+V9PAREWNvJMAuJ1x1BaWl9dewMW4YrHZQbx0sJNllA= +github.com/prometheus/common v0.60.0/go.mod h1:h0LYf1R1deLSKtD4Vdg8gy4RuOvENW2J/h19V5NADQw= github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= github.com/quic-go/qpack v0.5.1 h1:giqksBPnT/HDtZ6VhtFKgoLOWmlyo9Ei6u9PqzIMbhI= diff --git a/caddy/php-server.go b/caddy/php-server.go index e2e4eabdcf..a4aa0b9f6a 100644 --- a/caddy/php-server.go +++ b/caddy/php-server.go @@ -316,12 +316,12 @@ func cmdPHPServer(fs caddycmd.Flags) (int, error) { Servers: map[string]*caddyhttp.Server{"php": server}, } - var f bool + var false bool cfg := &caddy.Config{ Admin: &caddy.AdminConfig{ Disabled: true, Config: &caddy.ConfigSettings{ - Persist: &f, + Persist: &false, }, }, AppsRaw: caddy.ModuleMap{ diff --git a/cgi.go b/cgi.go index e9bb736ad5..3b51b6985f 100644 --- a/cgi.go +++ b/cgi.go @@ -45,7 +45,7 @@ var knownServerKeys = map[string]struct{}{ // // TODO: handle this case https://github.com/caddyserver/caddy/issues/3718 // Inspired by https://github.com/caddyserver/caddy/blob/master/modules/caddyhttp/reverseproxy/fastcgi/fastcgi.go -func addKnownVariablesToServer(thread *phpThread, request *http.Request, fc *FrankenPHPContext, trackVarsArray *C.zval) { +func addKnownVariablesToServer(thread *phpThread, request *http.Request, fc *FrankenPHPContext, track_vars_array *C.zval) { keys := getKnownVariableKeys(thread) // Separate remote IP and port; more lenient than net.SplitHostPort var ip, port string @@ -62,56 +62,56 @@ func addKnownVariablesToServer(thread *phpThread, request *http.Request, fc *Fra ra, raOK := fc.env["REMOTE_ADDR\x00"] if raOK { - registerTrustedVar(keys["REMOTE_ADDR\x00"], ra, trackVarsArray, thread) + registerTrustedVar(keys["REMOTE_ADDR\x00"], ra, track_vars_array, thread) } else { - registerTrustedVar(keys["REMOTE_ADDR\x00"], ip, trackVarsArray, thread) + registerTrustedVar(keys["REMOTE_ADDR\x00"], ip, track_vars_array, thread) } if rh, ok := fc.env["REMOTE_HOST\x00"]; ok { - registerTrustedVar(keys["REMOTE_HOST\x00"], rh, trackVarsArray, thread) // For speed, remote host lookups disabled + registerTrustedVar(keys["REMOTE_HOST\x00"], rh, track_vars_array, thread) // For speed, remote host lookups disabled } else { if raOK { - registerTrustedVar(keys["REMOTE_HOST\x00"], ra, trackVarsArray, thread) + registerTrustedVar(keys["REMOTE_HOST\x00"], ra, track_vars_array, thread) } else { - registerTrustedVar(keys["REMOTE_HOST\x00"], ip, trackVarsArray, thread) + registerTrustedVar(keys["REMOTE_HOST\x00"], ip, track_vars_array, thread) } } - registerTrustedVar(keys["REMOTE_PORT\x00"], port, trackVarsArray, thread) - registerTrustedVar(keys["DOCUMENT_ROOT\x00"], fc.documentRoot, trackVarsArray, thread) - registerTrustedVar(keys["PATH_INFO\x00"], fc.pathInfo, trackVarsArray, thread) - registerTrustedVar(keys["PHP_SELF\x00"], request.URL.Path, trackVarsArray, thread) - registerTrustedVar(keys["DOCUMENT_URI\x00"], fc.docURI, trackVarsArray, thread) - registerTrustedVar(keys["SCRIPT_FILENAME\x00"], fc.scriptFilename, trackVarsArray, thread) - registerTrustedVar(keys["SCRIPT_NAME\x00"], fc.scriptName, trackVarsArray, thread) + registerTrustedVar(keys["REMOTE_PORT\x00"], port, track_vars_array, thread) + registerTrustedVar(keys["DOCUMENT_ROOT\x00"], fc.documentRoot, track_vars_array, thread) + registerTrustedVar(keys["PATH_INFO\x00"], fc.pathInfo, track_vars_array, thread) + registerTrustedVar(keys["PHP_SELF\x00"], request.URL.Path, track_vars_array, thread) + registerTrustedVar(keys["DOCUMENT_URI\x00"], fc.docURI, track_vars_array, thread) + registerTrustedVar(keys["SCRIPT_FILENAME\x00"], fc.scriptFilename, track_vars_array, thread) + registerTrustedVar(keys["SCRIPT_NAME\x00"], fc.scriptName, track_vars_array, thread) var rs string if request.TLS == nil { rs = "http" - registerTrustedVar(keys["HTTPS\x00"], "", trackVarsArray, thread) - registerTrustedVar(keys["SSL_PROTOCOL\x00"], "", trackVarsArray, thread) + registerTrustedVar(keys["HTTPS\x00"], "", track_vars_array, thread) + registerTrustedVar(keys["SSL_PROTOCOL\x00"], "", track_vars_array, thread) } else { rs = "https" if h, ok := fc.env["HTTPS\x00"]; ok { - registerTrustedVar(keys["HTTPS\x00"], h, trackVarsArray, thread) + registerTrustedVar(keys["HTTPS\x00"], h, track_vars_array, thread) } else { - registerTrustedVar(keys["HTTPS\x00"], "on", trackVarsArray, thread) + registerTrustedVar(keys["HTTPS\x00"], "on", track_vars_array, thread) } // and pass the protocol details in a manner compatible with apache's mod_ssl - // (which is why these have an SSL_ prefix and not TLS_). + // (which is why these have a SSL_ prefix and not TLS_). if pr, ok := fc.env["SSL_PROTOCOL\x00"]; ok { - registerTrustedVar(keys["SSL_PROTOCOL\x00"], pr, trackVarsArray, thread) + registerTrustedVar(keys["SSL_PROTOCOL\x00"], pr, track_vars_array, thread) } else { if v, ok := tlsProtocolStrings[request.TLS.Version]; ok { - registerTrustedVar(keys["SSL_PROTOCOL\x00"], v, trackVarsArray, thread) + registerTrustedVar(keys["SSL_PROTOCOL\x00"], v, track_vars_array, thread) } else { - registerTrustedVar(keys["SSL_PROTOCOL\x00"], "", trackVarsArray, thread) + registerTrustedVar(keys["SSL_PROTOCOL\x00"], "", track_vars_array, thread) } } } - registerTrustedVar(keys["REQUEST_SCHEME\x00"], rs, trackVarsArray, thread) + registerTrustedVar(keys["REQUEST_SCHEME\x00"], rs, track_vars_array, thread) reqHost, reqPort, _ := net.SplitHostPort(request.Host) if reqHost == "" { @@ -132,11 +132,11 @@ func addKnownVariablesToServer(thread *phpThread, request *http.Request, fc *Fra } } - registerTrustedVar(keys["SERVER_NAME\x00"], reqHost, trackVarsArray, thread) + registerTrustedVar(keys["SERVER_NAME\x00"], reqHost, track_vars_array, thread) if reqPort != "" { - registerTrustedVar(keys["SERVER_PORT\x00"], reqPort, trackVarsArray, thread) + registerTrustedVar(keys["SERVER_PORT\x00"], reqPort, track_vars_array, thread) } else { - registerTrustedVar(keys["SERVER_PORT\x00"], "", trackVarsArray, thread) + registerTrustedVar(keys["SERVER_PORT\x00"], "", track_vars_array, thread) } // Variables defined in CGI 1.1 spec @@ -144,19 +144,19 @@ func addKnownVariablesToServer(thread *phpThread, request *http.Request, fc *Fra // the parent environment from interfering. // These values can not be overridden - registerTrustedVar(keys["CONTENT_LENGTH\x00"], request.Header.Get("Content-Length"), trackVarsArray, thread) - registerTrustedVar(keys["GATEWAY_INTERFACE\x00"], "CGI/1.1", trackVarsArray, thread) - registerTrustedVar(keys["SERVER_PROTOCOL\x00"], request.Proto, trackVarsArray, thread) - registerTrustedVar(keys["SERVER_SOFTWARE\x00"], "FrankenPHP", trackVarsArray, thread) - registerTrustedVar(keys["HTTP_HOST\x00"], request.Host, trackVarsArray, thread) // added here, since not always part of headers + registerTrustedVar(keys["CONTENT_LENGTH\x00"], request.Header.Get("Content-Length"), track_vars_array, thread) + registerTrustedVar(keys["GATEWAY_INTERFACE\x00"], "CGI/1.1", track_vars_array, thread) + registerTrustedVar(keys["SERVER_PROTOCOL\x00"], request.Proto, track_vars_array, thread) + registerTrustedVar(keys["SERVER_SOFTWARE\x00"], "FrankenPHP", track_vars_array, thread) + registerTrustedVar(keys["HTTP_HOST\x00"], request.Host, track_vars_array, thread) // added here, since not always part of headers // These values are always empty but must be defined: - registerTrustedVar(keys["AUTH_TYPE\x00"], "", trackVarsArray, thread) - registerTrustedVar(keys["REMOTE_IDENT\x00"], "", trackVarsArray, thread) + registerTrustedVar(keys["AUTH_TYPE\x00"], "", track_vars_array, thread) + registerTrustedVar(keys["REMOTE_IDENT\x00"], "", track_vars_array, thread) // These values are already present in the SG(request_info), so we'll register them from there C.frankenphp_register_variables_from_request_info( - trackVarsArray, + track_vars_array, keys["CONTENT_TYPE\x00"], keys["PATH_TRANSLATED\x00"], keys["QUERY_STRING\x00"], @@ -166,11 +166,11 @@ func addKnownVariablesToServer(thread *phpThread, request *http.Request, fc *Fra ) } -func registerTrustedVar(key *C.zend_string, value string, trackVarsArray *C.zval, thread *phpThread) { - C.frankenphp_register_trusted_var(key, thread.pinString(value), C.int(len(value)), trackVarsArray) +func registerTrustedVar(key *C.zend_string, value string, track_vars_array *C.zval, thread *phpThread) { + C.frankenphp_register_trusted_var(key, thread.pinString(value), C.int(len(value)), track_vars_array) } -func addHeadersToServer(thread *phpThread, request *http.Request, fc *FrankenPHPContext, trackVarsArray *C.zval) { +func addHeadersToServer(thread *phpThread, request *http.Request, fc *FrankenPHPContext, track_vars_array *C.zval) { for field, val := range request.Header { k, ok := headerKeyCache.Get(field) if !ok { @@ -183,13 +183,13 @@ func addHeadersToServer(thread *phpThread, request *http.Request, fc *FrankenPHP } v := strings.Join(val, ", ") - C.frankenphp_register_variable_safe(thread.pinString(k), thread.pinString(v), C.size_t(len(v)), trackVarsArray) + C.frankenphp_register_variable_safe(thread.pinString(k), thread.pinString(v), C.size_t(len(v)), track_vars_array) } } -func addPreparedEnvToServer(thread *phpThread, fc *FrankenPHPContext, trackVarsArray *C.zval) { +func addPreparedEnvToServer(thread *phpThread, fc *FrankenPHPContext, track_vars_array *C.zval) { for k, v := range fc.env { - C.frankenphp_register_variable_safe(thread.pinString(k), thread.pinString(v), C.size_t(len(v)), trackVarsArray) + C.frankenphp_register_variable_safe(thread.pinString(k), thread.pinString(v), C.size_t(len(v)), track_vars_array) } fc.env = nil } @@ -199,7 +199,7 @@ func getKnownVariableKeys(thread *phpThread) map[string]*C.zend_string { return thread.knownVariableKeys } threadServerKeys := make(map[string]*C.zend_string) - for k := range knownServerKeys { + for k, _ := range knownServerKeys { keyWithoutNull := strings.Replace(k, "\x00", "", -1) threadServerKeys[k] = C.frankenphp_init_persistent_string(thread.pinString(keyWithoutNull), C.size_t(len(keyWithoutNull))) } @@ -219,8 +219,8 @@ func go_register_variables(threadIndex C.uintptr_t, trackVarsArray *C.zval) { } //export go_frankenphp_release_known_variable_keys -func go_frankenphp_release_known_variable_keys(threadIndex C.uintptr_t) { - thread := phpThreads[threadIndex] +func go_frankenphp_release_known_variable_keys(thread_index C.uintptr_t) { + thread := phpThreads[thread_index] if thread.knownVariableKeys == nil { return } @@ -280,7 +280,7 @@ func sanitizedPathJoin(root, reqPath string) string { path := filepath.Join(root, filepath.Clean("/"+reqPath)) // filepath.Join also cleans the path, and cleaning strips - // the trailing slash, so we need to re-add it afterward. + // the trailing slash, so we need to re-add it afterwards. // if the length is 1, then it's a path to the root, // and that should return ".", so we don't append the separator. if strings.HasSuffix(reqPath, "/") && len(reqPath) > 1 { diff --git a/docs/cn/README.md b/docs/cn/README.md index 3228eaf7c0..012b875524 100644 --- a/docs/cn/README.md +++ b/docs/cn/README.md @@ -1,6 +1,6 @@ # FrankenPHP: 适用于 PHP 的现代应用服务器 -

FrankenPHP

+

FrankenPHP

FrankenPHP 是建立在 [Caddy](https://caddyserver.com/) Web 服务器之上的现代 PHP 应用程序服务器。 diff --git a/docs/cn/known-issues.md b/docs/cn/known-issues.md index 3bdcc1c92d..ccd5a700b1 100644 --- a/docs/cn/known-issues.md +++ b/docs/cn/known-issues.md @@ -34,8 +34,8 @@ $fiber->resume(); 已知以下扩展与 FrankenPHP 不兼容: -| 名称 | 原因 | 替代方案 | -|-------------------------------------------------------------|-------|----------------------------------------------------------------------------------------------------------------------| +| 名称 | 原因 | 替代方案 | +| ----------------------------------------------------------- | --------------- |----------------------------------------------------------------------------------------------------------------------| | [imap](https://www.php.net/manual/en/imap.installation.php) | 非线程安全 | [javanile/php-imap2](https://github.com/javanile/php-imap2), [webklex/php-imap](https://github.com/Webklex/php-imap) | ## get_browser diff --git a/docs/compile.md b/docs/compile.md index 001f2ba2ac..696326f845 100644 --- a/docs/compile.md +++ b/docs/compile.md @@ -17,7 +17,7 @@ cd php-*/ ``` Then, run the `configure` script with the options needed for your platform. -The following `./configure` flags are mandatory, but you can add others, for example to compile extensions or additional features. +Th following `./configure` flags are mandatory, but you can add others, for example to compile extensions or additional features. ### Linux diff --git a/docs/fr/README.md b/docs/fr/README.md index 0fd709c519..74180480c4 100644 --- a/docs/fr/README.md +++ b/docs/fr/README.md @@ -29,7 +29,7 @@ Rendez-vous sur `https://localhost`, c'est parti ! > [!TIP] > > Ne tentez pas d'utiliser `https://127.0.0.1`. Utilisez `https://localhost` et acceptez le certificat auto-signé. -> Utilisez [la variable d'environnement `SERVER_NAME`](config.md#variables-denvironnement) pour changer le domaine à utiliser. +> Utilisez [la variable d'environnement `SERVER_NAME`](config.md#environment-variables) pour changer le domaine à utiliser. ### Binaire autonome diff --git a/docs/fr/docker.md b/docs/fr/docker.md index fa76c7ac2a..187924ee5a 100644 --- a/docs/fr/docker.md +++ b/docs/fr/docker.md @@ -74,7 +74,7 @@ L'image builder fournie par FrankenPHP contient une version compilée de `libphp > [!TIP] > > Si vous utilisez Alpine Linux et Symfony, -> vous devrez peut-être [augmenter la taille de pile par défaut](compile.md#utiliser-xcaddy). +> vous devrez peut-être [augmenter la taille de pile par défaut](compile.md#using-xcaddy). ## Activer le mode Worker par défaut diff --git a/docs/fr/known-issues.md b/docs/fr/known-issues.md index ddf4ac4ec7..4d347d639b 100644 --- a/docs/fr/known-issues.md +++ b/docs/fr/known-issues.md @@ -34,10 +34,10 @@ $fiber->resume(); Les extensions suivantes sont connues pour ne pas être compatibles avec FrankenPHP : -| Nom | Raison | Alternatives | -|-------------------------------------------------------------------------------------------------------------|-----------------|----------------------------------------------------------------------------------------------------------------------| -| [imap](https://www.php.net/manual/en/imap.installation.php) | Non thread-safe | [javanile/php-imap2](https://github.com/javanile/php-imap2), [webklex/php-imap](https://github.com/Webklex/php-imap) | -| [newrelic](https://docs.newrelic.com/docs/apm/agents/php-agent/getting-started/introduction-new-relic-php/) | Non thread-safe | - | +| Nom | Raison | Alternatives | +| ---------------------------------------------------------------------------------------------------------- | --------------- | -------------------------------------------------------------------------------------------------------------------- | +| [imap](https://www.php.net/manual/en/imap.installation.php) | Non thread-safe | [javanile/php-imap2](https://github.com/javanile/php-imap2), [webklex/php-imap](https://github.com/Webklex/php-imap) | +| [newrelic](https://docs.newrelic.com/docs/apm/agents/php-agent/getting-started/introduction-new-relic-php/)| Non thread-safe | - | ## Extensions PHP boguées @@ -46,6 +46,7 @@ Les extensions suivantes ont des bugs connus ou des comportements inattendus lor | Nom | Problème | |---------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [ext-openssl](https://www.php.net/manual/fr/book.openssl.php) | Lors de l'utilisation d'une version statique de FrankenPHP (construite avec la libc musl), l'extension OpenSSL peut planter sous de fortes charges. Une solution consiste à utiliser une version liée dynamiquement (comme celle utilisée dans les images Docker). Ce bogue est [suivi par PHP](https://github.com/php/php-src/issues/13648). | +| [parallel](https://github.com/krakjoe/parallel) | `parallel` fait geler et planter FrankenPHP. [Rapport de bogue](https://github.com/krakjoe/parallel/issues/308) | ## get_browser diff --git a/docs/known-issues.md b/docs/known-issues.md index 9daed33d81..35ead2f620 100644 --- a/docs/known-issues.md +++ b/docs/known-issues.md @@ -46,6 +46,7 @@ The following extensions have known bugs and unexpected behaviors when used with | Name | Problem | |---------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [ext-openssl](https://www.php.net/manual/en/book.openssl.php) | When using a static build of FrankenPHP (built with the musl libc), the OpenSSL extension may crash under heavy loads. A workaround is to use a dynamically linked build (like the one used in Docker images). This bug is [being tracked by PHP](https://github.com/php/php-src/issues/13648). | +| [parallel](https://github.com/krakjoe/parallel) | `parallel` makes FrankenPHP freeze and crash. [Bug report](https://github.com/krakjoe/parallel/issues/308) | ## get_browser diff --git a/docs/tr/README.md b/docs/tr/README.md index 483bbc41fa..ed15bdf230 100644 --- a/docs/tr/README.md +++ b/docs/tr/README.md @@ -1,6 +1,6 @@ # FrankenPHP: PHP için Modern Uygulama Sunucusu -

FrankenPHP

+

FrankenPHP

FrankenPHP, [Caddy](https://caddyserver.com/) web sunucusunun üzerine inşa edilmiş PHP için modern bir uygulama sunucusudur. @@ -29,7 +29,7 @@ docker run -v $PWD:/app/public \ > [!TIP] > > `https://127.0.0.1` kullanmaya çalışmayın. `https://localhost` kullanın ve kendinden imzalı sertifikayı kabul edin. -> Kullanılacak alan adını değiştirmek için [`SERVER_NAME` ortam değişkenini](https://frankenphp.dev/tr/docs/config#ortam-değişkenleri) kullanın. +> Kullanılacak alan adını değiştirmek için [`SERVER_NAME` ortam değişkenini](docs/config.md#environment-variables) kullanın. ### Binary Çıktısı @@ -50,20 +50,20 @@ Ayrıca aşağıdaki tek komut satırı ile de çalıştırabilirsiniz: ## Docs -* [Worker modu](worker.md) -* [Early Hints desteği (103 HTTP durum kodu)](early-hints.md) -* [Real-time](mercure.md) -* [Konfigürasyon](config.md) -* [Docker imajları](docker.md) -* [Production'a dağıtım](production.md) -* [**Bağımsız** kendiliğinden çalıştırılabilir PHP uygulamaları oluşturma](embed.md) -* [Statik binary'leri oluşturma](static.md) -* [Kaynak dosyalarından derleme](config.md) -* [Laravel entegrasyonu](laravel.md) -* [Bilinen sorunlar](known-issues.md) +* [Worker modu](https://frankenphp.dev/docs/worker/) +* [Early Hints desteği (103 HTTP durum kodu)](https://frankenphp.dev/docs/early-hints/) +* [Real-time](https://frankenphp.dev/docs/mercure/) +* [Konfigürasyon](https://frankenphp.dev/docs/config/) +* [Docker imajları](https://frankenphp.dev/docs/docker/) +* [Production'a dağıtım](docs/production.md) +* [**Bağımsız** kendiliğinden çalıştırılabilir PHP uygulamaları oluşturma](https://frankenphp.dev/docs/embed/) +* [Statik binary'leri oluşturma](https://frankenphp.dev/docs/static/) +* [Kaynak dosyalarından derleme](https://frankenphp.dev/docs/compile/) +* [Laravel entegrasyonu](https://frankenphp.dev/docs/laravel/) +* [Bilinen sorunlar](https://frankenphp.dev/docs/known-issues/) * [Demo uygulama (Symfony) ve kıyaslamalar](https://github.com/dunglas/frankenphp-demo) * [Go kütüphane dokümantasonu](https://pkg.go.dev/github.com/dunglas/frankenphp) -* [Katkıda bulunma ve hata ayıklama](CONTRIBUTING.md) +* [Katkıda bulunma ve hata ayıklama](https://frankenphp.dev/docs/contributing/) ## Örnekler ve İskeletler diff --git a/docs/tr/docker.md b/docs/tr/docker.md index c7582862ac..b6e0d4553e 100644 --- a/docs/tr/docker.md +++ b/docs/tr/docker.md @@ -75,7 +75,7 @@ FrankenPHP tarafından sağlanan `builder` imajı `libphp`'nin derlenmiş bir s > [!TIP] > > Eğer Alpine Linux ve Symfony kullanıyorsanız, -> [varsayılan yığın boyutunu artırmanız](compile.md#xcaddy-kullanımı) gerekebilir. +> [varsayılan yığın boyutunu artırmanız](compile.md#using-xcaddy) gerekebilir. ## Varsayılan Olarak Worker Modunun Etkinleştirilmesi diff --git a/docs/tr/production.md b/docs/tr/production.md index 14733d7901..64821a5784 100644 --- a/docs/tr/production.md +++ b/docs/tr/production.md @@ -76,7 +76,7 @@ Bu, Docker ve Docker Compose'un en son sürümlerinin zaten yüklü olduğu bir Test amaçlı kullanım için en ucuz planlar yeterli olacaktır. Gerçek production kullanımı için, muhtemelen ihtiyaçlarınıza uyacak şekilde "genel amaçlı" bölümünden bir plan seçmek isteyeceksiniz. -![Docker ile DigitalOcean FrankenPHP](../digitalocean-droplet.png) +![Docker ile DigitalOcean FrankenPHP](digitalocean-droplet.png) Diğer ayarlar için varsayılanları koruyabilir veya ihtiyaçlarınıza göre değiştirebilirsiniz. SSH anahtarınızı eklemeyi veya bir parola oluşturmayı unutmayın, ardından "Sonlandır ve oluştur" düğmesine basın. @@ -101,7 +101,7 @@ your-domain-name.example.com. IN A 207.154.233.113 DigitalOcean Alan Adları hizmetiyle ilgili örnek ("Networking" > "Domains"): -![DigitalOcean'da DNS Yapılandırma](../digitalocean-dns.png) +![DigitalOcean'da DNS Yapılandırma](digitalocean-dns.png) > [!NOTE] > diff --git a/frankenphp.go b/frankenphp.go index f7fad3ba62..fc522ca5d6 100644 --- a/frankenphp.go +++ b/frankenphp.go @@ -416,7 +416,7 @@ func updateServerContext(thread *phpThread, request *http.Request, create bool, var err error contentLength, err = strconv.Atoi(contentLengthStr) if err != nil || contentLength < 0 { - return fmt.Errorf("invalid Content-Length header: %w", err) + return fmt.Errorf("Invalid Content-Length header: %w", err) } } diff --git a/frankenphp_test.go b/frankenphp_test.go index 370c1b6ca3..68ed598272 100644 --- a/frankenphp_test.go +++ b/frankenphp_test.go @@ -7,7 +7,6 @@ package frankenphp_test import ( "bytes" "context" - "errors" "fmt" "io" "log" @@ -687,8 +686,7 @@ func TestExecuteScriptCLI(t *testing.T) { stdoutStderr, err := cmd.CombinedOutput() assert.Error(t, err) - var exitError *exec.ExitError - if errors.As(err, &exitError) { + if exitError, ok := err.(*exec.ExitError); ok { assert.Equal(t, 3, exitError.ExitCode()) } @@ -898,8 +896,8 @@ func TestRejectInvalidHeaders_worker(t *testing.T) { } func testRejectInvalidHeaders(t *testing.T, opts *testOptions) { invalidHeaders := [][]string{ - {"Content-Length", "-1"}, - {"Content-Length", "something"}, + []string{"Content-Length", "-1"}, + []string{"Content-Length", "something"}, } for _, header := range invalidHeaders { runTest(t, func(handler func(http.ResponseWriter, *http.Request), _ *httptest.Server, _ int) { @@ -913,7 +911,7 @@ func testRejectInvalidHeaders(t *testing.T, opts *testOptions) { body, _ := io.ReadAll(resp.Body) assert.Equal(t, 400, resp.StatusCode) - assert.Contains(t, string(body), "invalid") + assert.Contains(t, string(body), "Invalid") }, opts) } } diff --git a/go.mod b/go.mod index c555c4fcd2..5f44f77ec5 100644 --- a/go.mod +++ b/go.mod @@ -21,7 +21,7 @@ require ( github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.60.1 // indirect + github.com/prometheus/common v0.60.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect go.uber.org/multierr v1.11.0 // indirect diff --git a/go.sum b/go.sum index cdcd46ec0c..c1a6f45bd7 100644 --- a/go.sum +++ b/go.sum @@ -26,8 +26,8 @@ github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+ github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= -github.com/prometheus/common v0.60.1 h1:FUas6GcOw66yB/73KC+BOZoFJmbo/1pojoILArPAaSc= -github.com/prometheus/common v0.60.1/go.mod h1:h0LYf1R1deLSKtD4Vdg8gy4RuOvENW2J/h19V5NADQw= +github.com/prometheus/common v0.60.0 h1:+V9PAREWNvJMAuJ1x1BaWl9dewMW4YrHZQbx0sJNllA= +github.com/prometheus/common v0.60.0/go.mod h1:h0LYf1R1deLSKtD4Vdg8gy4RuOvENW2J/h19V5NADQw= github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= diff --git a/recorder_test.go b/recorder_test.go index f428ef91a3..4945b9d0a9 100644 --- a/recorder_test.go +++ b/recorder_test.go @@ -130,7 +130,7 @@ func (rw *ResponseRecorder) WriteString(str string) (int, error) { func checkWriteHeaderCode(code int) { // Issue 22880: require valid WriteHeader status codes. - // For now, we only enforce that it's three digits. + // For now we only enforce that it's three digits. // In the future we might block things over 599 (600 and above aren't defined // at https://httpwg.org/specs/rfc7231.html#status.codes) // and we might block under 200 (once we have more mature 1xx support). diff --git a/request_options.go b/request_options.go index d5f8345f63..9784f04724 100644 --- a/request_options.go +++ b/request_options.go @@ -37,7 +37,7 @@ func WithRequestDocumentRoot(documentRoot string, resolveSymlink bool) RequestOp } // WithRequestResolvedDocumentRoot is similar to WithRequestDocumentRoot -// but doesn't do any checks or resolving on the path to improve performance. +// but doesn't does any checks or resolving on the path to improve performance. func WithRequestResolvedDocumentRoot(documentRoot string) RequestOption { return func(o *FrankenPHPContext) error { o.documentRoot = documentRoot diff --git a/testdata/load-test.js b/testdata/load-test.js index e22836b183..5982824efa 100644 --- a/testdata/load-test.js +++ b/testdata/load-test.js @@ -41,7 +41,7 @@ export const options = { // options: { // browser: { // // This is a mandatory parameter that instructs k6 to launch and - // // connect to a Chromium-based browser, and use it to run UI-based + // // connect to a chromium-based browser, and use it to run UI-based // // tests. // type: 'chromium', // }, diff --git a/worker.go b/worker.go index da1dacc164..e2e2508344 100644 --- a/worker.go +++ b/worker.go @@ -68,7 +68,7 @@ func newWorker(o workerOpt) (*worker, error) { return nil, fmt.Errorf("worker filename is invalid %q: %w", o.fileName, err) } - // if the worker already exists, return it, + // if the worker already exists, return it // it's necessary since we don't want to destroy the channels when restarting on file changes if w, ok := workers[absFileName]; ok { return w, nil diff --git a/worker_test.go b/worker_test.go index b6df580f7e..b848cb490d 100644 --- a/worker_test.go +++ b/worker_test.go @@ -94,8 +94,8 @@ func TestWorkerEnv(t *testing.T) { } func TestWorkerGetOpt(t *testing.T) { - obs, logs := observer.New(zapcore.InfoLevel) - logger := zap.New(obs) + observer, logs := observer.New(zapcore.InfoLevel) + logger := zap.New(observer) runTest(t, func(handler func(http.ResponseWriter, *http.Request), _ *httptest.Server, i int) { req := httptest.NewRequest("GET", fmt.Sprintf("http://example.com/worker-getopt.php?i=%d", i), nil) @@ -111,8 +111,8 @@ func TestWorkerGetOpt(t *testing.T) { assert.Contains(t, string(body), fmt.Sprintf("[REQUEST_URI] => /worker-getopt.php?i=%d", i)) }, &testOptions{logger: logger, workerScript: "worker-getopt.php", env: map[string]string{"FOO": "bar"}}) - for _, l := range logs.FilterFieldKey("exit_status").All() { - assert.Failf(t, "unexpected exit status", "exit status: %d", l.ContextMap()["exit_status"]) + for _, log := range logs.FilterFieldKey("exit_status").All() { + assert.Failf(t, "unexpected exit status", "exit status: %d", log.ContextMap()["exit_status"]) } }