mirror of
https://github.com/rkd77/elinks.git
synced 2024-11-04 08:17:17 -05:00
cgi: Avoid assertion failure when the POST data is empty.
This commit is contained in:
parent
035ce283c7
commit
701e7e3e64
@ -120,8 +120,14 @@ send_post_data(struct connection *conn)
|
||||
add_bytes_to_string(&data, buffer, n);
|
||||
|
||||
|
||||
write_to_socket(conn->data_socket, data.source, data.length,
|
||||
S_SENT, close_pipe_and_read);
|
||||
/* If we're submitting a form whose controls do not have
|
||||
* names, then the POST has a Content-Type but empty data,
|
||||
* and an assertion would fail in write_to_socket. */
|
||||
if (data.length)
|
||||
write_to_socket(conn->data_socket, data.source, data.length,
|
||||
S_SENT, close_pipe_and_read);
|
||||
else
|
||||
close_pipe_and_read(conn->data_socket);
|
||||
|
||||
done_string(&data);
|
||||
#undef POST_BUFFER_SIZE
|
||||
|
Loading…
Reference in New Issue
Block a user