165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
|
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
|
-
+
|
(let* (($ (request-vars source: 'both))
(dat ($ 'dat))
(res #f))
(cond
((equal? (uri-path (request-uri (current-request)))
'(/ "api"))
(send-response ;; the $ is the request vars proc
body: ((api-proc) *dbstruct-db* $)
body: ((api-proc) *dbstruct-db* $) ;; ($) => alist
headers: '((content-type text/plain)))
(set! *db-last-access* (current-seconds)))
((equal? (uri-path (request-uri (current-request)))
'(/ "ping"))
(send-response body: (conc *toppath*"/"(args:get-arg "-db"))
headers: '((content-type text/plain))))
((equal? (uri-path (request-uri (current-request)))
|
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
|
301
302
303
304
305
306
307
308
309
310
311
312
313
314
|
-
-
-
-
-
-
-
-
|
(set! *http-connections-next-cleanup* (+ (current-seconds) 10))
(mutex-unlock! *http-mutex*))
(define (http-transport:inc-requests-and-prep-to-close-all-connections)
(mutex-lock! *http-mutex*)
(set! *http-requests-in-progress* (+ 1 *http-requests-in-progress*)))
(define (sexpr->string data)
(with-output-to-string
(lambda ()(write data))))
(define (string->sexpr instr)
(with-input-from-string instr
(lambda ()(read))))
;; serverdat contains uuid to be used for connection validation
;;
;; NOTE: serverdat must be initialized or created by servdat-init
;;
(define (http-transport:send-receive sdat qry-key cmd params #!key (numretries 3))
(let* ((res #f)
(success #t)
|