Check-in [f5e9b53cb5]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:use transcoded-port in handle-scgi-connection
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: f5e9b53cb5de8fca0413577fe5ef4be9226a71ad
User & Date: aldo 2016-12-13 15:41:49
Context
2016-12-13
23:24
added free-gettext check-in: 69b77102c5 user: aldo tags: trunk
15:41
use transcoded-port in handle-scgi-connection check-in: f5e9b53cb5 user: aldo tags: trunk
00:11
added sxml-match doc check-in: 31ed97375e user: aldo tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to scgi.sls.

58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
  
  (define (handle-scgi-connection sock)
    (define h (read-headers sock))
    (assert (string=? "1" (cdr (assq 'SCGI h))))
    (let* ([len (string->number (cdr (assq 'CONTENT_LENGTH h)))]
	   [content (get-bytevector-n sock len)])
      (assert (= (bytevector-length content) len))
      (let ([port (open-fd-output-port
		   (port-file-descriptor sock)
		   'block
		   (make-transcoder (utf-8-codec) 'none))])
	((scgi-request-handler) port h content)
	(flush-output-port port))))

  (define (run-scgi addr port)
    (define nchildren 0)
    (define max-children 10)
    (define waitpid (foreign-procedure "waitpid" (int void* int) int))
    (call-with-port
     (socket 'inet 'stream '() 0)
     (lambda (sock)	
       (bind/inet sock addr port)
       (listen sock 1000)
       (do ()
	   (#f)
	 (printf "scgi: waiting for connection...~n")
	 (call-with-port
	  (accept sock)







<
<
<
|









|







58
59
60
61
62
63
64



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
  
  (define (handle-scgi-connection sock)
    (define h (read-headers sock))
    (assert (string=? "1" (cdr (assq 'SCGI h))))
    (let* ([len (string->number (cdr (assq 'CONTENT_LENGTH h)))]
	   [content (get-bytevector-n sock len)])
      (assert (= (bytevector-length content) len))



      (let ([port (transcoded-port sock (make-transcoder (utf-8-codec) 'none))])
	((scgi-request-handler) port h content)
	(flush-output-port port))))

  (define (run-scgi addr port)
    (define nchildren 0)
    (define max-children 10)
    (define waitpid (foreign-procedure "waitpid" (int void* int) int))
    (call-with-port
     (socket 'inet 'stream '() 0)
     (lambda (sock)
       (bind/inet sock addr port)
       (listen sock 1000)
       (do ()
	   (#f)
	 (printf "scgi: waiting for connection...~n")
	 (call-with-port
	  (accept sock)