NetSurf
Data Structures | Functions
parameter.c File Reference
#include <stdlib.h>
#include <string.h>
#include "utils/http.h"
#include "utils/http/generics.h"
#include "utils/http/parameter_internal.h"
#include "utils/http/primitives.h"
Include dependency graph for parameter.c:

Go to the source code of this file.

Data Structures

struct  http_parameter
 Representation of an HTTP parameter. More...
 

Functions

static void http_destroy_parameter (http_parameter *self)
 Destructor for an HTTP parameter. More...
 
nserror http__parse_parameter (const char **input, http_parameter **parameter)
 Parse an HTTP parameter. More...
 
nserror http_parameter_list_find_item (const http_parameter *list, lwc_string *name, lwc_string **value)
 Find a named item in an HTTP parameter list. More...
 
const http_parameterhttp_parameter_list_iterate (const http_parameter *cur, lwc_string **name, lwc_string **value)
 Iterate over a parameter list. More...
 
void http_parameter_list_destroy (http_parameter *list)
 Destroy a list of HTTP parameters. More...
 

Function Documentation

◆ http__parse_parameter()

nserror http__parse_parameter ( const char **  input,
http_parameter **  parameter 
)

Parse an HTTP parameter.

Parameters
inputPointer to current input byte. Updated on exit.
parameterPointer to location to receive on-heap parameter.
Returns
NSERROR_OK on success, NSERROR_NOMEM on memory exhaustion, NSERROR_NOT_FOUND if no parameter could be parsed

The returned parameter is owned by the caller.

Definition at line 61 of file parameter.c.

References HTTP__ITEM_INIT, http__parse_quoted_string(), http__parse_token(), http__skip_LWS(), http_destroy_parameter(), http_parameter::name, NSERROR_NOMEM, NSERROR_NOT_FOUND, NSERROR_OK, and http_parameter::value.

Referenced by http__parse_challenge(), http_parse_content_disposition(), and http_parse_content_type().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ http_destroy_parameter()

static void http_destroy_parameter ( http_parameter self)
static

Destructor for an HTTP parameter.

Parameters
selfParameter to destroy

Definition at line 43 of file parameter.c.

References http_parameter::name, and http_parameter::value.

Referenced by http__parse_parameter().

Here is the caller graph for this function:

◆ http_parameter_list_destroy()

void http_parameter_list_destroy ( http_parameter list)

Destroy a list of HTTP parameters.

Parameters
listList to destroy

Definition at line 149 of file parameter.c.

References http__item_list_destroy.

Referenced by http__parse_challenge(), http_content_disposition_destroy(), http_content_type_destroy(), http_destroy_challenge(), http_parse_content_disposition(), and http_parse_content_type().

Here is the caller graph for this function:

◆ http_parameter_list_find_item()

nserror http_parameter_list_find_item ( const http_parameter list,
lwc_string *  name,
lwc_string **  value 
)

Find a named item in an HTTP parameter list.

Parameters
listList to search
nameName of item to search for
valuePointer to location to receive value
Returns
NSERROR_OK on success, NSERROR_NOT_FOUND if requested item does not exist

Definition at line 114 of file parameter.c.

References http_parameter::base, http_parameter::name, http__item::next, NSERROR_NOT_FOUND, NSERROR_OK, and http_parameter::value.

Referenced by download_context_process_headers(), html_create_html_data(), nscss_create(), and textplain_create().

Here is the caller graph for this function:

◆ http_parameter_list_iterate()

const http_parameter * http_parameter_list_iterate ( const http_parameter cur,
lwc_string **  name,
lwc_string **  value 
)

Iterate over a parameter list.

Parameters
curPointer to current iteration position, list head to start
namePointer to location to receive item name
valuePointer to location to receive item value
Returns
Pointer to next iteration position, or NULL for end of iteration

Definition at line 136 of file parameter.c.

References http_parameter::base, http_parameter::name, http__item::next, and http_parameter::value.