Skip to content

Commit affc4b2

Browse files
authored
Merge pull request #94 from treeform/guzba
add github token, checkout v3, global init
2 parents 44d93ad + ebb0938 commit affc4b2

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@ jobs:
1616
runs-on: ${{ matrix.os }}
1717

1818
steps:
19-
- uses: actions/checkout@v2
19+
- uses: actions/checkout@v3
2020
- uses: jiro4989/setup-nim-action@v1
2121
with:
2222
nim-version: ${{ matrix.nim-version }}
23+
repo-token: ${{ secrets.GITHUB_TOKEN }}
2324

2425
- run: nimble install -y libcurl
2526
- run: nimble install -y zippy

puppy.nimble

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version = "2.0.1"
1+
version = "2.0.2"
22
author = "Andre von Houck"
33
description = "Puppy fetches resources via HTTP and HTTPS."
44
license = "MIT"

src/puppy/platforms/linux/platform.nim

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
import libcurl, puppy/common, std/strutils, zippy
22

3+
block:
4+
## If you did not already call curl_global_init then
5+
## curl_easy_init does it automatically.
6+
## This may be lethal in multi-threaded cases since curl_global_init
7+
## is not thread-safe.
8+
## https://curl.se/libcurl/c/curl_easy_init.html
9+
let ret = global_init(GLOBAL_DEFAULT)
10+
if ret != E_OK:
11+
raise newException(Defect, $easy_strerror(ret))
12+
313
type StringWrap = object
414
## As strings are value objects they need
515
## some sort of wrapper to be passed to C.
@@ -69,8 +79,10 @@ proc fetch*(req: Request): Response {.raises: [PuppyError].} =
6979
# On Windows look for cacert.pem.
7080
when defined(windows):
7181
discard curl.easy_setopt(OPT_CAINFO, "cacert.pem".cstring)
72-
# Follow redirects by default.
82+
83+
# Follow up to 10 redirects by default.
7384
discard curl.easy_setopt(OPT_FOLLOWLOCATION, 1)
85+
discard curl.easy_setopt(OPT_MAXREDIRS, 10)
7486

7587
if req.allowAnyHttpsCertificate:
7688
discard curl.easy_setopt(OPT_SSL_VERIFYPEER, 0)

0 commit comments

Comments
 (0)