This commit is contained in:
SongWei 2020-02-14 16:01:13 +11:00
parent 9ae959271e
commit 8879bb85de
2 changed files with 32 additions and 17 deletions

View File

@ -5,4 +5,17 @@ add_library(leoext SHARED lib.c)
include_directories(${CURL_INCLUDE_DIR}) include_directories(${CURL_INCLUDE_DIR})
target_link_libraries(leoext ${CURL_LIBRARIES}) target_link_libraries(leoext ${CURL_LIBRARIES})
set_target_properties(leoext PROPERTIES COMPILE_FLAGS "-m32" LINK_FLAGS "-m32")
set(CMAKE_C_COMPILER gcc)
set(CMAKE_C_FLAGS "-m32 -L/usr/lib32")
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_C_COMPILER gcc)
set(CMAKE_C_FLAGS -m32)
set(CMAKE_FIND_ROOT_PATH /usr/lib32)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

View File

@ -11,7 +11,7 @@
(defun route-hello-world (env) (defun route-hello-world (env)
(declare (ignore env)) (declare (ignore env))
'(200 (:content-type "text/plain") '(200 (:content-type "text/plain")
("hello"))) ("hello world")))
(defun route-not-found (&optional env) (defun route-not-found (&optional env)
(declare (ignore env)) (declare (ignore env))
@ -60,21 +60,23 @@
(nil ,#'route-not-found))) (nil ,#'route-not-found)))
(if (not (find-package 'swank)) (if (not (find-package 'swank))
(woo:run (sb-thread:make-thread
(lambda (env) (lambda ()
;;(print env) (woo:run
;;(print (type-of env)) (lambda (env)
(if (eq :post (getf env :request-method)) ;;(print env)
(let* ((post-stream (getf env :raw-body)) ;;(print (type-of env))
(char-stream (flexi-streams:make-flexi-stream (if (eq :post (getf env :request-method))
post-stream (let* ((post-stream (getf env :raw-body))
:external-format :utf-8))))) (char-stream (flexi-streams:make-flexi-stream
post-stream
:external-format :utf-8)))))
;(format t (read-line char-stream)))) ;(format t (read-line char-stream))))
;(format t "dispatching...") ;(format t "dispatching...")
(let ((route-function (dispatch (getf env :request-uri) +dispatch-table+))) (let ((route-function (dispatch (getf env :request-uri) +dispatch-table+)))
(format t "method:~A uri:~A route: ~A~%" (format t "method:~A uri:~A route: ~A~%"
(getf env :request-method) (getf env :request-method)
(getf env :request-uri) (getf env :request-uri)
route-function) route-function)
(funcall route-function env))))) (funcall route-function env)))))))