Add custom headers to smart http requests#516
Conversation
|
@spraints Cool stuff! As-is, this is going to leak memory on every call. You need call You need to do something like this: static VALUE rb_git_remote_extra_http_headers(VALUE self)
{
git_remote *remote;
git_strarray http_headers;
VALUE rb_result;
Data_Get_Struct(self, git_remote, remote);
rugged_exception_check(
git_remote_extra_http_headers(remote, &http_headers)
);
rb_result = rugged_strarray_to_rb_ary(&http_headers);
git_strarray_free(&http_headers);
return rb_result;
} |
Ah, cool. Good catch. libgit2/libgit2#3411 needs some more iteration. When that's more settled, I'll come back to this. |
ext/rugged/rugged_remote.c
Outdated
There was a problem hiding this comment.
You can move this declaration inside the if block.
There was a problem hiding this comment.
You can move this declaration inside the if block.
|
Looking great. 👍 |
|
@spraints Can you bump libgit2 and squash the other commits so this can be merged? |
c22783e to
fde2448
Compare
Yep! fde2448 is squashed with an updated libgit2. 😀 Looking at the diff now, it looks like I could add support for custom fetch headers too. IIRC, I added that to libgit2/libgit2#3411, but it isn't here. Would you like me to do that? |
2f1f02d adds custom headers in more places. If it looks good, I can squash again. |
|
Oh, good catch with freeing of the strarray objects. Everything LGTM! |
f53a419 to
796e17b
Compare
🤘 It's now squashed down to one commit. 😸 |
|
PEEEEEEEEEEEEEEERFEEEEECT! ❤️ |
Add custom headers to smart http requests
This integrates libgit2/libgit2#3411 into rugged.