#include <string.h>
#include <unistd.h>
#include <signal.h>
#include "gwlib/gwlib.h"
#include "wap/wsp_headers.h"
#include "wap/wsp_strings.h"
Go to the source code of this file.
◆ main()
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 160 of file test_headers.c.
References error(), filename, get_and_set_debugs(), gwlib_init(), gwlib_shutdown(), gwlist_destroy(), gwlist_get(), gwlist_len(), octstr_compare(), octstr_create, octstr_destroy(), octstr_destroy_item(), octstr_get_cstr, octstr_read_file(), panic, split, split_headers(), test_header_combine(), WSP_1_2, wsp_headers_pack(), wsp_headers_unpack(), wsp_strings_init(), and wsp_strings_shutdown().
175 if (argc - mptr <= 0)
176 panic(0,
"Usage: test_headers [options] header-file");
185 error(0,
"Expected %ld headers, generated %ld.\n",
void error(int err, const char *fmt,...)
long gwlist_len(List *list)
void * gwlist_get(List *list, long pos)
#define octstr_get_cstr(ostr)
void octstr_destroy(Octstr *ostr)
char filename[FILENAME_MAX+1]
#define octstr_create(cstr)
void octstr_destroy_item(void *os)
Octstr * octstr_read_file(const char *filename)
void wsp_strings_shutdown(void)
void wsp_strings_init(void)
void gwlib_shutdown(void)
int get_and_set_debugs(int argc, char **argv, int(*find_own)(int index, int argc, char **argv))
int octstr_compare(const Octstr *ostr1, const Octstr *ostr2)
void gwlist_destroy(List *list, gwlist_item_destructor_t *destructor)
◆ split_headers()
static void split_headers |
( |
Octstr * |
headers, |
|
|
List ** |
split, |
|
|
List ** |
expected |
|
) |
| |
|
static |
Definition at line 118 of file test_headers.c.
References gwlist_append(), gwlist_create, octstr_copy, octstr_delete(), octstr_destroy(), octstr_duplicate, octstr_get_char(), octstr_len(), split, start, and warning().
Referenced by main().
126 for (pos = 0; pos <
octstr_len(headers); pos++) {
145 }
else if (c ==
'<') {
147 }
else if (c ==
'>') {
149 }
else if (c ==
'#') {
153 warning(0,
"Bad line in test headers file");
void gwlist_append(List *list, void *item)
#define octstr_copy(ostr, from, len)
void octstr_delete(Octstr *ostr1, long pos, long len)
#define octstr_duplicate(ostr)
void warning(int err, const char *fmt,...)
void octstr_destroy(Octstr *ostr)
long octstr_len(const Octstr *ostr)
int octstr_get_char(const Octstr *ostr, long pos)
◆ test_header_combine()
static void test_header_combine |
( |
void |
| ) |
|
|
static |
Definition at line 73 of file test_headers.c.
References error(), gwlist_get(), gwlist_len(), http_create_empty_headers(), http_destroy_headers(), http_header_add(), http_header_combine(), octstr_compare(), and octstr_imm().
Referenced by main().
90 error(0,
"http_combine_header with an empty 'old' did not just append.");
95 error(0,
"http_combine_header with an empty 'new' changed 'old'.");
109 error(0,
"http_header_combine failed.");
void error(int err, const char *fmt,...)
void http_header_add(List *headers, char *name, char *contents)
long gwlist_len(List *list)
void * gwlist_get(List *list, long pos)
void http_header_combine(List *old_headers, List *new_headers)
void http_destroy_headers(List *headers)
Octstr * octstr_imm(const char *cstr)
List * http_create_empty_headers(void)
int octstr_compare(const Octstr *ostr1, const Octstr *ostr2)