ELinks 0.18.0
|
Forms viewing/manipulation handling. More...
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include "elinks.h"
#include "bfu/listmenu.h"
#include "bfu/dialog.h"
#include "config/kbdbind.h"
#include "dialogs/menu.h"
#include "document/document.h"
#include "document/forms.h"
#include "document/view.h"
#include "intl/libintl.h"
#include "formhist/formhist.h"
#include "mime/mime.h"
#include "osdep/ascii.h"
#include "osdep/osdep.h"
#include "protocol/uri.h"
#include "session/session.h"
#include "session/task.h"
#include "terminal/kbd.h"
#include "terminal/terminal.h"
#include "terminal/window.h"
#include "util/conv.h"
#include "util/error.h"
#include "util/file.h"
#include "util/memory.h"
#include "util/random.h"
#include "util/string.h"
#include "viewer/action.h"
#include "viewer/text/draw.h"
#include "viewer/text/form.h"
#include "viewer/text/link.h"
#include "viewer/text/textarea.h"
#include "viewer/text/view.h"
#include "viewer/text/vs.h"
Data Structures | |
struct | files_offset |
struct | boundary_info |
Macros | |
#define | _GNU_SOURCE /* XXX: we want memrchr() ! */ |
#define | BOUNDARY_LENGTH 32 |
#define | realloc_bound_ptrs(bptrs, bptrs_size) mem_align_alloc(bptrs, bptrs_size, bptrs_size + 1, 0xFF) |
Functions | |
static void | fixup_select_state (struct el_form_control *fc, struct form_state *fs) |
void | selected_item (struct terminal *term, void *item_, void *ses_) |
static void | init_form_state (struct document_view *doc_view, struct el_form_control *fc, struct form_state *fs) |
struct form_state * | find_form_state (struct document_view *doc_view, struct el_form_control *fc) |
struct el_form_control * | find_form_control (struct document *document, struct form_state *fs) |
struct form_view * | find_form_view_in_vs (struct view_state *vs, int form_num) |
struct form_view * | find_form_view (struct document_view *doc_view, struct form *form) |
struct form * | find_form_by_form_view (struct document *document, struct form_view *fv) |
int | get_current_state (struct session *ses) |
void | draw_form_entry (struct terminal *term, struct document_view *doc_view, struct link *link) |
void | draw_forms (struct terminal *term, struct document_view *doc_view) |
static void | add_submitted_value_to_list (struct el_form_control *fc, struct form_state *fs, struct submitted_value list *list) |
static void | sort_submitted_values (struct submitted_value list *list) |
static void | get_successful_controls (struct document_view *doc_view, struct el_form_control *fc, struct submitted_value list *list) |
char * | encode_crlf (struct submitted_value *sv) |
static void | encode_controls (struct submitted_value list *l, struct string *data, int cp_from, int cp_to) |
static void | encode_multipart (struct session *ses, struct submitted_value list *l, struct string *data, struct boundary_info *boundary, struct files_offset list *bfs, int cp_from, int cp_to) |
Format a multipart/form-data body for a POST request. | |
static void | encode_newlines (struct string *string, char *data) |
static void | encode_text_plain (struct submitted_value list *l, struct string *data, int cp_from, int cp_to) |
void | do_reset_form (struct document_view *doc_view, struct form *form) |
enum frame_event_status | reset_form (struct session *ses, struct document_view *doc_view, int a) |
struct uri * | get_form_uri (struct session *ses, struct document_view *doc_view, struct el_form_control *fc) |
enum frame_event_status | submit_form (struct session *ses, struct document_view *doc_view, int do_reload) |
void | submit_given_form (struct session *ses, struct document_view *doc_view, struct form *form, int do_reload) |
void | auto_submit_form (struct session *ses) |
static void | set_file_form_state (struct terminal *term, void *filename_, void *fs_) |
static void | file_form_menu (struct terminal *term, void *path_, void *fs_) |
enum frame_event_status | field_op (struct session *ses, struct document_view *doc_view, struct link *link, struct term_event *ev) |
static char * | get_form_label (struct el_form_control *fc) |
static void | add_form_attr_to_string (struct string *string, struct terminal *term, char *name, char *value) |
char * | get_form_info (struct session *ses, struct document_view *doc_view) |
static void | link_form_menu_func (struct terminal *term, void *link_number_, void *ses_) |
void | link_form_menu (struct session *ses) |
Forms viewing/manipulation handling.
#define _GNU_SOURCE /* XXX: we want memrchr() ! */ |
#define BOUNDARY_LENGTH 32 |
#define realloc_bound_ptrs | ( | bptrs, | |
bptrs_size ) mem_align_alloc(bptrs, bptrs_size, bptrs_size + 1, 0xFF) |
|
inlinestatic |
|
static |
void auto_submit_form | ( | struct session * | ses | ) |
void do_reset_form | ( | struct document_view * | doc_view, |
struct form * | form ) |
void draw_form_entry | ( | struct terminal * | term, |
struct document_view * | doc_view, | ||
struct link * | link ) |
void draw_forms | ( | struct terminal * | term, |
struct document_view * | doc_view ) |
|
static |
char * encode_crlf | ( | struct submitted_value * | sv | ) |
|
static |
Format a multipart/form-data body for a POST request.
ses | Display an info_box() in the terminal of this session if an error occurs. | |
[in] | l | List of values to be sent to the server. |
[out] | data | Append the body here. This is in the same format as uri.post, except this never has a Content-Type at the beginning, the literal parts are not encoded in hexadecimal, and the file names are not percent-encoded. Therefore the result would be ambiguous without bfs. |
[out] | boundary | A random boundary string, and a list of offsets where the boundary was used, so that the caller can in principle change the string and update all of its uses if the original one conflicts with some of the submitted values. However, the caller does not do that nowadays because reading through the attached files would be too expensive. It just assumes the boundary is random enough. |
[out] | bfs | List of offsets of names of files to be uploaded. This is how the caller knows which occurrences of FILE_CHAR in data should be encoded and which ones should not. |
[in] | cp_from | Codepage of the submitted-value strings in l. |
[in] | cp_to | Codepage wanted by the server. |
|
static |
|
static |
enum frame_event_status field_op | ( | struct session * | ses, |
struct document_view * | doc_view, | ||
struct link * | link, | ||
struct term_event * | ev ) |
|
static |
struct el_form_control * find_form_control | ( | struct document * | document, |
struct form_state * | fs ) |
struct form_state * find_form_state | ( | struct document_view * | doc_view, |
struct el_form_control * | fc ) |
struct form_view * find_form_view | ( | struct document_view * | doc_view, |
struct form * | form ) |
struct form_view * find_form_view_in_vs | ( | struct view_state * | vs, |
int | form_num ) |
|
static |
int get_current_state | ( | struct session * | ses | ) |
char * get_form_info | ( | struct session * | ses, |
struct document_view * | doc_view ) |
|
static |
struct uri * get_form_uri | ( | struct session * | ses, |
struct document_view * | doc_view, | ||
struct el_form_control * | fc ) |
|
static |
|
static |
void link_form_menu | ( | struct session * | ses | ) |
|
static |
enum frame_event_status reset_form | ( | struct session * | ses, |
struct document_view * | doc_view, | ||
int | a ) |
void selected_item | ( | struct terminal * | term, |
void * | item_, | ||
void * | ses_ ) |
|
static |
|
static |
enum frame_event_status submit_form | ( | struct session * | ses, |
struct document_view * | doc_view, | ||
int | do_reload ) |
void submit_given_form | ( | struct session * | ses, |
struct document_view * | doc_view, | ||
struct form * | form, | ||
int | do_reload ) |