Skip to content

Commit

Permalink
get http url
Browse files Browse the repository at this point in the history
  • Loading branch information
ttytm committed Nov 11, 2024
1 parent ab65704 commit 88283c5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 18 deletions.
21 changes: 4 additions & 17 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
19 changes: 18 additions & 1 deletion get.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit 88283c5

Please # to comment.