|
root / test / http_test.reef
http_test.reef Reef 54 lines 1.4 KB
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Minimal HTTP download test for debugging
// Tests net.http.http_download_file() which appears to hang on illumos

import net.http
import io.file

proc main()
    println("=== HTTP Download Test ===")
    println("")

    // Test 1: Simple HTTPS URL (zlib - small file)
    let url1 = "https://zlib.net/zlib-1.3.1.tar.gz"
    let dest1 = "/tmp/http_test_zlib.tar.gz"

    println("Test 1: zlib download (1.5MB)")
    println("URL: " + url1)
    println("Calling http_download_file()...")

    let result1 = http.http_download_file(url1, dest1)

    if result1
        println("SUCCESS: Downloaded to " + dest1)
        if file.fileExists(dest1)
            println("File exists: true")
        end if
    else
        println("FAILED: http_download_file returned false")
    end if

    println("")

    // Test 2: GitHub URL (requires redirect handling)
    let url2 = "https://github.com/vim/vim/archive/refs/tags/v9.1.0.tar.gz"
    let dest2 = "/tmp/http_test_vim.tar.gz"

    println("Test 2: GitHub download with redirects (17MB)")
    println("URL: " + url2)
    println("Calling http_download_file()...")

    let result2 = http.http_download_file(url2, dest2)

    if result2
        println("SUCCESS: Downloaded to " + dest2)
        if file.fileExists(dest2)
            println("File exists: true")
        end if
    else
        println("FAILED: http_download_file returned false")
    end if

    println("")
    println("=== Test Complete ===")
end main