l...@gnu.org (Ludovic Courtès) writes:

> David Thompson <dthomps...@worcester.edu> skribis:
>
>> +(define (render-nar request store-item)
>> +  "Render archive of the store path corresponding to STORE-ITEM."
>> +  (let ((store-path (string-append %store-directory "/" store-item)))
>> +    ;; The ISO-8859-1 charset *must* be used otherwise HTTP clients will
>> +    ;; interpret the byte stream as UTF-8 and arbitrarily change invalid 
>> byte
>> +    ;; sequences.
>> +    (if (file-exists? store-path)
>> +        (values '((content-type . (application/x-nix-archive
>> +                                   (charset . "ISO-8859-1"))))
>> +                (lambda (port)
>> +                  (write-file store-path port)))
>> +        (not-found request))))
>
> This is OK for now, but I just realized that this will be blocking the
> server for the duration of the whole transfer.  Someone could DoS you by
> substituting TeX Live.  ;-)
>
> We’ll need a solution but it seems that it’ll be hard to avoid threads.
>
> Thoughts?

I haven't looked closely, but how about using subprocesses instead of
threads?

      Mark

Reply via email to