Add missing doc comments

This commit is contained in:
Nick Krichevsky 2018-09-03 15:03:37 -04:00
parent e7a1164e44
commit 5353e35e58

View file

@ -116,6 +116,14 @@ static struct socket_read_info get_read_info(const struct http_header *headers)
return info;
}
/**
* Reads a socket based on a given content_length, usually from a Content-Length header.
*
* @param socket_fd The file descriptor of the socket.
* @param content_length The content length to read from the socket.
*
* @return The content in the socket. Must be freed by the caller.
*/
static char *read_body_by_content_length(int socket_fd, int content_length) {
char *result = malloc((content_length + 1) * sizeof(char));
char *buffer = malloc(content_length * sizeof(char));
@ -136,6 +144,13 @@ static char *read_body_by_content_length(int socket_fd, int content_length) {
return result;
}
/**
* Reads a socket until EOF
*
* @param socket_fd The file descriptor of the socket.
*
* @return The content in the socket. Must be freed by caller.
*/
static char *read_body_until_eof(int socket_fd) {
ssize_t current_result_size = 0;
int write_offset = 0;
@ -159,6 +174,15 @@ static char *read_body_until_eof(int socket_fd) {
return result;
}
/**
* Gets all remote pieces of a given socket.
*
* @param socket_fd The socket file descriptor.
* @param type An indication of this socket is for a client or a server
* @param message A http_message to store the output in.
*
* @return A socket_read_result indicating the result of the read.
*/
enum socket_read_result get_all_remote_parts(int socket_fd, enum socket_type type, struct http_message *message) {
ssize_t current_result_size = 0;
char *result = NULL;