Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Starting multiple apps with the Hunchentoot handler causes the previous to be unreachable #122

Closed
jorams opened this issue Aug 28, 2015 · 1 comment

Comments

@jorams
Copy link

jorams commented Aug 28, 2015

I'll illustrate the problem with an example:

(ql:quickload '(:clack :drakma))

(clack:clackup
  (lambda (env)
    '(200
      (:content-type "text/plain")
      ("Hello, Clack application 1!")))
  :port 5000)

(clack:clackup
  (lambda (env)
    '(200
      (:content-type "text/plain")
      ("Hello, Clack application 2!")))
  :port 5001)

(drakma:http-request "http://localhost:5000/") ;=> "Hello, Clack application 2!"
(drakma:http-request "http://localhost:5001/") ;=> "Hello, Clack application 2!"

The first drakma:http-request should return "Hello, Clack application 1!".

I'm pretty sure this happens because the RUN function of the Hunchentoot handler completely replaces hunchentoot:*dispatch-table* with a list containing only a function that always dispatches to the newly started app. (see here)

Instead it should work like the Hunchentoot documentation says: Check if the request should be handled by that app. The other handlers in the list should be kept in place.

Request dispatching is performed according to the list of dispatch functions in DISPATCH-TABLE. Each of the functions on that list is called to determine whether it wants to handle the request, provided as single argument. If a dispatcher function wants to handle the request, it returns another function to actually create the desired page.

@fukamachi
Copy link
Owner

Fixed at master branch.
Hunchentoot handler has stopped using easy-acceptor, so confliction of *dispatch-table* doesn't matter now.
Thank you for reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants