bug-mit-scheme
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #62580] read-http-request procedure is broken


From: Sam Lee
Subject: [bug #62580] read-http-request procedure is broken
Date: Sat, 4 Jun 2022 01:53:34 -0400 (EDT)

URL:
  <https://savannah.gnu.org/bugs/?62580>

                 Summary: read-http-request procedure is broken
                 Project: MIT/GNU Scheme
               Submitter: samlee
               Submitted: Sat 04 Jun 2022 05:53:32 AM UTC
                Category: runtime
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect behavior
                  Status: None
                 Privacy: Public
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                Keywords: 


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Sat 04 Jun 2022 05:53:32 AM UTC By: Sam Lee <samlee>
(let* ((socket (open-tcp-server-socket 8000))
       (port (tcp-server-connection-accept socket #t #f))
       (request (read-http-request port)))
  (display request))

When I run the code above and access localhost:8000 using a web browser, the
`read-http-request` procedure will fail with:

;The object #[textual-i/o-port 12 for channel: #[channel 13]], passed as an
argument to #[compiled-procedure 14 ("binary-port" #x2) #x1c #x1a7a6f4], is
not the correct type.

So, I changed `tcp-server-connection-accept` to
`tcp-server-binary-connection-accept`:

(let* ((socket (open-tcp-server-socket 8000))
       (port (tcp-server-binary-connection-accept socket #t #f))
       (request (read-http-request port)))
  (display request))

However, this will also fail when a client connects to localhost:8000:

;The object 3, passed as the second argument to vector-ref, is not in the
correct range.


MIT Scheme version: 11.2







    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?62580>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]