GNU bug report logs - #70308
[PATCH] guix: http tests: Log bad requests.

Previous Next

Package: guix-patches;

Reported by: Nicolas Graves <ngraves <at> ngraves.fr>

Date: Tue, 9 Apr 2024 11:08:01 UTC

Severity: normal

Tags: patch

Done: Nicolas Graves <ngraves <at> ngraves.fr>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 70308 in the body.
You can then email your comments to 70308 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#70308; Package guix-patches. (Tue, 09 Apr 2024 11:08:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Nicolas Graves <ngraves <at> ngraves.fr>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Tue, 09 Apr 2024 11:08:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Nicolas Graves <ngraves <at> ngraves.fr>
To: guix-patches <at> gnu.org
Cc: ngraves <at> ngraves.fr
Subject: [PATCH] guix: http tests: Log bad requests.
Date: Tue,  9 Apr 2024 13:06:32 +0200
* guix/test/http.scm (call-with-http-server): Log bad requests to make
debugging easier.

Change-Id: I2bb7231db1e5cd9a6e1c4cf76d256fa7c9e50776
---
 guix/tests/http.scm | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/guix/tests/http.scm b/guix/tests/http.scm
index 17485df9ef..e02f91923c 100644
--- a/guix/tests/http.scm
+++ b/guix/tests/http.scm
@@ -132,8 +132,10 @@ (define-server-impl stub-http-server
     http-write
     (@@ (web server http) http-close))
 
-  (define bad-request
-    (build-response #:code 400 #:reason-phrase "Unexpected request"))
+  (define (bad-request req)
+    (build-response
+     #:code 400
+     #:reason-phrase (string-append "Unexpected request: " req)))
 
   (define (server-body)
     (define (handle request body)
@@ -144,7 +146,7 @@ (define (handle request body)
         ((((? string?) response data) ...)
          (let ((path (uri-path (request-uri request))))
            (match (assoc path responses)
-             (#f (values bad-request ""))
+             (#f (values (bad-request path) ""))
              ((_ response data)
               (if (eq? 'GET (request-method request))
                   ;; Note: Use 'assoc-remove!' to remove only the first entry
@@ -153,7 +155,7 @@ (define (handle request body)
                   (let ((rest (assoc-remove! responses path)))
                     (set! responses rest)
                     (values response data))
-                  (values bad-request ""))))))))
+                  (values (bad-request path) ""))))))))
 
     (let-values (((socket port) (open-http-server-socket)))
       (set! %http-real-server-port port)
-- 
2.41.0





bug closed, send any further explanations to 70308 <at> debbugs.gnu.org and Nicolas Graves <ngraves <at> ngraves.fr> Request was from Nicolas Graves <ngraves <at> ngraves.fr> to control <at> debbugs.gnu.org. (Tue, 09 Apr 2024 11:16:01 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 07 May 2024 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 8 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.