summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--TODO.72
-rw-r--r--include/libhttpc.h3
-rw-r--r--man/libhttpc_dumpresponse.342
-rw-r--r--man/libhttpc_loadrequest.34
4 files changed, 47 insertions, 4 deletions
diff --git a/TODO.7 b/TODO.7
index 80eb496..2f56a47 100644
--- a/TODO.7
+++ b/TODO.7
@@ -1,4 +1,4 @@
-.Dd December 14, 2024
+.Dd December 15, 2024
 .Dt TODO 7
 .Os
 .
diff --git a/include/libhttpc.h b/include/libhttpc.h
index f31e672..241fac0 100644
--- a/include/libhttpc.h
+++ b/include/libhttpc.h
@@ -264,7 +264,10 @@ struct LibHTTPC_Request *LibHTTPC_loadRequest(struct LibHTTPC_Request *request_b
  *
  *                      if (response.phrase == NULL) then it will be set to LibHTTPC_dumpStatus(response.status)
  * @param[out] buf      Pointer to buffer where to save formatted response
+ *                      
+ *                      if (buf == NULL) then it will alocate buffer itself
  * @param      buf_len  Size of buf
+ * @return Pointer to buffer on success, NULL otherwise
  */
 char *LibHTTPC_dumpResponse(struct LibHTTPC_Response *response, char *buf, size_t buf_len);
 
diff --git a/man/libhttpc_dumpresponse.3 b/man/libhttpc_dumpresponse.3
index 81074ec..9136188 100644
--- a/man/libhttpc_dumpresponse.3
+++ b/man/libhttpc_dumpresponse.3
@@ -1,4 +1,4 @@
-.Dd December 14, 2024
+.Dd December 15, 2024
 .Dt LIBHTTPC_DUMPRESPONSE 3
 .Os
 .
@@ -29,6 +29,14 @@ contents of
 .Fa response
 in the
 .Fa buf .
+If
+.Fa buf
+is equal to
+.Dv NULL ,
+then function will
+allocate buffer
+itself using
+.Xr libhttpc-alloc 3 .
 .
 .Pp
 .Fn LibHTTPC_writeResponse
@@ -62,6 +70,38 @@ be set to
 .Fn LibHTTPC_dumpStatus status .
 .
 .Sh RETURN VALUES
+.Fn LibHTTPC_dumpResponse
+will return pointer
+to the buffer
+on success.
+If function returned
+.Dv NULL ,
+it could mean
+either:
+.Bl -bullet
+.It
+If
+.Xr errno 3
+is 0
+(Success),
+it means that
+user hadn't set
+.Xr libhttpc-alloc 3 .
+.It
+If
+.Xr errno 3
+is not 0,
+it means that
+.Fn LibHTTPC_malloc
+has failed
+to allocate buffer.
+Read
+.Ql ERRORS
+section of
+.Ql malloc 3
+for more information.
+.El
+.
 .Fn LibHTTPC_writeResponse
 will return 1
 if cannot send
diff --git a/man/libhttpc_loadrequest.3 b/man/libhttpc_loadrequest.3
index affac5c..d926953 100644
--- a/man/libhttpc_loadrequest.3
+++ b/man/libhttpc_loadrequest.3
@@ -17,7 +17,7 @@
 .Sh DESCRIPTION
 .Fn LibHTTPC_loadRequest
 parses
-.Ql buf
+.Fa buf
 and fills
 .Fa request_buf .
 If
@@ -47,7 +47,7 @@ it could mean
 either:
 .Bl -bullet
 .It
-if
+If
 .Xr errno 3
 is 0
 (Success),