#include "nanohttp-logging.h"
#include "nanohttp-error.h"
#include "nanohttp-common.h"
#include "nanohttp-socket.h"
#include "nanohttp-stream.h"
Go to the source code of this file.
Functions | |
http_input_stream_t * | http_input_stream_new (struct hsocket_t *sock, hpair_t *header) |
http_input_stream_t * | http_input_stream_new_from_file (const char *filename) |
void | http_input_stream_free (struct http_input_stream_t *stream) |
int | http_input_stream_is_ready (struct http_input_stream_t *stream) |
int | http_input_stream_read (struct http_input_stream_t *stream, unsigned char *dest, int size) |
http_output_stream_t * | http_output_stream_new (struct hsocket_t *sock, hpair_t *header) |
void | http_output_stream_free (struct http_output_stream_t *stream) |
herror_t | http_output_stream_write (struct http_output_stream_t *stream, const unsigned char *bytes, int size) |
herror_t | http_output_stream_write_string (struct http_output_stream_t *stream, const char *str) |
herror_t | http_output_stream_flush (struct http_output_stream_t *stream) |
|
Free input stream. Note that the socket will not be closed by this functions.
Definition at line 162 of file nanohttp-stream.c. References http_input_stream_t::deleteOnExit, http_input_stream_t::fd, http_input_stream_t::filename, HTTP_TRANSFER_FILE, log_info2, and http_input_stream_t::type. Referenced by hrequest_free(), hresponse_free(), and hresponse_new_from_socket(). |
|
Returns the actual status of the stream. Definition at line 422 of file nanohttp-stream.c. References http_input_stream_t::err, H_OK, HTTP_TRANSFER_CHUNKED, HTTP_TRANSFER_CONNECTION_CLOSE, HTTP_TRANSFER_CONTENT_LENGTH, HTTP_TRANSFER_FILE, and http_input_stream_t::type. Referenced by mime_streamreader_function(). |
|
Creates a new input stream. Definition at line 84 of file nanohttp-stream.c. References http_input_stream_t::chunk_size, http_input_stream_t::connection_closed, http_input_stream_t::content_length, http_input_stream_t::err, H_OK, HEADER_CONTENT_LENGTH, hpairnode_dump_deep(), hpairnode_get_ignore_case(), HTTP_TRANSFER_CHUNKED, HTTP_TRANSFER_CONNECTION_CLOSE, HTTP_TRANSFER_CONTENT_LENGTH, log_error2, log_verbose1, http_input_stream_t::received, http_input_stream_t::sock, and http_input_stream_t::type. Referenced by hresponse_new_from_socket(). |
|
Creates a new input stream from file. This function was added for MIME messages and for debugging. Definition at line 134 of file nanohttp-stream.c. References http_input_stream_t::deleteOnExit, http_input_stream_t::fd, http_input_stream_t::filename, HTTP_TRANSFER_FILE, log_error2, and http_input_stream_t::type. Referenced by hresponse_new_from_socket(). |
|
Returns the actual read bytes <0 on error Definition at line 452 of file nanohttp-stream.c. References http_input_stream_t::err, H_OK, herror_new(), HTTP_TRANSFER_CHUNKED, HTTP_TRANSFER_CONNECTION_CLOSE, HTTP_TRANSFER_CONTENT_LENGTH, HTTP_TRANSFER_FILE, STREAM_ERROR_INVALID_TYPE, and http_input_stream_t::type. Referenced by httpd_get_postdata(), and mime_streamreader_function(). |
|
Sends finish flags if nesseccary (like in chunked transport). Call always this function before closing the connections.
Definition at line 605 of file nanohttp-stream.c. References H_OK, hsocket_send_string(), HTTP_TRANSFER_CHUNKED, http_output_stream_t::sock, and http_output_stream_t::type. Referenced by httpc_mime_end(), httpc_post_end(), and httpd_mime_end(). |
|
Free output stream Definition at line 552 of file nanohttp-stream.c. Referenced by httpc_free(), and httpd_free(). |
|
Creates a new output stream. Transfer code will be found from header. Definition at line 503 of file nanohttp-stream.c. References http_output_stream_t::content_length, HEADER_CONTENT_LENGTH, hpairnode_get_ignore_case(), HTTP_TRANSFER_CHUNKED, HTTP_TRANSFER_CONNECTION_CLOSE, HTTP_TRANSFER_CONTENT_LENGTH, log_error2, log_verbose1, http_output_stream_t::sent, http_output_stream_t::sock, and http_output_stream_t::type. Referenced by httpc_post_begin(), and httpd_send_header(). |
|
Writes 'size' bytes of 'bytes' into stream. Returns socket error flags or H_OK. Definition at line 564 of file nanohttp-stream.c. References H_OK, hsocket_send(), hsocket_send_string(), HTTP_TRANSFER_CHUNKED, http_output_stream_t::sock, and http_output_stream_t::type. Referenced by http_output_stream_write_string(), httpc_mime_end(), httpc_mime_next(), httpc_mime_send_file(), httpd_mime_end(), httpd_mime_next(), and httpd_mime_send_file(). |
|
Writes 'strlen()' bytes of 'str' into stream. Returns socket error flags or H_OK. Definition at line 597 of file nanohttp-stream.c. References http_output_stream_write(). |