@@ -41575,9 +41575,16 @@ SFUNC size_t fio_http_request_header_each(fio_http_s *,
41575
41575
/** Gets the body (payload) length associated with the HTTP handle. */
41576
41576
SFUNC size_t fio_http_body_length(fio_http_s *);
41577
41577
41578
- /** Adjusts the body's reading position. Negative values start at the end. */
41578
+ /**
41579
+ * Adjusts the body's reading position. Negative values start at the end.
41580
+ *
41581
+ * If `pos == SSIZE_MAX`, returns `fio_http_body_pos`.
41582
+ */
41579
41583
SFUNC size_t fio_http_body_seek(fio_http_s *, ssize_t pos);
41580
41584
41585
+ /** Returns the body's reading position. */
41586
+ SFUNC size_t fio_http_body_pos(fio_http_s *h);
41587
+
41581
41588
/** Reads up to `length` of data from the body, returns nothing on EOF. */
41582
41589
SFUNC fio_str_info_s fio_http_body_read(fio_http_s *, size_t length);
41583
41590
@@ -43579,6 +43586,8 @@ SFUNC int fio_http_body_fd(fio_http_s *h) { return h->body.fd; }
43579
43586
43580
43587
/** Adjusts the body's reading position. Negative values start at the end. */
43581
43588
SFUNC size_t fio_http_body_seek(fio_http_s *h, ssize_t pos) {
43589
+ if (pos == SSIZE_MAX)
43590
+ pos = h->body.pos;
43582
43591
if (pos < 0) {
43583
43592
pos += h->body.len;
43584
43593
if (pos < 0)
@@ -43590,6 +43599,9 @@ SFUNC size_t fio_http_body_seek(fio_http_s *h, ssize_t pos) {
43590
43599
return pos;
43591
43600
}
43592
43601
43602
+ /** Returns the body's reading position. */
43603
+ SFUNC size_t fio_http_body_pos(fio_http_s *h) { return h->body.pos; }
43604
+
43593
43605
/** Reads up to `length` of data from the body, returns nothing on EOF. */
43594
43606
SFUNC fio_str_info_s fio_http_body_read(fio_http_s *h, size_t length) {
43595
43607
fio_str_info_s r = {0};
0 commit comments