State of reading POST data from connection.uri->post and related files.
More...
#include <post.h>
|
(Note that these are not member symbols.)
|
void | init_http_post (struct http_post *http_post) |
| Initialize *http_post so that done_http_post() can be safely called.
|
void | done_http_post (struct http_post *http_post) |
| Free all resources owned by *http_post, but do not free the structure itself.
|
int | open_http_post (struct http_post *http_post, const char *post_data, struct connection_state *error) |
| Prepare to read POST data from a URI and possibly to upload files.
|
static int | read_http_post_inline (struct http_post *http_post, char buffer[], int max, struct connection_state *error) |
static int | read_http_post_fd (struct http_post *http_post, char buffer[], int max, struct connection_state *error) |
int | read_http_post (struct http_post *http_post, char buffer[], int max, struct connection_state *error) |
| Read data from connection.uri->post or from the files to which it refers.
|
State of reading POST data from connection.uri->post and related files.
◆ done_http_post()
void done_http_post |
( |
struct http_post * | http_post | ) |
|
|
related |
Free all resources owned by *http_post, but do not free the structure itself.
It is safe to call this multiple times.
◆ init_http_post()
void init_http_post |
( |
struct http_post * | http_post | ) |
|
|
related |
◆ open_http_post()
Prepare to read POST data from a URI and possibly to upload files.
- Parameters
-
| http_post | Must have been initialized with init_http_post(). |
[in] | post_data | The body of the POST request as formatted by get_form_uri(). However, unlike uri.post, post_data must not contain any Content-Type. The caller must ensure that the post_data pointer remains valid until done_http_post(). |
[out] | error | If the function fails, it writes the error state here so that the caller can pass that on to abort_connection(). If the function succeeds, the value of *error is undefined. |
This function does not parse the Content-Type from uri.post; the caller must do that. This is because in local CGI, the child process handles the Content-Type (saving it to an environment variable before exec) but the parent process handles the body of the request (feeding it to the child process via a pipe).
- Returns
- nonzero on success, zero on error.
◆ read_http_post()
Read data from connection.uri->post or from the files to which it refers.
- Returns
- >0 if read that many bytes; 0 if EOF; -1 on error and set *error.
◆ read_http_post_fd()
- Returns
- -2 if no data was read but the caller should retry; -1 if an error occurred and *error was set; 0 at end of data; a positive number if that many bytes were read.
◆ read_http_post_inline()
- Returns
- -2 if no data was read but the caller should retry; -1 if an error occurred and *error was set; 0 at end of data; a positive number if that many bytes were read.
◆ file_count
size_t http_post::file_count |
Number of files to be uploaded, i.e.
the number of elements in the files array.
◆ file_index
size_t http_post::file_index |
Current position in the files array.
This is the file that is currently being read (when post_fd != -1) or would be read next (when post_fd == -1).
◆ file_read
off_t http_post::file_read |
Number of bytes read from the current file so far.
The value makes sense only when post_fd != -1.
◆ files
Array of information about files to be uploaded.
◆ post_data
const char* http_post::post_data |
◆ post_fd
File descriptor from which data is being read, or -1 if none.
◆ total_upload_length
off_t http_post::total_upload_length |
Total size of the POST body to be uploaded.
◆ uploaded
off_t http_post::uploaded |
The documentation for this struct was generated from the following files: