refactor: changes spaces and instructions

use if, remove useless begin, 1 tab = 4 spaces
This commit is contained in:
rick 2022-02-02 00:48:53 +01:00
parent 48c95a8370
commit d8e1e49e58
Signed by: Rick
GPG key ID: 2B593F087240EE99

View file

@ -18,30 +18,27 @@
(use-modules (ice-9 binary-ports) (ice-9 iconv) (rnrs bytevectors))
(define chaussette (socket PF_INET SOCK_STREAM 0))
(bind chaussette AF_INET INADDR_ANY 8082)
(bind chaussette AF_INET INADDR_ANY 8081)
(listen chaussette 1)
(display "Chaussette en place")
(newline)
(while #t
(let (( rep (accept chaussette )))
(let ((out (car rep)) (in (cdr rep)))
(define text (make-bytevector 1024))
(define pos #f)
(recvfrom! out text)
(let (( rep (accept chaussette )))
(let ((out (car rep)) (in (cdr rep)))
(define text (make-bytevector 1024))
(define pos #f)
(recvfrom! out text)
(set! pos (string-contains (bytevector->string text "UTF-8")
(string #\return #\nl)))
(set! pos (string-contains (bytevector->string text "UTF-8")
(string #\return #\nl)))
;; si ya pas de \cr\nl, buffer trop grand ou mal formaté
(when (not pos) (begin
(display (string-append "59 Bad Request" (string #\return #\nl)) out))
)
;; si ya pas de \cr\nl, buffer trop grand ou mal formaté
(if (not pos)
(display (string-append "59 Bad Request" (string #\return #\nl)) out)
(display "all ok")
)
(unless (not pos) (begin
(display "all ok")
))
(shutdown out 2)
(shutdown out 2)
)))
(close chaussette)