Skip to content

Commit 4efd86f

Browse files
committed
Should copy the data for async ncurl cases
1 parent d9c3963 commit 4efd86f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/ncurl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ SEXP rnng_ncurl_aio(SEXP http, SEXP convert, SEXP method, SEXP headers, SEXP dat
354354
}
355355
if (data != R_NilValue) {
356356
nano_buf enc = nano_char_buf(data);
357-
if (enc.cur && (xc = nng_http_req_set_data(handle->req, enc.buf, enc.cur)))
357+
if (enc.cur && (xc = nng_http_req_copy_data(handle->req, enc.buf, enc.cur)))
358358
goto fail;
359359
}
360360

@@ -559,7 +559,7 @@ SEXP rnng_ncurl_session(SEXP http, SEXP convert, SEXP method, SEXP headers, SEXP
559559
}
560560
if (data != R_NilValue) {
561561
nano_buf enc = nano_char_buf(data);
562-
if (enc.cur && (xc = nng_http_req_set_data(handle->req, enc.buf, enc.cur)))
562+
if (enc.cur && (xc = nng_http_req_copy_data(handle->req, enc.buf, enc.cur)))
563563
goto fail;
564564
}
565565

0 commit comments

Comments
 (0)