unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#57852] [PATCH] services: nginx: Don't emit empty fields
@ 2022-09-16  7:50 Simen Endsjø
  2022-09-26 21:21 ` bug#57852: " Ludovic Courtès
  0 siblings, 1 reply; 2+ messages in thread
From: Simen Endsjø @ 2022-09-16  7:50 UTC (permalink / raw)
  To: 57852

An empty root or index field is an error in nginx.

* gnu/services/web.scm (emit-nginx-server-config): Don't emit root or
index fields when they are empty
---
 gnu/services/web.scm | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/gnu/services/web.scm b/gnu/services/web.scm
index 5bac496f01..e347f5dbcc 100644
--- a/gnu/services/web.scm
+++ b/gnu/services/web.scm
@@ -14,6 +14,7 @@
 ;;; Copyright © 2020 Arun Isaac <arunisaac@systemreboot.net>
 ;;; Copyright © 2020 Oleg Pykhalov <go.wigust@gmail.com>
 ;;; Copyright © 2020, 2021 Alexandru-Sergiu Marton <brown121407@posteo.ro>
+;;; Copyright © 2022 Simen Endsjø <simendsjo@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -646,8 +647,12 @@ (define-syntax-rule (and/l x tail ...)
      "      server_name " (config-domain-strings server-name) ";\n"
      (and/l ssl-certificate     "      ssl_certificate " <> ";\n")
      (and/l ssl-certificate-key "      ssl_certificate_key " <> ";\n")
-     "      root " root ";\n"
-     "      index " (config-index-strings index) ";\n"
+     (if (not (equal? "" root))
+         (list "      root " root ";\n")
+         "")
+     (if (not (null? index))
+         (list "      index " (config-index-strings index) ";\n")
+         "")
      (if (not (nil? try-files))
          (and/l (config-index-strings try-files) "      try_files " <> ";\n")
          "")

base-commit: 02c5ed4f1bbd83bddd81902604af6f8add41ac54
-- 
2.37.3





^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#57852: [PATCH] services: nginx: Don't emit empty fields
  2022-09-16  7:50 [bug#57852] [PATCH] services: nginx: Don't emit empty fields Simen Endsjø
@ 2022-09-26 21:21 ` Ludovic Courtès
  0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2022-09-26 21:21 UTC (permalink / raw)
  To: Simen Endsjø; +Cc: 57852-done

Hi,

Simen Endsjø <simendsjo@gmail.com> skribis:

> An empty root or index field is an error in nginx.
>
> * gnu/services/web.scm (emit-nginx-server-config): Don't emit root or
> index fields when they are empty

Good catch.  Applied, thanks!

Ludo’.




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-09-26 21:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-16  7:50 [bug#57852] [PATCH] services: nginx: Don't emit empty fields Simen Endsjø
2022-09-26 21:21 ` bug#57852: " Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).