Skip to content

Commit

Permalink
native: fix mime stuff
Browse files Browse the repository at this point in the history
tl;dr jurl now discovers libcurl bugs due to how complete it is
curl/curl#10834
  • Loading branch information
CosmicToast committed Mar 24, 2023
1 parent bdba2b3 commit 02deaca
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
1 change: 0 additions & 1 deletion src/jurl.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ typedef struct jurl_handle jurl_handle;

// mime.c
struct jurl_mime {
CURL *curl;
curl_mime *mime;
int clean;
};
Expand Down
9 changes: 4 additions & 5 deletions src/mime.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ static int jurl_mime_gc(void *p, size_t s) {
(void) s;
jurl_mime *mime = (jurl_mime*)p;
if (mime->clean) curl_mime_free(mime->mime);
curl_easy_cleanup(mime->curl);
return 0;
}

Expand Down Expand Up @@ -86,11 +85,11 @@ JANET_CFUN(jurl_mime_addpart) {

// we generate a separate handle for the generation, it's used a lot
JANET_CFUN(jurl_mime_new) {
janet_fixarity(argc, 0);
jurl_mime *mime = (jurl_mime*)janet_abstract(&jurl_mimetype, sizeof(jurl_mime));
janet_fixarity(argc, 1);
jurl_mime *mime = (jurl_mime*)janet_abstract(&jurl_mimetype, sizeof(jurl_mime));
jurl_handle *jurl = (jurl_handle*)janet_getjurl(argv, 0);
mime->clean = 1; // clean by default
mime->curl = curl_easy_init();
mime->mime = curl_mime_init(mime->curl);
mime->mime = curl_mime_init(jurl->handle);
return janet_wrap_abstract(mime);
}

Expand Down

0 comments on commit 02deaca

Please sign in to comment.