Welcome to the CHICKEN Scheme pasting service

HTTP POST file spewer added by teiresias on Tue Jun 14 19:42:21 2022

#!/bin/sh
#|
exec csi -s "$0" "$@"
|#
;; Spew POSTs of files at an HTTP server.
;; Exercises sendfile by way of http-client.
(import scheme (chicken base) (chicken io) (chicken port) (chicken process-context) brev-separate http-client intarweb simple-loops uri-common)

(call-with-output-file
    "/tmp/junk"
  (c write-string
     (make-string (string->number (car (command-line-arguments))) #\a) #f))

(define (do-request)
  (let ((req (make-request uri: (uri-reference "http://lothlorien.localdomain:8080") method: 'POST headers: (headers '((content-type application/octet-stream))))))
    (call-with-input-request req `((foo file: "/tmp/junk")) (lambda (p) (read-string #f p)))))

(do-forever
 (do-request))

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
Name of the egg which implements this service:
Visually impaired? Let me spell it for you (wav file) download WAV