diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index c313f35..510eab0 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -19,30 +19,17 @@ jobs: Remove-Item libcurl.zip mv curl-8.11.0_1-win64-mingw libcurl ls -Recurse libcurl - # echo $HOME - # [System.Environment]::GetEnvironmentVariable("PATH", [System.EnvironmentVariableTarget]::Machine) - # v -stats test vibe - # set PATH=%PATH%;C:%HOMEPATH%\.vmodules\vibe\curl\libcurl\bin - # echo %PATH% # - run: | # $env:PATH += ";C:($pwd).libcurl\bin" # [System.Environment]::SetEnvironmentVariable("PATH", $env:PATH + ";C:($pwd).libcurl\bin", [System.EnvironmentVariableTarget]::Machine) # [System.Environment]::GetEnvironmentVariable("PATH", [System.EnvironmentVariableTarget]::Machine) - # - run: | - # shell: cmd - # set PATH=%PATH%;C:%HOMEPATH%\.vmodules\vibe\curl\libcurl\bin + # - shell: cmd + # run: | + # set PATH=%PATH%;D:\a\vibe\vibe\libcurl\bin # echo %PATH% - # gcc -o example example.c "libcurl/bin/libcurl-x64.dll" -Ilibcurl/include - # - run: gcc -o example example.c "libcurl/bin/libcurl-x64.dll" -Ilibcurl/include - - shell: cmd - run: | - set PATH=%PATH%;D:\a\vibe\vibe\libcurl\bin - echo %PATH% - gcc -o hw2 hw.c "libcurl/bin/libcurl-x64.dll" -Ilibcurl/include && hw2.exe + # gcc -o hw2 hw.c "libcurl/bin/libcurl-x64.dll" -Ilibcurl/include && hw2.exe - shell: cmd run: | set PATH=%PATH%;D:\a\vibe\vibe\libcurl\bin echo %PATH% gcc -o get get.c "libcurl/bin/libcurl-x64.dll" -Ilibcurl/include && get.exe - # - run: ls - # - run: ./example.exe diff --git a/get.c b/get.c index 09349ad..c0c9749 100644 --- a/get.c +++ b/get.c @@ -4,8 +4,25 @@ int main(int argc, char *argv[]) { CURLcode ret; CURL *hnd; + hnd = curl_easy_init(); + + curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L); + curl_easy_setopt(hnd, CURLOPT_URL, "http://example.com"); + curl_easy_setopt(hnd, CURLOPT_NOPROGRESS, 1L); + curl_easy_setopt(hnd, CURLOPT_USERAGENT, "curl/8.11.0"); + curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L); + curl_easy_setopt(hnd, CURLOPT_HTTP_VERSION, (long)CURL_HTTP_VERSION_2TLS); + curl_easy_setopt(hnd, CURLOPT_FTP_SKIP_PASV_IP, 1L); + curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L); + + ret = curl_easy_perform(hnd); + if (ret != CURLE_OK) { + printf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(ret)); + } + curl_easy_cleanup(hnd); hnd = NULL; - return 0; + + return (int)ret; }