ELinks 0.18.0
header.c File Reference
#include <string.h>
#include "elinks.h"
#include "protocol/header.h"
#include "util/conv.h"
#include "util/error.h"
#include "util/memory.h"
#include "util/string.h"
Include dependency graph for header.c:

Macros

#define LWS(c)

Functions

char * parse_header (char *head, const char *item, char **ptr)
 Searches for a message-header with the specified field-name.
enum parse_header_param parse_header_param (char *str, const char *name, char **ret, int content_disposition)
char * get_header_param (char *e, const char *name)

Macro Definition Documentation

◆ LWS

#define LWS ( c)
Value:
((c) == ' ' || (c) == ASCII_TAB)
#define ASCII_TAB
Definition ascii.h:6

Function Documentation

◆ get_header_param()

char * get_header_param ( char * e,
const char * name )

◆ parse_header()

char * parse_header ( char * head,
const char * item,
char ** ptr )

Searches for a message-header with the specified field-name.

Parameters
[in]headWhere to start searching in the message received from the server. This function actually ignores the line to which head points, and starts searching from the next line. Therefore, when parsing an HTTP message, head should initially point to the start-line, e.g. "HTTP/1.1 200 OK". Alternatively, if the caller has already found a message-header and wants to know if there are any more message-headers with the same field-name, then head can be the pointer that a previous call stored in *ptr.
[in]itemThe field-name for which this function searches.
[out]ptrIf ptr is not NULL, and this function finds a message-header, then this function stores in *ptr the address at which the field-content begins; the caller may pass that as head in a later call. Otherwise, this function does not modify *ptr.
Returns
NULL if not found or out of memory. Otherwise, a copy of the field-content of the message-header; the caller must eventually mem_free() it.

The terms message-header, field-name, start-line, and field-content are defined in RFC 2616 sections 4.1 and 4.2.

◆ parse_header_param()

enum parse_header_param parse_header_param ( char * str,
const char * name,
char ** ret,
int content_disposition )