fukamachi / caveman

Lightweight web application framework for Common Lisp.
http://8arrow.org/caveman/
776 stars 62 forks source link

Hunchentoot backend is the only one working #43

Closed lucashpandolfo closed 9 years ago

lucashpandolfo commented 9 years ago

Using the release from latest quicklisp:

CL-USER> (ql:quickload 'caveman2)
To load "caveman2":
  Load 1 ASDF system:
    caveman2
; Loading "caveman2"
.......................
(CAVEMAN2)
CL-USER> (caveman2:make-project "quicklisp/local-projects/cave-test")
<some text>
T
CL-USER> (ql:quickload '(drakma cave-test))
To load "drakma":
  Load 1 ASDF system:
    drakma
; Loading "drakma"
....
To load "cave-test":
  Load 1 ASDF system:
    cave-test
; Loading "cave-test"
..................................................
[package cave-test.config]........................
[package cave-test.view]..........................
[package cave-test.db]............................
[package cave-test]...............................
[package cave-test.web].
(DRAKMA CAVE-TEST)

Using Hunchentoot

CL-USER> (cave-test:start :port 8080 :server :hunchentoot)
To load "cave-test":
  Load 1 ASDF system:
    cave-test
; Loading "cave-test"

To load "clack-handler-hunchentoot":
  Load 1 ASDF system:
    clack-handler-hunchentoot
; Loading "clack-handler-hunchentoot"

Hunchentoot server is started.
Listening on localhost:8080.
#<CLACK.HANDLER:<HANDLER> {10068086D3}>
CL-USER> (prog1 t (drakma:http-request "http://localhost:8080"))
127.0.0.1 - [28/Dec/2014:14:06:55 -03:00] "GET / HTTP/1.1" 200 523 "-" "-"
T

Using Toot

CL-USER> (cave-test:start :port 8080 :server :toot)
To load "cave-test":
  Load 1 ASDF system:
    cave-test
; Loading "cave-test"

To load "clack-handler-toot":
  Load 1 ASDF system:
    clack-handler-toot
; Loading "clack-handler-toot"

Toot server is started.
Listening on localhost:8080.
#<CLACK.HANDLER:<HANDLER> {1004ED89C3}>
CL-USER> (prog1 t (drakma:http-request "http://localhost:8080"))

The slot CLACK.REQUEST::QUERY-PARAMETERS is unbound in the
object #<<REQUEST> {100AD784F3}>.
   [Condition of type UNBOUND-SLOT]

Restarts:
 0: [USE-VALUE] Return a value as the slot-value.
 1: [STORE-VALUE] Store and return a value as the slot-value.
 2: [ABORT] Abort thread (#<THREAD "toot-worker-127.0.0.1:60839" RUNNING {1005C4C8C3}>)

Backtrace:
  0: ((:METHOD SLOT-UNBOUND (T T T)) #<unavailable argument> #<CLACK.REQUEST:<REQUEST> {100AD784F3}> CLACK.REQUEST::QUERY-PARAMETERS) [fast-method]
  1: (SLOT-VALUE #<CLACK.REQUEST:<REQUEST> {100AD784F3}> CLACK.REQUEST::QUERY-PARAMETERS)
  2: (CLACK.REQUEST::GET-WHOLE-OR-SPECIFIED #<unavailable argument> CLACK.REQUEST::QUERY-PARAMETERS NIL)
  3: ((:METHOD CLACK.REQUEST:PARAMETER (CLACK.REQUEST:<REQUEST>)) #<CLACK.REQUEST:<REQUEST> {100AD784F3}> NIL) [fast-method]
  4: ((LAMBDA (NINGLE.APP::PARAMS) :IN NINGLE.APP:ROUTE) NIL)
  5: ((LABELS MYWAY.MAPPER::DISPATCH-WITH-RULES :IN MYWAY.MAPPER:DISPATCH) (#<NINGLE.ROUTE:NINGLE-ROUTE {100CA469C3}>))
...

Using Wookie

CL-USER> (cave-test:start :port 8080 :server :wookie)
To load "cave-test":
  Load 1 ASDF system:
    cave-test
; Loading "cave-test"

To load "clack-handler-wookie":
  Load 1 ASDF system:
    clack-handler-wookie
; Loading "clack-handler-wookie"
......
Wookie server is started.
Listening on localhost:8080.
#<CLACK.HANDLER:<HANDLER> {100AF286D3}>
CL-USER> (prog1 t (drakma:http-request "http://localhost:8080"))
<ERROR> [14:10:05] wookie parser.lisp (setup-parser dispatch-route) -
  (hook) Error running hooks (socket #<SOCKET {100C964893}>): The slot
                                                              CLACK.REQUEST::QUERY-PARAMETERS
                                                              is unbound in the
                                                              object
                                                              #<<REQUEST>
                                                                {100A1C8943}>.
<ERROR> [14:10:05] wookie parser.lisp (setup-parser dispatch-route) -
  (hook) Error running hooks (socket #<SOCKET {100C964893}>): The slot
                                                              CLACK.REQUEST::QUERY-PARAMETERS
                                                              is unbound in the
                                                              object
                                                              #<<REQUEST>
                                                                {100A1C8943}>.
<ERROR> [14:10:05] wookie parser.lisp (setup-parser finish-callback) -
  (hook) Error running hooks (socket #<SOCKET {100C964893}>): The slot
                                                              CLACK.REQUEST::QUERY-PARAMETERS
                                                              is unbound in the
                                                              object
                                                              #<<REQUEST>
                                                                {100A1C8943}>.
<ERROR> [14:10:05] wookie parser.lisp (setup-parser finish-callback) -
  (hook) Error running hooks (socket #<SOCKET {100C964893}>): The slot
                                                              CLACK.REQUEST::QUERY-PARAMETERS
                                                              is unbound in the
                                                              object
                                                              #<<REQUEST>
                                                                {100A1C8943}>.
T
CL-USER> 

The slot CLACK.REQUEST::QUERY-PARAMETERS is unbound in the
object #<<REQUEST> {100A1C8943}>.
   [Condition of type UNBOUND-SLOT]

Restarts:
 0: [ABORT-CALLBACK] Abort cl-async callback.
 1: [*EXIT-EVENT-LOOP] Exit the current event loop
 2: [ABORT] Abort thread (#<THREAD "clack-handler-wookie" RUNNING {100AE81173}>)

Backtrace:
  0: (WOOKIE::MAIN-EVENT-HANDLER #<UNBOUND-SLOT QUERY-PARAMETERS {100A4338E3}> #<CL-ASYNC:SOCKET {100C964893}>)
  1: ((LABELS WOOKIE::FINISH-CALLBACK :IN WOOKIE::SETUP-PARSER))
  2: ((LAMBDA (HTTP-PARSE::DATA) :IN HTTP-PARSE:MAKE-PARSER) #(71 69 84 32 47 32 ...))
  3: (CL-ASYNC-UTIL:CALL-WITH-CALLBACK-RESTARTS #<CLOSURE (LAMBDA NIL :IN CL-ASYNC::TCP-READ-CB) {1005C7846B}> "Abort cl-async callback.")
  4: (CL-ASYNC::TCP-READ-CB #.(SB-SYS:INT-SAP #X7FFFE4020ED0) 164 #<unavailable argument>)
  5: ((LAMBDA (SB-ALIEN::ARGS-POINTER SB-ALIEN::RESULT-POINTER FUNCTION) :IN "/home/lucas/.cache/common-lisp/sbcl-1.2.6-linux-x64/home/lucas/quicklisp/dists/quicklisp/software/cl-async-20141217-git/dns.fas..

With FCGI

CL-USER> (cave-test:start :port 8080 :server :fcgi)
To load "cave-test":
  Load 1 ASDF system:
    cave-test
; Loading "cave-test"

To load "clack-handler-fcgi":
  Load 1 ASDF system:
    clack-handler-fcgi
; Loading "clack-handler-fcgi"
To load "cl-fastcgi":
  Load 2 ASDF systems:
    cffi usocket
  Install 1 Quicklisp release:
    cl-fastcgi
; Loading "cl-fastcgi"
[package cl-fastcgi]..
; Loading "clack-handler-fcgi"
[package clack.handler.fcgi]..
Fcgi server is started.
Listening on localhost:8080.
#<CLACK.HANDLER:<HANDLER> {100ADB06D3}>
CL-USER> (prog1 t (drakma:http-request "http://localhost:8080"))

No status line - probably network error.
   [Condition of type DRAKMA::DRAKMA-SIMPLE-ERROR]

Restarts:
 0: [RETRY] Retry SLIME REPL evaluation request.
 1: [*ABORT] Return to SLIME's top level.
 2: [ABORT] Abort thread (#<THREAD "repl-thread" RUNNING {10056080B3}>)

Backtrace:
  0: (DRAKMA::READ-STATUS-LINE #<FLEXI-STREAMS:FLEXI-IO-STREAM {100BA34153}> NIL)
  1: ((LABELS DRAKMA::FINISH-REQUEST :IN DRAKMA:HTTP-REQUEST) NIL NIL)
  2: (DRAKMA:HTTP-REQUEST #<PURI:URI http://localhost:8080/>)
  3: ((LAMBDA ()))
  4: (SB-INT:SIMPLE-EVAL-IN-LEXENV (PROG1 T (DRAKMA:HTTP-REQUEST "http://localhost:8080")) #<NULL-LEXENV>)
  5: (EVAL (PROG1 T (DRAKMA:HTTP-REQUEST "http://localhost:8080")))

I also tried removing the sources and cache files and recompiling again just in case, but the result is the same. ¿Is there a problem with my setup or is this really a bug? Earlier this year I tried all the backends with a simple app and everything worked (except for fcgi, but that is another story)

fukamachi commented 9 years ago

It was actually a bug of Clack.Request. Though :query-string can be NIL, but Clack.Request required it was a string.

I've fixed it at https://github.com/fukamachi/clack/commit/9c0709f7029f86c11ef94c7dc11d1936ed3524a1. Please try it again with the latest Clack.

Thank you for reporting!

lucashpandolfo commented 9 years ago

Thanks again for your hard work.