.Dd December 15, 2024 .Dt LIBHTTPC_DUMPRESPONSE 3 .Os . .Sh NAME .Nm LibHTTPC_dumpResponse , .Nm LibHTTPC_writeResponse .Nd save .Xr libhttpc_response 3 . .Sh SYNOPSIS .In libhttpc/libhttpc.h .Ft "char *" .Fo LibHTTPC_dumpResponse .Fa "struct LibHTTPC_Response *response" .Fa "char *buf" .Fa "size_t buf_len" .Fc .Ft int .Fo "LibHTTPC_writeResponse" .Fa "int sockfd" .Fa "struct LibHTTPC_Response *response" .Fc . .Sh DESCRIPTION .Fn LibHTTPC_dumpResponse combines 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 writes the .Fa response to the .Fa sockfd . . .Pp Both functions can autocomplete responses. If .Fa response->version is .Dv NULL , then it will be set to .Ql "HTTP/1.1" . If .Fa response->status is 0, then it will be set to 200. If .Fa response->phrase is .Dv NULL , then it will 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 response. Read .Ql ERRORS section of .Xr send 2 for more information. . .Sh SEE ALSO .Xr libhttpc 3 , .Xr libhttpc_header 3 , .Xr libhttpc_status 3 , .Xr libhttpc_response 3 . .Sh AUTHORS .An Nakidai Perumenei Aq Mt nakidai@disroot.org . .Sh CAVEATS .Nm may edit fields of .Ql response that are set to 0