Files
wget2/libwget/private.h
Tim Rühsen 9b16dc1011 Tune cookie parsing
* include/libwget.h.in: Add sort_age to struct wget_cookie_st
* libwget/cookie.c: Many code enhancements
* libwget/http.c (wget_http_parse_setcookie): Relax parsing,
  (wget_http_parse_setcookie): Allow \n and \r\n as EOL
* libwget/private.h: Add missing #includes
* tests/Makefile.am: Add disabled test-cookies-http_state
* tests/test-cookies-http_state.c: New cookie test

There still 30 out of 220 tests failing, before this commit we had
135 failing. The left over tests are mainly corner cases, but feel free
to work on it. When all tests pass, we enable test-cookies-http_state
in Makefile.am.
2016-03-18 17:01:49 +01:00

69 lines
2.2 KiB
C

/*
* Copyright(c) 2012 Tim Ruehsen
* Copyright(c) 2015-2016 Free Software Foundation, Inc.
*
* This file is part of libwget.
*
* Libwget is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Libwget is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Libwget. If not, see <http://www.gnu.org/licenses/>.
*
*
* Header file for memory allocation routines
*
* Changelog
* 25.06.2012 Tim Ruehsen
*
*/
#ifndef _LIBWGET_PRIVATE_H
# define _LIBWGET_PRIVATE_H
# include <stdio.h> // needed for FILE
# include <stdlib.h> // needed for free()
# include <stdarg.h> // needed for va_list
// I try to never leave freed pointers hanging around
# define xfree(a) do { if (a) { free((void *)(a)); a=NULL; } } while (0)
// number of elements within an array
# define countof(a) (sizeof(a)/sizeof(*(a)))
// allow us to use wget_* functions without it's wget_ prefix within the library code
// #define _WGET_PREFIX wget_
//#define _WGET_CONCAT(a,b) a ## b
//#define _WGET_CONCAT2(a,b) _WGET_CONCAT(a,b)
// #define _GET_ADDPREFIX(a) _WGET_CONCAT2(_WGET_PREFIX,a)
// #define xmalloc _WGET_ADDPREFIX(xmalloc)
# define xmalloc wget_malloc
# define xcalloc wget_calloc
# define xrealloc wget_realloc
# define info_printf wget_info_printf
# define error_printf wget_error_printf
# define error_printf_exit wget_error_printf_exit
# define debug_printf wget_debug_printf
# define debug_write wget_debug_write
// _WGET_LOGGER is shared between log.c and logger.c, but must not be exposed to the public
struct _wget_logger_st {
FILE *fp;
const char *fname;
void (*func)(const char *buf, size_t bufsize);
void (*vprintf)(const wget_logger_t *logger, const char *fmt, va_list args) G_GNUC_WGET_PRINTF_FORMAT(2,0);
void (*write)(const wget_logger_t *logger, const char *buf, size_t bufsize);
};
#endif /* _LIBWGET_PRIVATE_H */