mirror of
https://github.com/rkd77/elinks.git
synced 2025-02-02 15:09:23 -05:00
1008: make http_post.post_data point to const
Because init_http_post() now copies the file names, http_read_post_inline() no longer writes '\0' into post_data.
This commit is contained in:
parent
42123dab87
commit
1ab55c27a4
@ -87,19 +87,19 @@ done_http_post(struct http_post *http_post)
|
||||
*
|
||||
* @relates http_post */
|
||||
int
|
||||
open_http_post(struct http_post *http_post, unsigned char *post_data,
|
||||
open_http_post(struct http_post *http_post, const unsigned char *post_data,
|
||||
enum connection_state *error)
|
||||
{
|
||||
off_t size = 0;
|
||||
size_t length = strlen(post_data);
|
||||
unsigned char *end = post_data;
|
||||
const unsigned char *end = post_data;
|
||||
|
||||
done_http_post(http_post);
|
||||
http_post->post_data = end;
|
||||
|
||||
while (1) {
|
||||
struct stat sb;
|
||||
unsigned char *begin;
|
||||
const unsigned char *begin;
|
||||
int res;
|
||||
struct http_post_file *new_files;
|
||||
unsigned char *filename;
|
||||
@ -159,8 +159,8 @@ read_http_post_inline(struct http_post *http_post,
|
||||
unsigned char buffer[], int max,
|
||||
enum connection_state *error)
|
||||
{
|
||||
unsigned char *post = http_post->post_data;
|
||||
unsigned char *end = strchr(post, FILE_CHAR);
|
||||
const unsigned char *post = http_post->post_data;
|
||||
const unsigned char *end = strchr(post, FILE_CHAR);
|
||||
int total = 0;
|
||||
|
||||
assert(http_post->post_fd < 0);
|
||||
|
@ -27,11 +27,9 @@ struct http_post {
|
||||
* read_http_post() increments this. */
|
||||
off_t uploaded;
|
||||
|
||||
/** Points to the next byte to be read from connection.uri->post.
|
||||
* Does not point to const because http_read_post() momentarily
|
||||
* substitutes a null character for the FILE_CHAR at the end of
|
||||
* each file name. */
|
||||
unsigned char *post_data;
|
||||
/** Points to the next byte to be read from
|
||||
* connection.uri->post. */
|
||||
const unsigned char *post_data;
|
||||
|
||||
/** File descriptor from which data is being read, or -1 if
|
||||
* none. */
|
||||
@ -56,7 +54,7 @@ struct http_post {
|
||||
|
||||
void init_http_post(struct http_post *http_post);
|
||||
void done_http_post(struct http_post *http_post);
|
||||
int open_http_post(struct http_post *http_post, unsigned char *post_data,
|
||||
int open_http_post(struct http_post *http_post, const unsigned char *post_data,
|
||||
enum connection_state *error);
|
||||
int read_http_post(struct http_post *http_post,
|
||||
unsigned char buffer[], int max,
|
||||
|
Loading…
x
Reference in New Issue
Block a user