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