diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2016-07-27 12:43:12 +0200 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2016-07-27 12:45:01 +0200 |
| commit | 37402ecb4379d7199dd4b3386488261938edc780 (patch) | |
| tree | c94f30b7bac52fabc8c2ddc25f2b51c9afea07aa /tests/publish.scm | |
| parent | 688ec13c459602d475bccd3638a6802dc0a6ce23 (diff) | |
tests: Use unbuffered input ports when decompressing from 'guix publish'.
Fixes <http://bugs.gnu.org/24060>.
Reported by Chris Marusich <cmmarusich@gmail.com>.
* tests/publish.scm (http-get-port): Explicitly call
'open-socket-for-uri' and add calls to 'setvbuf'.
Diffstat (limited to 'tests/publish.scm')
| -rw-r--r-- | tests/publish.scm | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/tests/publish.scm b/tests/publish.scm index 0ba33487bde..4dc807505c2 100644 --- a/tests/publish.scm +++ b/tests/publish.scm | |||
| @@ -58,8 +58,16 @@ | |||
| 58 | (lambda (response body) body))) | 58 | (lambda (response body) body))) |
| 59 | 59 | ||
| 60 | (define (http-get-port uri) | 60 | (define (http-get-port uri) |
| 61 | (call-with-values (lambda () (http-get uri #:streaming? #t)) | 61 | (let ((socket (open-socket-for-uri uri))) |
| 62 | (lambda (response port) port))) | 62 | ;; Make sure to use an unbuffered port so that we can then peek at the |
| 63 | ;; underlying file descriptor via 'call-with-gzip-input-port'. | ||
| 64 | (setvbuf socket _IONBF) | ||
| 65 | (call-with-values | ||
| 66 | (lambda () | ||
| 67 | (http-get uri #:port socket #:streaming? #t)) | ||
| 68 | (lambda (response port) | ||
| 69 | (setvbuf port _IONBF) | ||
| 70 | port)))) | ||
| 63 | 71 | ||
| 64 | (define (publish-uri route) | 72 | (define (publish-uri route) |
| 65 | (string-append "http://localhost:6789" route)) | 73 | (string-append "http://localhost:6789" route)) |
