mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-11-15 22:08:33 +00:00
add sofia-sip 1.12.4 (plus some patches through 12/21/2006) to in tree libs
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3774 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
1 parent
0cdfa4fe13
commit
2ecac238f3
719 files changed
+311340
-2
No files matched your search
@@ -0,0 +1,7 @@
|
||||
2005-11-08 Pekka Pessi <Pekka.Pessi@nokia.com>
|
||||
|
||||
* Renamed http_test.c as test_http.c
|
||||
|
||||
2005-07-18 Kai Vehmanen <kai.vehmanen@nokia.com>
|
||||
|
||||
* Initial import of the module to Sofia-SIP tree.
|
||||
@@ -0,0 +1,18 @@
|
||||
PROJECT_NAME = "http"
|
||||
OUTPUT_DIRECTORY = ../docs/html/http
|
||||
|
||||
INPUT = http.docs sofia-sip .
|
||||
|
||||
@INCLUDE = ../docs/Doxyfile.conf
|
||||
|
||||
TAGFILES += \
|
||||
../docs/su.doxytags=../su \
|
||||
../docs/ipt.doxytags=../ipt \
|
||||
../docs/bnf.doxytags=../bnf \
|
||||
../docs/url.doxytags=../url \
|
||||
../docs/msg.doxytags=../msg
|
||||
|
||||
GENERATE_TAGFILE = ../docs/http.doxytags
|
||||
|
||||
ALIASES += \
|
||||
"HTTP_HEADER=@ingroup http_headers\n@defgroup" \
|
||||
@@ -0,0 +1,93 @@
|
||||
#
|
||||
# Makefile.am for http module
|
||||
#
|
||||
# Copyright (C) 2005,2006 Nokia Corporation
|
||||
# Contact: Pekka Pessi <pekka.pessi@nokia.com>
|
||||
# Licensed under LGPL. See file COPYING.
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Header paths
|
||||
|
||||
INCLUDES = -I$(srcdir)/../bnf -I../bnf \
|
||||
-I$(srcdir)/../msg -I../msg \
|
||||
-I$(srcdir)/../url -I../url \
|
||||
-I$(srcdir)/../su -I../su -I../su
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Build targets
|
||||
|
||||
noinst_LTLIBRARIES = libhttp.la
|
||||
|
||||
check_PROGRAMS = test_http
|
||||
|
||||
TESTS = test_http
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Rules for building the targets
|
||||
|
||||
PUBLIC_H = sofia-sip/http.h sofia-sip/http_header.h \
|
||||
sofia-sip/http_parser.h sofia-sip/http_tag_class.h \
|
||||
sofia-sip/http_status.h sofia-sip/http_hclasses.h
|
||||
|
||||
BUILT_H = sofia-sip/http_protos.h sofia-sip/http_tag.h
|
||||
BUILT_C = http_tag.c http_tag_ref.c http_parser_table.c
|
||||
|
||||
BUILT_SOURCES = $(BUILT_H) $(BUILT_C)
|
||||
|
||||
nobase_include_sofia_HEADERS = $(BUILT_H) $(PUBLIC_H)
|
||||
|
||||
libhttp_la_SOURCES = $(INTERNAL_H) \
|
||||
http_parser.c http_header.c \
|
||||
http_basic.c http_extra.c \
|
||||
http_status.c http_tag_class.c \
|
||||
$(BUILT_C)
|
||||
|
||||
COVERAGE_INPUT = $(libhttp_la_SOURCES) $(include_sofia_HEADERS)
|
||||
|
||||
LDADD = libhttp.la \
|
||||
../bnf/libbnf.la \
|
||||
../msg/libmsg.la \
|
||||
../url/liburl.la \
|
||||
../su/libsu.la
|
||||
|
||||
test_http_LDFLAGS = -static
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Install and distribution rules
|
||||
|
||||
EXTRA_DIST = Doxyfile http.docs \
|
||||
sofia-sip/http_protos.h.in \
|
||||
sofia-sip/http_tag.h.in \
|
||||
http_parser_table.c.in \
|
||||
http_tag.c.in
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Sofia specific rules
|
||||
|
||||
include ../sofia.am
|
||||
|
||||
TAG_DLL_FLAGS = DLLREF=1
|
||||
|
||||
MSG_PARSER_AWK = $(srcdir)/../msg/msg_parser.awk
|
||||
|
||||
AWK_HTTP_AWK = $(AWK) -f $(MSG_PARSER_AWK) module=http
|
||||
|
||||
sofia-sip/http_tag.h: sofia-sip/http_tag.h.in $(MSG_PARSER_AWK)
|
||||
sofia-sip/http_protos.h: sofia-sip/http_protos.h.in $(MSG_PARSER_AWK)
|
||||
http_tag.c: http_tag.c.in $(MSG_PARSER_AWK)
|
||||
http_parser_table.c: http_parser_table.c.in $(MSG_PARSER_AWK)
|
||||
|
||||
sofia-sip/http_protos.h: sofia-sip/http.h
|
||||
@-mkdir sofia-sip 2>/dev/null || true
|
||||
$(AWK_HTTP_AWK) PR=$@ TEMPLATE=$(srcdir)/sofia-sip/http_protos.h.in $<
|
||||
|
||||
sofia-sip/http_tag.h: sofia-sip/http.h
|
||||
@-mkdir sofia-sip 2>/dev/null || true
|
||||
$(AWK_HTTP_AWK) PR=$@ TEMPLATE=$(srcdir)/sofia-sip/http_tag.h.in $<
|
||||
|
||||
http_tag.c: sofia-sip/http.h
|
||||
$(AWK_HTTP_AWK) PR=$@ TEMPLATE=$(srcdir)/http_tag.c.in $<
|
||||
|
||||
http_parser_table.c: sofia-sip/http.h
|
||||
$(AWK_HTTP_AWK) PT=$@ TEMPLATE=$(srcdir)/http_parser_table.c.in \
|
||||
MC_HASH_SIZE=127 $<
|
||||
@@ -0,0 +1,747 @@
|
||||
# Makefile.in generated by automake 1.9.2 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
#
|
||||
# Makefile.am for http module
|
||||
#
|
||||
# Copyright (C) 2005,2006 Nokia Corporation
|
||||
# Contact: Pekka Pessi <pekka.pessi@nokia.com>
|
||||
# Licensed under LGPL. See file COPYING.
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Header paths
|
||||
|
||||
# common Makefile targets for libsofia-sip-ua modules
|
||||
# ---------------------------------------------------
|
||||
|
||||
|
||||
SOURCES = $(libhttp_la_SOURCES) test_http.c
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
top_builddir = ../..
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
INSTALL = @INSTALL@
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
target_triplet = @target@
|
||||
check_PROGRAMS = test_http$(EXEEXT)
|
||||
DIST_COMMON = $(nobase_include_sofia_HEADERS) $(srcdir)/../sofia.am \
|
||||
$(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog
|
||||
subdir = libsofia-sip-ua/http
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/sac-general.m4 \
|
||||
$(top_srcdir)/m4/sac-openssl.m4 $(top_srcdir)/m4/sac-su.m4 \
|
||||
$(top_srcdir)/m4/sac-su2.m4 $(top_srcdir)/m4/sac-tport.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h \
|
||||
$(top_builddir)/libsofia-sip-ua/su/sofia-sip/su_configure.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
LTLIBRARIES = $(noinst_LTLIBRARIES)
|
||||
libhttp_la_LIBADD =
|
||||
am__objects_1 = http_tag.lo http_tag_ref.lo http_parser_table.lo
|
||||
am_libhttp_la_OBJECTS = http_parser.lo http_header.lo http_basic.lo \
|
||||
http_extra.lo http_status.lo http_tag_class.lo \
|
||||
$(am__objects_1)
|
||||
libhttp_la_OBJECTS = $(am_libhttp_la_OBJECTS)
|
||||
test_http_SOURCES = test_http.c
|
||||
test_http_OBJECTS = test_http.$(OBJEXT)
|
||||
test_http_LDADD = $(LDADD)
|
||||
test_http_DEPENDENCIES = libhttp.la ../bnf/libbnf.la ../msg/libmsg.la \
|
||||
../url/liburl.la ../su/libsu.la
|
||||
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -I$(top_builddir)/libsofia-sip-ua/su/sofia-sip
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) \
|
||||
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
|
||||
$(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
LINK = $(LIBTOOL) --mode=link --tag=CC $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
SOURCES = $(libhttp_la_SOURCES) test_http.c
|
||||
DIST_SOURCES = $(libhttp_la_SOURCES) test_http.c
|
||||
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
||||
am__vpath_adj = case $$p in \
|
||||
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
*) f=$$p;; \
|
||||
esac;
|
||||
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
|
||||
am__installdirs = "$(DESTDIR)$(include_sofiadir)"
|
||||
nobase_include_sofiaHEADERS_INSTALL = $(install_sh_DATA)
|
||||
HEADERS = $(nobase_include_sofia_HEADERS)
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@
|
||||
AMDEP_FALSE = @AMDEP_FALSE@
|
||||
AMDEP_TRUE = @AMDEP_TRUE@
|
||||
AMTAR = @AMTAR@
|
||||
AR = @AR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
COREFOUNDATION_FALSE = @COREFOUNDATION_FALSE@
|
||||
COREFOUNDATION_TRUE = @COREFOUNDATION_TRUE@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CWFLAG = @CWFLAG@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DOXYGEN = @DOXYGEN@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
ENABLE_COVERAGE_FALSE = @ENABLE_COVERAGE_FALSE@
|
||||
ENABLE_COVERAGE_TRUE = @ENABLE_COVERAGE_TRUE@
|
||||
ETAGS = @ETAGS@
|
||||
EXEEXT = @EXEEXT@
|
||||
EXPENSIVE_CHECKS_FALSE = @EXPENSIVE_CHECKS_FALSE@
|
||||
EXPENSIVE_CHECKS_TRUE = @EXPENSIVE_CHECKS_TRUE@
|
||||
F77 = @F77@
|
||||
FFLAGS = @FFLAGS@
|
||||
GLIB_CFLAGS = @GLIB_CFLAGS@
|
||||
GLIB_LIBS = @GLIB_LIBS@
|
||||
GLIB_VERSION = @GLIB_VERSION@
|
||||
HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@
|
||||
HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@
|
||||
HAVE_GLIB_FALSE = @HAVE_GLIB_FALSE@
|
||||
HAVE_GLIB_TRUE = @HAVE_GLIB_TRUE@
|
||||
HAVE_MINGW32_FALSE = @HAVE_MINGW32_FALSE@
|
||||
HAVE_MINGW32_TRUE = @HAVE_MINGW32_TRUE@
|
||||
HAVE_NTLM_FALSE = @HAVE_NTLM_FALSE@
|
||||
HAVE_NTLM_TRUE = @HAVE_NTLM_TRUE@
|
||||
HAVE_TLS_FALSE = @HAVE_TLS_FALSE@
|
||||
HAVE_TLS_TRUE = @HAVE_TLS_TRUE@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIBVER_SOFIA_SIP_UA_AGE = @LIBVER_SOFIA_SIP_UA_AGE@
|
||||
LIBVER_SOFIA_SIP_UA_CUR = @LIBVER_SOFIA_SIP_UA_CUR@
|
||||
LIBVER_SOFIA_SIP_UA_GLIB_AGE = @LIBVER_SOFIA_SIP_UA_GLIB_AGE@
|
||||
LIBVER_SOFIA_SIP_UA_GLIB_CUR = @LIBVER_SOFIA_SIP_UA_GLIB_CUR@
|
||||
LIBVER_SOFIA_SIP_UA_GLIB_REV = @LIBVER_SOFIA_SIP_UA_GLIB_REV@
|
||||
LIBVER_SOFIA_SIP_UA_GLIB_SOVER = @LIBVER_SOFIA_SIP_UA_GLIB_SOVER@
|
||||
LIBVER_SOFIA_SIP_UA_REV = @LIBVER_SOFIA_SIP_UA_REV@
|
||||
LIBVER_SOFIA_SIP_UA_SOVER = @LIBVER_SOFIA_SIP_UA_SOVER@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAINT = @MAINT@
|
||||
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
|
||||
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MINGW_ENVIRONMENT = @MINGW_ENVIRONMENT@
|
||||
MOSTLYCLEANFILES = @MOSTLYCLEANFILES@
|
||||
NDEBUG_FALSE = @NDEBUG_FALSE@
|
||||
NDEBUG_TRUE = @NDEBUG_TRUE@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
PKG_CONFIG = @PKG_CONFIG@
|
||||
RANLIB = @RANLIB@
|
||||
REPLACE_LIBADD = @REPLACE_LIBADD@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
SOFIA_CFLAGS = @SOFIA_CFLAGS@
|
||||
SOFIA_GLIB_PKG_REQUIRES = @SOFIA_GLIB_PKG_REQUIRES@
|
||||
STRIP = @STRIP@
|
||||
TESTS_ENVIRONMENT = @TESTS_ENVIRONMENT@
|
||||
VERSION = @VERSION@
|
||||
VER_LIBSOFIA_SIP_UA_MAJOR_MINOR = @VER_LIBSOFIA_SIP_UA_MAJOR_MINOR@
|
||||
ac_ct_AR = @ac_ct_AR@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
ac_ct_F77 = @ac_ct_F77@
|
||||
ac_ct_LD = @ac_ct_LD@
|
||||
ac_ct_RANLIB = @ac_ct_RANLIB@
|
||||
ac_ct_STRIP = @ac_ct_STRIP@
|
||||
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
|
||||
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
|
||||
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
|
||||
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
datadir = @datadir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
include_sofiadir = @include_sofiadir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target = @target@
|
||||
target_alias = @target_alias@
|
||||
target_cpu = @target_cpu@
|
||||
target_os = @target_os@
|
||||
target_vendor = @target_vendor@
|
||||
INCLUDES = -I$(srcdir)/../bnf -I../bnf \
|
||||
-I$(srcdir)/../msg -I../msg \
|
||||
-I$(srcdir)/../url -I../url \
|
||||
-I$(srcdir)/../su -I../su -I../su
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Build targets
|
||||
noinst_LTLIBRARIES = libhttp.la
|
||||
TESTS = test_http
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Rules for building the targets
|
||||
PUBLIC_H = sofia-sip/http.h sofia-sip/http_header.h \
|
||||
sofia-sip/http_parser.h sofia-sip/http_tag_class.h \
|
||||
sofia-sip/http_status.h sofia-sip/http_hclasses.h
|
||||
|
||||
BUILT_H = sofia-sip/http_protos.h sofia-sip/http_tag.h
|
||||
BUILT_C = http_tag.c http_tag_ref.c http_parser_table.c
|
||||
BUILT_SOURCES = $(BUILT_H) $(BUILT_C)
|
||||
nobase_include_sofia_HEADERS = $(BUILT_H) $(PUBLIC_H)
|
||||
libhttp_la_SOURCES = $(INTERNAL_H) \
|
||||
http_parser.c http_header.c \
|
||||
http_basic.c http_extra.c \
|
||||
http_status.c http_tag_class.c \
|
||||
$(BUILT_C)
|
||||
|
||||
COVERAGE_INPUT = $(libhttp_la_SOURCES) $(include_sofia_HEADERS)
|
||||
LDADD = libhttp.la \
|
||||
../bnf/libbnf.la \
|
||||
../msg/libmsg.la \
|
||||
../url/liburl.la \
|
||||
../su/libsu.la
|
||||
|
||||
test_http_LDFLAGS = -static
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Install and distribution rules
|
||||
EXTRA_DIST = Doxyfile http.docs \
|
||||
sofia-sip/http_protos.h.in \
|
||||
sofia-sip/http_tag.h.in \
|
||||
http_parser_table.c.in \
|
||||
http_tag.c.in
|
||||
|
||||
AM_CFLAGS = $(CWFLAG) $(SOFIA_CFLAGS)
|
||||
DISTCLEANFILES = $(BUILT_SOURCES)
|
||||
|
||||
# rules for building tag files
|
||||
TAG_AWK = $(top_srcdir)/libsofia-sip-ua/su/tag_dll.awk
|
||||
INTERNAL_INCLUDES = \
|
||||
-I$(srcdir)/../features -I../features \
|
||||
-I$(srcdir)/../ipt -I../ipt \
|
||||
-I$(srcdir)/../iptsec -I../iptsec \
|
||||
-I$(srcdir)/../bnf -I../bnf \
|
||||
-I$(srcdir)/../http -I../http \
|
||||
-I$(srcdir)/../msg -I../msg \
|
||||
-I$(srcdir)/../nth -I../nth \
|
||||
-I$(srcdir)/../nta -I../nta \
|
||||
-I$(srcdir)/../nea -I../nea \
|
||||
-I$(srcdir)/../nua -I../nua \
|
||||
-I$(srcdir)/../soa -I../soa \
|
||||
-I$(srcdir)/../sdp -I../sdp \
|
||||
-I$(srcdir)/../sip -I../sip \
|
||||
-I$(srcdir)/../soa -I../soa \
|
||||
-I$(srcdir)/../sresolv -I../sresolv \
|
||||
-I$(srcdir)/../tport -I../tport \
|
||||
-I$(srcdir)/../stun -I../stun \
|
||||
-I$(srcdir)/../url -I../url \
|
||||
-I$(srcdir)/../su -I../su
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Sofia specific rules
|
||||
TAG_DLL_FLAGS = DLLREF=1
|
||||
MSG_PARSER_AWK = $(srcdir)/../msg/msg_parser.awk
|
||||
AWK_HTTP_AWK = $(AWK) -f $(MSG_PARSER_AWK) module=http
|
||||
all: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .lo .o .obj
|
||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../sofia.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
|
||||
&& exit 0; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libsofia-sip-ua/http/Makefile'; \
|
||||
cd $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu libsofia-sip-ua/http/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
clean-noinstLTLIBRARIES:
|
||||
-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
|
||||
@list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
|
||||
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
|
||||
test "$$dir" != "$$p" || dir=.; \
|
||||
echo "rm -f \"$${dir}/so_locations\""; \
|
||||
rm -f "$${dir}/so_locations"; \
|
||||
done
|
||||
libhttp.la: $(libhttp_la_OBJECTS) $(libhttp_la_DEPENDENCIES)
|
||||
$(LINK) $(libhttp_la_LDFLAGS) $(libhttp_la_OBJECTS) $(libhttp_la_LIBADD) $(LIBS)
|
||||
|
||||
clean-checkPROGRAMS:
|
||||
@list='$(check_PROGRAMS)'; for p in $$list; do \
|
||||
f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
|
||||
echo " rm -f $$p $$f"; \
|
||||
rm -f $$p $$f ; \
|
||||
done
|
||||
test_http$(EXEEXT): $(test_http_OBJECTS) $(test_http_DEPENDENCIES)
|
||||
@rm -f test_http$(EXEEXT)
|
||||
$(LINK) $(test_http_LDFLAGS) $(test_http_OBJECTS) $(test_http_LDADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/http_basic.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/http_extra.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/http_header.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/http_parser.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/http_parser_table.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/http_status.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/http_tag.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/http_tag_class.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/http_tag_ref.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_http.Po@am__quote@
|
||||
|
||||
.c.o:
|
||||
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
|
||||
|
||||
.c.obj:
|
||||
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
|
||||
|
||||
.c.lo:
|
||||
@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
distclean-libtool:
|
||||
-rm -f libtool
|
||||
uninstall-info-am:
|
||||
install-nobase_include_sofiaHEADERS: $(nobase_include_sofia_HEADERS)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(include_sofiadir)" || $(mkdir_p) "$(DESTDIR)$(include_sofiadir)"
|
||||
@$(am__vpath_adj_setup) \
|
||||
list='$(nobase_include_sofia_HEADERS)'; for p in $$list; do \
|
||||
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
|
||||
$(am__vpath_adj) \
|
||||
echo " $(nobase_include_sofiaHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(include_sofiadir)/$$f'"; \
|
||||
$(nobase_include_sofiaHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(include_sofiadir)/$$f"; \
|
||||
done
|
||||
|
||||
uninstall-nobase_include_sofiaHEADERS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@$(am__vpath_adj_setup) \
|
||||
list='$(nobase_include_sofia_HEADERS)'; for p in $$list; do \
|
||||
$(am__vpath_adj) \
|
||||
echo " rm -f '$(DESTDIR)$(include_sofiadir)/$$f'"; \
|
||||
rm -f "$(DESTDIR)$(include_sofiadir)/$$f"; \
|
||||
done
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
mkid -fID $$unique
|
||||
tags: TAGS
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$tags $$unique; \
|
||||
fi
|
||||
ctags: CTAGS
|
||||
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$tags $$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& cd $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) $$here
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
check-TESTS: $(TESTS)
|
||||
@failed=0; all=0; xfail=0; xpass=0; skip=0; \
|
||||
srcdir=$(srcdir); export srcdir; \
|
||||
list='$(TESTS)'; \
|
||||
if test -n "$$list"; then \
|
||||
for tst in $$list; do \
|
||||
if test -f ./$$tst; then dir=./; \
|
||||
elif test -f $$tst; then dir=; \
|
||||
else dir="$(srcdir)/"; fi; \
|
||||
if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
|
||||
all=`expr $$all + 1`; \
|
||||
case " $(XFAIL_TESTS) " in \
|
||||
*" $$tst "*) \
|
||||
xpass=`expr $$xpass + 1`; \
|
||||
failed=`expr $$failed + 1`; \
|
||||
echo "XPASS: $$tst"; \
|
||||
;; \
|
||||
*) \
|
||||
echo "PASS: $$tst"; \
|
||||
;; \
|
||||
esac; \
|
||||
elif test $$? -ne 77; then \
|
||||
all=`expr $$all + 1`; \
|
||||
case " $(XFAIL_TESTS) " in \
|
||||
*" $$tst "*) \
|
||||
xfail=`expr $$xfail + 1`; \
|
||||
echo "XFAIL: $$tst"; \
|
||||
;; \
|
||||
*) \
|
||||
failed=`expr $$failed + 1`; \
|
||||
echo "FAIL: $$tst"; \
|
||||
;; \
|
||||
esac; \
|
||||
else \
|
||||
skip=`expr $$skip + 1`; \
|
||||
echo "SKIP: $$tst"; \
|
||||
fi; \
|
||||
done; \
|
||||
if test "$$failed" -eq 0; then \
|
||||
if test "$$xfail" -eq 0; then \
|
||||
banner="All $$all tests passed"; \
|
||||
else \
|
||||
banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
|
||||
fi; \
|
||||
else \
|
||||
if test "$$xpass" -eq 0; then \
|
||||
banner="$$failed of $$all tests failed"; \
|
||||
else \
|
||||
banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
|
||||
fi; \
|
||||
fi; \
|
||||
dashes="$$banner"; \
|
||||
skipped=""; \
|
||||
if test "$$skip" -ne 0; then \
|
||||
skipped="($$skip tests were not run)"; \
|
||||
test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
|
||||
dashes="$$skipped"; \
|
||||
fi; \
|
||||
report=""; \
|
||||
if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
|
||||
report="Please report to $(PACKAGE_BUGREPORT)"; \
|
||||
test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
|
||||
dashes="$$report"; \
|
||||
fi; \
|
||||
dashes=`echo "$$dashes" | sed s/./=/g`; \
|
||||
echo "$$dashes"; \
|
||||
echo "$$banner"; \
|
||||
test -z "$$skipped" || echo "$$skipped"; \
|
||||
test -z "$$report" || echo "$$report"; \
|
||||
echo "$$dashes"; \
|
||||
test "$$failed" -eq 0; \
|
||||
else :; fi
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
$(mkdir_p) $(distdir)/.. $(distdir)/sofia-sip
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
|
||||
list='$(DISTFILES)'; for file in $$list; do \
|
||||
case $$file in \
|
||||
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
|
||||
esac; \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
||||
dir="/$$dir"; \
|
||||
$(mkdir_p) "$(distdir)$$dir"; \
|
||||
else \
|
||||
dir=''; \
|
||||
fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
|
||||
fi; \
|
||||
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
|
||||
$(MAKE) $(AM_MAKEFLAGS) check-TESTS
|
||||
check: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) check-am
|
||||
all-am: Makefile $(LTLIBRARIES) $(HEADERS)
|
||||
installdirs:
|
||||
for dir in "$(DESTDIR)$(include_sofiadir)"; do \
|
||||
test -z "$$dir" || $(mkdir_p) "$$dir"; \
|
||||
done
|
||||
install: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
|
||||
clean-noinstLTLIBRARIES mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-libtool distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am: install-nobase_include_sofiaHEADERS
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-man:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
|
||||
mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-info-am uninstall-nobase_include_sofiaHEADERS
|
||||
|
||||
.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
|
||||
clean-checkPROGRAMS clean-generic clean-libtool \
|
||||
clean-noinstLTLIBRARIES ctags distclean distclean-compile \
|
||||
distclean-generic distclean-libtool distclean-tags distdir dvi \
|
||||
dvi-am html html-am info info-am install install-am \
|
||||
install-data install-data-am install-exec install-exec-am \
|
||||
install-info install-info-am install-man \
|
||||
install-nobase_include_sofiaHEADERS install-strip installcheck \
|
||||
installcheck-am installdirs maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-compile \
|
||||
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
|
||||
tags uninstall uninstall-am uninstall-info-am \
|
||||
uninstall-nobase_include_sofiaHEADERS
|
||||
|
||||
|
||||
built-sources: $(BUILT_SOURCES)
|
||||
|
||||
clean-built-sources:
|
||||
-rm -rf $(BUILT_SOURCES) $(BUILT_SOURCES:%=$(srcdir)/%)
|
||||
|
||||
*_tag_ref.c: $(TAG_AWK)
|
||||
|
||||
%_tag_ref.c: %_tag.c
|
||||
$(AWK) -f $(TAG_AWK) NODLL=1 $(TAG_DLL_FLAGS) $<
|
||||
|
||||
@ENABLE_COVERAGE_TRUE@coverage:
|
||||
@ENABLE_COVERAGE_TRUE@ @$(top_srcdir)/scripts/coverage $(COVERAGE_FLAGS) $(COVERAGE_INPUT)
|
||||
|
||||
../bnf/libbnf.la ../http/libhttp.la ../ipt/libipt.la ../iptsec/libiptsec.la \
|
||||
../msg/libmsg.la ../nea/libnea.la ../nta/libnta.la ../nth/libnth.la \
|
||||
../nua/libnua.la ../sdp/libsdp.la ../sip/libsip.la ../soa/libsoa.la \
|
||||
../sresolv/libsresolv.la ../stun/libstun.la ../su/libsu.la \
|
||||
../tport/libtport.la ../url/liburl.la:
|
||||
$(MAKE) -C $(@D) $(@F)
|
||||
|
||||
sofia-sip/http_tag.h: sofia-sip/http_tag.h.in $(MSG_PARSER_AWK)
|
||||
sofia-sip/http_protos.h: sofia-sip/http_protos.h.in $(MSG_PARSER_AWK)
|
||||
http_tag.c: http_tag.c.in $(MSG_PARSER_AWK)
|
||||
http_parser_table.c: http_parser_table.c.in $(MSG_PARSER_AWK)
|
||||
|
||||
sofia-sip/http_protos.h: sofia-sip/http.h
|
||||
@-mkdir sofia-sip 2>/dev/null || true
|
||||
$(AWK_HTTP_AWK) PR=$@ TEMPLATE=$(srcdir)/sofia-sip/http_protos.h.in $<
|
||||
|
||||
sofia-sip/http_tag.h: sofia-sip/http.h
|
||||
@-mkdir sofia-sip 2>/dev/null || true
|
||||
$(AWK_HTTP_AWK) PR=$@ TEMPLATE=$(srcdir)/sofia-sip/http_tag.h.in $<
|
||||
|
||||
http_tag.c: sofia-sip/http.h
|
||||
$(AWK_HTTP_AWK) PR=$@ TEMPLATE=$(srcdir)/http_tag.c.in $<
|
||||
|
||||
http_parser_table.c: sofia-sip/http.h
|
||||
$(AWK_HTTP_AWK) PT=$@ TEMPLATE=$(srcdir)/http_parser_table.c.in \
|
||||
MC_HASH_SIZE=127 $<
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
@@ -0,0 +1,48 @@
|
||||
accept Accept
|
||||
accept_charset Accept-Charset
|
||||
accept_encoding Accept-Encoding
|
||||
accept_language Accept-Language
|
||||
accept_ranges Accept-Ranges
|
||||
age Age
|
||||
allow Allow
|
||||
authorization Authorization
|
||||
cache_control Cache-Control
|
||||
connection Connection
|
||||
content_encoding Content-Encoding
|
||||
content_language Content-Language
|
||||
content_length Content-Length
|
||||
content_location Content-Location
|
||||
content_md5 Content-MD5
|
||||
content_range Content-Range
|
||||
content_type Content-Type
|
||||
date Date
|
||||
etag ETag
|
||||
expect Expect
|
||||
expires Expires
|
||||
from From
|
||||
host Host
|
||||
if_match If-Match
|
||||
if_modified_since If-Modified-Since
|
||||
if_none_match If-None-Match
|
||||
if_range If-Range
|
||||
if_unmodified_since If-Unmodified-Since
|
||||
last_modified Last-Modified
|
||||
location Location
|
||||
max_forwards Max-Forwards
|
||||
mime_version MIME-Version
|
||||
pragma Pragma
|
||||
pr_authenticate Proxy-Authenticate
|
||||
pr_authorization Proxy-Authorization
|
||||
range Range
|
||||
referer Referer
|
||||
retry_after Retry-After
|
||||
server Server
|
||||
te TE
|
||||
trailer Trailer
|
||||
transfer_encoding Transfer-Encoding
|
||||
upgrade Upgrade
|
||||
user_agent User-Agent
|
||||
vary Vary
|
||||
via Via
|
||||
warning Warning
|
||||
www_authenticate WWW-Authenticate
|
||||
@@ -0,0 +1,17 @@
|
||||
; Template for http.def
|
||||
|
||||
LIBRARY "http"
|
||||
|
||||
DESCRIPTION 'HTTP Win32 Dynamic Link Library'
|
||||
|
||||
EXPORTS
|
||||
; Explicit exports can go here
|
||||
|
||||
http_default_mclass
|
||||
|
||||
sip_#xxxxxx#_class
|
||||
sip_#xxxxxx#_p
|
||||
sip_#xxxxxx#_dup
|
||||
sip_#xxxxxx#_copy
|
||||
sip_#xxxxxx#_make
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
/* -*- c -*- */
|
||||
|
||||
/**@MODULEPAGE "http" - HTTP Parser Module
|
||||
*
|
||||
* @section http_meta Module Meta Information
|
||||
*
|
||||
* The @b http module contains interface to the HTTP parser and the header
|
||||
* and message objects.
|
||||
*
|
||||
* @CONTACT Pekka Pessi <Pekka.Pessi@nokia.com>
|
||||
*
|
||||
* @STATUS @SofiaSIP Core library
|
||||
*
|
||||
* @LICENSE LGPL
|
||||
*
|
||||
* @section http_overview Overview
|
||||
*
|
||||
* Each HTTP header has a structure defined for it in <http.h>. All the
|
||||
* variables, objects and functions related to a particular HTTP header are
|
||||
* documented in a <a href="modules.html">submodule</a> for the header. In
|
||||
* addition to the header structure, there is defined a @em header @em class
|
||||
* structure and some standard functions for each header in the
|
||||
* <http_header.h> include file. For header @c X, there are types,
|
||||
* functions, macros and header class as follows:
|
||||
*
|
||||
* - @c http_X_t is the structure used to store parsed header,
|
||||
* - @c HTTP_X_INIT() initializes a static instance of http_X_t,
|
||||
* - @c http_X_p() tests if header object is instance of header X,
|
||||
* - @c http_X_make() is a macro that creates a header X object by
|
||||
decoding given string,
|
||||
* - @c http_X_dup() duplicates (deeply copies) the header X (macro),
|
||||
* - @c http_X_copy() is a macro that copies the header X (macro),
|
||||
* - @c #msg_hclass_t http_X_class[] contains the @em header @em class
|
||||
* for header X.
|
||||
*
|
||||
* In addition to this interface, the parser provider interface is
|
||||
* documented in the <a href="../sip/group__sip__parser.html">SIP Parser module</a>.
|
||||
* The parser provider interface makes it possible to extend HTTP parser with
|
||||
* new headers or extend existing ones.
|
||||
*/
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,469 @@
|
||||
/*
|
||||
* This file is part of the Sofia-SIP package
|
||||
*
|
||||
* Copyright (C) 2005 Nokia Corporation.
|
||||
*
|
||||
* Contact: Pekka Pessi <pekka.pessi@nokia.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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 this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
/**@CFILE http_extra.c
|
||||
*
|
||||
* Extra HTTP headers
|
||||
*
|
||||
* @author Pekka Pessi <Pekka.Pessi@nokia.com>
|
||||
*
|
||||
* @date Created: Tue Jun 13 02:57:51 2000 ppessi
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#include <assert.h>
|
||||
|
||||
/* Avoid casting http_t to msg_pub_t and http_header_t to msg_header_t */
|
||||
#define MSG_PUB_T struct http_s
|
||||
#define MSG_HDR_T union http_header_u
|
||||
|
||||
#include "sofia-sip/http_parser.h"
|
||||
|
||||
/* ========================================================================== */
|
||||
|
||||
/**@HTTP_HEADER http_proxy_connection Proxy-Connection extension header. */
|
||||
|
||||
#define http_proxy_connection_d msg_list_d
|
||||
#define http_proxy_connection_e msg_list_e
|
||||
msg_hclass_t http_proxy_connection_class[] =
|
||||
HTTP_HEADER_CLASS_LIST(proxy_connection, "Proxy-Connection", list);
|
||||
|
||||
/* ====================================================================== */
|
||||
/**@HTTP_HEADER http_cookie Cookie extension header.
|
||||
*
|
||||
* The Cookie header is used to transmit state information from server
|
||||
* back to the http client. Its syntax is defined in RFC 2109 section 4.3.4
|
||||
* as follows:
|
||||
*
|
||||
* @code
|
||||
* cookie = "Cookie:" cookie-version
|
||||
* 1*((";" | ",") cookie-value)
|
||||
* cookie-value = NAME "=" VALUE [";" path] [";" domain]
|
||||
* cookie-version = "$Version" "=" value
|
||||
* NAME = attr
|
||||
* VALUE = value
|
||||
* path = "$Path" "=" value
|
||||
* domain = "$Domain" "=" value
|
||||
* @endcode
|
||||
*
|
||||
*/
|
||||
|
||||
/**@ingroup http_cookie
|
||||
*
|
||||
* @typedef typedef struct http_cookie_s http_cookie_t;
|
||||
*
|
||||
* The structure http_cookie_t contains representation of @b Cookie
|
||||
* header. Please note that a single http_cookie_t can contain many
|
||||
* cookies.
|
||||
*
|
||||
* The http_cookie_t is defined as follows:
|
||||
* @code
|
||||
* typedef struct http_cookie_s
|
||||
* {
|
||||
* } http_cookie_t;
|
||||
* @endcode
|
||||
*/
|
||||
|
||||
/**Update Cookie parameters.
|
||||
*
|
||||
* The function http_cookie_update() updates a @b Cookie parameter
|
||||
* shortcuts.
|
||||
*
|
||||
* @param sc pointer to a @c http_cookie_t object
|
||||
*/
|
||||
static inline
|
||||
void http_cookie_update(http_cookie_t *c)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
c->c_name = NULL;
|
||||
c->c_version = NULL, c->c_domain = NULL, c->c_path = NULL;
|
||||
|
||||
if (!c->c_params)
|
||||
return;
|
||||
|
||||
if (!(MSG_PARAM_MATCH(c->c_version, c->c_params[0], "$Version")))
|
||||
return;
|
||||
if (!c->c_params[1] || c->c_params[1][0] == '$')
|
||||
return;
|
||||
|
||||
c->c_name = c->c_params[1];
|
||||
|
||||
for (i = 2; ; i++) {
|
||||
msg_param_t p = c->c_params[i];
|
||||
if (!p || *p++ != '$')
|
||||
break;
|
||||
switch (p[0]) {
|
||||
case 'd': case 'D':
|
||||
MSG_PARAM_MATCH(c->c_domain, p, "Domain");
|
||||
break;
|
||||
case 'p': case 'P':
|
||||
MSG_PARAM_MATCH(c->c_path, p, "Path");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Scan a cookie parameter */
|
||||
static issize_t cookie_scanner(char *s)
|
||||
{
|
||||
char *p = s;
|
||||
size_t tlen;
|
||||
|
||||
skip_token(&s);
|
||||
|
||||
if (s == p) /* invalid parameter name */
|
||||
return -1;
|
||||
|
||||
tlen = s - p;
|
||||
|
||||
if (IS_LWS(*s)) { *s++ = '\0'; skip_lws(&s); }
|
||||
|
||||
if (*s == '=') {
|
||||
char *v;
|
||||
s++;
|
||||
skip_lws(&s);
|
||||
|
||||
v = s;
|
||||
|
||||
/* get value */
|
||||
if (*s == '"') {
|
||||
size_t qlen = span_quoted(s);
|
||||
if (!qlen)
|
||||
return -1;
|
||||
s += qlen;
|
||||
}
|
||||
else {
|
||||
s += strcspn(s, ",;" LWS);
|
||||
if (s == v)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (p + tlen + 1 != v) {
|
||||
memmove(p + tlen + 1, v, s - v);
|
||||
p[tlen] = '=';
|
||||
p[tlen + 1 + (s - v)] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
if (IS_LWS(*s)) { *s++ = '\0'; skip_lws(&s); }
|
||||
|
||||
return s - p;
|
||||
}
|
||||
|
||||
/** Decode (parse) a Cookie header */
|
||||
issize_t http_cookie_d(su_home_t *home, msg_header_t *h, char *s, isize_t slen)
|
||||
{
|
||||
http_cookie_t *c = (http_cookie_t *)h;
|
||||
|
||||
assert(h); assert(sizeof(*h));
|
||||
|
||||
for (;*s;) {
|
||||
/* Ignore empty entries (comma-whitespace) */
|
||||
if (*s == ',') { *s++ = '\0'; skip_lws(&s); continue; }
|
||||
|
||||
if (msg_any_list_d(home, &s, (msg_param_t **)&c->c_params,
|
||||
cookie_scanner, ';') == -1)
|
||||
return -1;
|
||||
|
||||
if (*s != '\0' && *s != ',')
|
||||
return -1;
|
||||
|
||||
if (!c->c_params)
|
||||
return -1;
|
||||
}
|
||||
|
||||
http_cookie_update(c);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Encode (print) a Cookie header */
|
||||
issize_t http_cookie_e(char b[], isize_t bsiz, msg_header_t const *h, int flags)
|
||||
{
|
||||
char *b0 = b, *end = b + bsiz;
|
||||
http_cookie_t const *c = (http_cookie_t *)h;
|
||||
size_t i;
|
||||
|
||||
if (c->c_params) {
|
||||
for (i = 0; c->c_params[i]; i++) {
|
||||
if (i > 0) MSG_CHAR_E(b, end, ';');
|
||||
MSG_STRING_E(b, end, c->c_params[i]);
|
||||
}
|
||||
}
|
||||
|
||||
MSG_TERM_E(b, end);
|
||||
|
||||
return b - b0;
|
||||
}
|
||||
|
||||
/** Calculate extra storage used by Cookie header field */
|
||||
isize_t http_cookie_dup_xtra(msg_header_t const *h, isize_t offset)
|
||||
{
|
||||
http_cookie_t const *c = (http_cookie_t *)h;
|
||||
|
||||
MSG_PARAMS_SIZE(offset, c->c_params);
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
/** Duplicate a Cookie header field */
|
||||
char *http_cookie_dup_one(msg_header_t *dst, msg_header_t const *src,
|
||||
char *b, isize_t xtra)
|
||||
{
|
||||
http_cookie_t *c = (http_cookie_t *)dst;
|
||||
http_cookie_t const *o = (http_cookie_t const *)src;
|
||||
char *end = b + xtra;
|
||||
|
||||
b = msg_params_dup(&c->c_params, o->c_params, b, xtra);
|
||||
http_cookie_update(c);
|
||||
|
||||
assert(b <= end); (void)end;
|
||||
|
||||
return b;
|
||||
}
|
||||
|
||||
msg_hclass_t http_cookie_class[] =
|
||||
HTTP_HEADER_CLASS(cookie, "Cookie", c_params, append, cookie);
|
||||
|
||||
/* ====================================================================== */
|
||||
|
||||
/**@HTTP_HEADER http_set_cookie Set-Cookie extension header.
|
||||
*
|
||||
* The Set-Cookie header is used to transmit state information from server
|
||||
* back to the http client. Its syntax is defined in RFC 2109 section 4.2.2
|
||||
* as follows:
|
||||
*
|
||||
* @code
|
||||
* set-cookie = "Set-Cookie:" cookies
|
||||
* cookies = 1#cookie
|
||||
* cookie = NAME "=" VALUE *(";" cookie-av)
|
||||
* NAME = attr
|
||||
* VALUE = value
|
||||
* cookie-av = "Comment" "=" value
|
||||
* | "Domain" "=" value
|
||||
* | "Max-Age" "=" value
|
||||
* | "Path" "=" value
|
||||
* | "Secure"
|
||||
* | "Version" "=" 1*DIGIT
|
||||
*
|
||||
* @endcode
|
||||
*
|
||||
*/
|
||||
|
||||
/**@ingroup http_set_cookie
|
||||
*
|
||||
* @typedef typedef struct http_set_cookie_s http_set_cookie_t;
|
||||
*
|
||||
* The structure http_set_cookie_t contains representation of @b Set-Cookie
|
||||
* header.
|
||||
*
|
||||
* The http_set_cookie_t is defined as follows:
|
||||
* @code
|
||||
* typedef struct http_set_cookie_s
|
||||
* {
|
||||
* } http_set_cookie_t;
|
||||
* @endcode
|
||||
*/
|
||||
|
||||
/**Update Set-Cookie parameters.
|
||||
*
|
||||
* The function http_set_cookie_update() updates a @b Set-Cookie parameter
|
||||
* shortcuts.
|
||||
*
|
||||
* @param sc pointer to a @c http_set_cookie_t object
|
||||
*/
|
||||
static inline
|
||||
void http_set_cookie_update(http_set_cookie_t *sc)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
sc->sc_name = NULL;
|
||||
sc->sc_version = NULL, sc->sc_domain = NULL, sc->sc_path = NULL;
|
||||
sc->sc_comment = NULL, sc->sc_max_age = NULL, sc->sc_secure = 0;
|
||||
|
||||
if (!sc->sc_params)
|
||||
return;
|
||||
|
||||
sc->sc_name = sc->sc_params[0];
|
||||
|
||||
for (i = 1; sc->sc_params[i]; i++) {
|
||||
msg_param_t p = sc->sc_params[i];
|
||||
switch (p[0]) {
|
||||
case 'c': case 'C':
|
||||
MSG_PARAM_MATCH(sc->sc_comment, p, "Comment");
|
||||
break;
|
||||
case 'd': case 'D':
|
||||
MSG_PARAM_MATCH(sc->sc_domain, p, "Domain");
|
||||
break;
|
||||
case 'm': case 'M':
|
||||
MSG_PARAM_MATCH(sc->sc_max_age, p, "Max-Age");
|
||||
break;
|
||||
case 'p': case 'P':
|
||||
MSG_PARAM_MATCH(sc->sc_path, p, "Path");
|
||||
break;
|
||||
case 's': case 'S':
|
||||
MSG_PARAM_MATCH_P(sc->sc_secure, p, "Secure");
|
||||
break;
|
||||
case 'v': case 'V':
|
||||
MSG_PARAM_MATCH(sc->sc_version, p, "Version");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#include <sofia-sip/msg_date.h>
|
||||
|
||||
/* Scan a cookie parameter */
|
||||
static issize_t set_cookie_scanner(char *s)
|
||||
{
|
||||
char *rest;
|
||||
|
||||
#define LOOKING_AT(s, what) \
|
||||
(strncasecmp((s), what, strlen(what)) == 0 && (rest = s + strlen(what)))
|
||||
|
||||
/* Special cases from Netscape spec */
|
||||
if (LOOKING_AT(s, "expires=")) {
|
||||
msg_time_t value;
|
||||
msg_date_d((char const **)&rest, &value);
|
||||
} else if (LOOKING_AT(s, "path=/")) {
|
||||
for (;;) {
|
||||
rest += span_unreserved(rest);
|
||||
if (*rest != '/')
|
||||
break;
|
||||
rest++;
|
||||
}
|
||||
} else {
|
||||
return msg_attribute_value_scanner(s);
|
||||
}
|
||||
#undef LOOKING_AT
|
||||
|
||||
if (IS_LWS(*rest)) {
|
||||
*rest++ = '\0'; skip_lws(&rest);
|
||||
}
|
||||
|
||||
return rest - s;
|
||||
}
|
||||
|
||||
/** Decode (parse) Set-Cookie header */
|
||||
issize_t http_set_cookie_d(su_home_t *home, msg_header_t *h, char *s, isize_t slen)
|
||||
{
|
||||
msg_header_t **hh = &h->sh_succ, *h0 = h;
|
||||
http_set_cookie_t *sc = (http_set_cookie_t *)h;
|
||||
msg_param_t *params;
|
||||
|
||||
assert(h); assert(sizeof(*h));
|
||||
|
||||
for (;*s;) {
|
||||
/* Ignore empty entries (comma-whitespace) */
|
||||
if (*s == ',') { *s++ = '\0'; skip_lws(&s); continue; }
|
||||
|
||||
if (!h) { /* Allocate next header structure */
|
||||
if (!(h = msg_header_alloc(home, h0->sh_class, 0)))
|
||||
return -1;
|
||||
*hh = h; h->sh_prev = hh; hh = &h->sh_succ;
|
||||
sc = sc->sc_next = (http_set_cookie_t *)h;
|
||||
}
|
||||
|
||||
/* "Set-Cookie:" 1#(NAME "=" VALUE *(";" cookie-av))) */
|
||||
params = su_zalloc(home, MSG_PARAMS_NUM(1) * sizeof(msg_param_t));
|
||||
if (!params)
|
||||
return -1;
|
||||
|
||||
params[0] = s, sc->sc_params = params;
|
||||
s += strcspn(s, ",;" LWS);
|
||||
|
||||
if (*s) {
|
||||
*s++ = '\0';
|
||||
skip_lws(&s);
|
||||
if (*s && msg_any_list_d(home, &s, (msg_param_t **)&sc->sc_params,
|
||||
set_cookie_scanner, ';') == -1)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (*s != '\0' && *s != ',')
|
||||
return -1;
|
||||
|
||||
if (sc->sc_params)
|
||||
http_set_cookie_update(sc);
|
||||
|
||||
h = NULL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Encode (print) Set-Cookie header */
|
||||
issize_t http_set_cookie_e(char b[], isize_t bsiz, msg_header_t const *h, int flags)
|
||||
{
|
||||
char *b0 = b, *end = b + bsiz;
|
||||
http_set_cookie_t const *sc = (http_set_cookie_t *)h;
|
||||
size_t i;
|
||||
|
||||
if (sc->sc_params) {
|
||||
for (i = 0; sc->sc_params[i]; i++) {
|
||||
if (i > 0) MSG_CHAR_E(b, end, ';');
|
||||
MSG_STRING_E(b, end, sc->sc_params[i]);
|
||||
}
|
||||
}
|
||||
|
||||
MSG_TERM_E(b, end);
|
||||
|
||||
return b - b0;
|
||||
}
|
||||
|
||||
/** Calculate extra storage used by Set-Cookie header field */
|
||||
isize_t http_set_cookie_dup_xtra(msg_header_t const *h, isize_t offset)
|
||||
{
|
||||
http_set_cookie_t const *sc = (http_set_cookie_t *)h;
|
||||
|
||||
MSG_PARAMS_SIZE(offset, sc->sc_params);
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
/** Duplicate a Set-Cookie header field */
|
||||
char *http_set_cookie_dup_one(msg_header_t *dst, msg_header_t const *src,
|
||||
char *b, isize_t xtra)
|
||||
{
|
||||
http_set_cookie_t *sc = (http_set_cookie_t *)dst;
|
||||
http_set_cookie_t const *o = (http_set_cookie_t const *)src;
|
||||
char *end = b + xtra;
|
||||
|
||||
b = msg_params_dup(&sc->sc_params, o->sc_params, b, xtra);
|
||||
http_set_cookie_update(sc);
|
||||
|
||||
assert(b <= end); (void)end;
|
||||
|
||||
return b;
|
||||
}
|
||||
|
||||
msg_hclass_t http_set_cookie_class[] =
|
||||
HTTP_HEADER_CLASS(set_cookie, "Set-Cookie", sc_params, append, set_cookie);
|
||||
@@ -0,0 +1,307 @@
|
||||
/*
|
||||
* This file is part of the Sofia-SIP package
|
||||
*
|
||||
* Copyright (C) 2005 Nokia Corporation.
|
||||
*
|
||||
* Contact: Pekka Pessi <pekka.pessi@nokia.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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 this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
/**@CFILE http_header.c
|
||||
*
|
||||
* HTTP header handling.
|
||||
*
|
||||
* @author Pekka Pessi <Pekka.Pessi@nokia.com>
|
||||
*
|
||||
* @date Created: Tue Jun 13 02:57:51 2000 ppessi
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <limits.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include <sofia-sip/su_alloc.h>
|
||||
|
||||
/* Avoid casting http_t to msg_pub_t and http_header_t to msg_header_t */
|
||||
#define MSG_PUB_T struct http_s
|
||||
#define MSG_HDR_T union http_header_u
|
||||
#define HTTP_STATIC_INLINE
|
||||
|
||||
#include "sofia-sip/http_parser.h"
|
||||
|
||||
#include <sofia-sip/http_header.h>
|
||||
#include <sofia-sip/http_status.h>
|
||||
|
||||
#ifndef UINT32_MAX
|
||||
#define UINT32_MAX (0xffffffffU)
|
||||
#endif
|
||||
|
||||
/** Complete a HTTP request. */
|
||||
int http_request_complete(msg_t *msg)
|
||||
{
|
||||
size_t len = 0;
|
||||
http_t *http = http_object(msg);
|
||||
http_payload_t const *pl;
|
||||
su_home_t *home = msg_home(msg);
|
||||
|
||||
if (!http)
|
||||
return -1;
|
||||
if (!http->http_request)
|
||||
return -1;
|
||||
if (!http->http_host)
|
||||
return -1;
|
||||
|
||||
for (pl = http->http_payload; pl; pl = pl->pl_next)
|
||||
len += pl->pl_len;
|
||||
|
||||
if (len > UINT32_MAX)
|
||||
return -1;
|
||||
|
||||
if (!http->http_content_length) {
|
||||
http->http_content_length = http_content_length_create(home, (uint32_t)len);
|
||||
}
|
||||
else {
|
||||
if (http->http_content_length->l_length != len) {
|
||||
http->http_content_length->l_length = (uint32_t)len;
|
||||
msg_fragment_clear(http->http_content_length->l_common);
|
||||
}
|
||||
}
|
||||
|
||||
if (!http->http_separator)
|
||||
http->http_separator = http_separator_create(home);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Remove schema, host, port, and fragment from HTTP/HTTPS URL */
|
||||
int http_strip_hostport(url_t *url)
|
||||
{
|
||||
if (url->url_type == url_http || url->url_type == url_https) {
|
||||
url->url_type = url_unknown;
|
||||
url->url_scheme = NULL;
|
||||
url->url_user = NULL;
|
||||
url->url_password = NULL;
|
||||
url->url_host = NULL;
|
||||
url->url_port = NULL;
|
||||
if (url->url_path == NULL) {
|
||||
url->url_root = '/';
|
||||
url->url_path = "";
|
||||
}
|
||||
}
|
||||
|
||||
url->url_fragment = NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Add a Content-Length and separator to a message */
|
||||
int http_message_complete(msg_t *msg, http_t *http)
|
||||
{
|
||||
#if 1
|
||||
if (!http->http_content_length) {
|
||||
http_content_length_t *l;
|
||||
http_payload_t *pl;
|
||||
size_t len = 0;
|
||||
|
||||
for (pl = http->http_payload; pl; pl = pl->pl_next)
|
||||
len += pl->pl_len;
|
||||
|
||||
if (len > UINT32_MAX)
|
||||
return -1;
|
||||
|
||||
l = http_content_length_create(msg_home(msg), (uint32_t)len);
|
||||
|
||||
if (msg_header_insert(msg, http, (http_header_t *)l) < 0)
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!http->http_separator) {
|
||||
http_separator_t *sep = http_separator_create(msg_home(msg));
|
||||
if (msg_header_insert(msg, http, (http_header_t *)sep) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Add headers from the request to the response message. */
|
||||
int http_complete_response(msg_t *msg,
|
||||
int status, char const *phrase,
|
||||
http_t const *request)
|
||||
{
|
||||
su_home_t *home = msg_home(msg);
|
||||
http_t *http = msg_object(msg);
|
||||
|
||||
if (!http || !request || !request->http_request)
|
||||
return -1;
|
||||
|
||||
if (!http->http_status)
|
||||
http->http_status = http_status_create(home, status, phrase, NULL);
|
||||
|
||||
if (!http->http_status)
|
||||
return -1;
|
||||
|
||||
if (!http->http_separator) {
|
||||
http_separator_t *sep = http_separator_create(msg_home(msg));
|
||||
if (msg_header_insert(msg, http, (http_header_t *)sep) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Copy a HTTP header. */
|
||||
http_header_t *http_header_copy(su_home_t *home, http_header_t const *h)
|
||||
{
|
||||
if (h == NULL || h == HTTP_NONE)
|
||||
return NULL;
|
||||
return msg_header_copy_as(home, h->sh_class, h);
|
||||
}
|
||||
|
||||
/** Duplicate a HTTP header. */
|
||||
http_header_t *http_header_dup(su_home_t *home, http_header_t const *h)
|
||||
{
|
||||
if (h == NULL || h == HTTP_NONE)
|
||||
return NULL;
|
||||
return msg_header_dup_as(home, h->sh_class, h);
|
||||
|
||||
}
|
||||
|
||||
/** Decode a HTTP header. */
|
||||
http_header_t *http_header_d(su_home_t *home, msg_t const *msg, char const *b)
|
||||
{
|
||||
return msg_header_d(home, msg, b);
|
||||
}
|
||||
|
||||
/** Encode a HTTP header. */
|
||||
int http_header_e(char b[], int bsiz, http_header_t const *h, int flags)
|
||||
{
|
||||
return msg_header_e(b, bsiz, h, flags);
|
||||
}
|
||||
|
||||
/** Encode HTTP header contents. */
|
||||
int http_header_field_e(char b[], int bsiz, http_header_t const *h, int flags)
|
||||
{
|
||||
assert(h); assert(h->sh_class);
|
||||
|
||||
return h->sh_class->hc_print(b, bsiz, h, flags);
|
||||
}
|
||||
|
||||
http_header_t *http_header_format(su_home_t *home,
|
||||
msg_hclass_t *hc,
|
||||
char const *fmt,
|
||||
...)
|
||||
{
|
||||
http_header_t *h;
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
|
||||
h = http_header_vformat(home, hc, fmt, ap);
|
||||
|
||||
va_end(ap);
|
||||
|
||||
return h;
|
||||
}
|
||||
|
||||
/** Add a duplicate of header object to a HTTP message. */
|
||||
int http_add_dup(msg_t *msg,
|
||||
http_t *http,
|
||||
http_header_t const *o)
|
||||
{
|
||||
if (o == HTTP_NONE)
|
||||
return 0;
|
||||
|
||||
if (msg == NULL || o == NULL)
|
||||
return -1;
|
||||
|
||||
return msg_header_insert(msg, http, msg_header_dup(msg_home(msg), o));
|
||||
}
|
||||
|
||||
int http_add_make(msg_t *msg,
|
||||
http_t *http,
|
||||
msg_hclass_t *hc,
|
||||
char const *s)
|
||||
{
|
||||
if (s == NULL)
|
||||
return 0;
|
||||
|
||||
if (msg == NULL)
|
||||
return -1;
|
||||
|
||||
return msg_header_insert(msg, http, msg_header_make(msg_home(msg), hc, s));
|
||||
}
|
||||
|
||||
int http_add_format(msg_t *msg,
|
||||
http_t *http,
|
||||
msg_hclass_t *hc,
|
||||
char const *fmt,
|
||||
...)
|
||||
{
|
||||
http_header_t *h;
|
||||
va_list ap;
|
||||
|
||||
if (fmt == NULL)
|
||||
return 0;
|
||||
|
||||
if (msg == NULL)
|
||||
return -1;
|
||||
|
||||
va_start(ap, fmt);
|
||||
h = http_header_vformat(msg_home(msg), hc, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
return msg_header_insert(msg, http, h);
|
||||
}
|
||||
|
||||
/** Compare two HTTP URLs. */
|
||||
int http_url_cmp(url_t const *a, url_t const *b)
|
||||
{
|
||||
int rv;
|
||||
|
||||
if ((rv = url_cmp(a, b)))
|
||||
return rv;
|
||||
|
||||
if (a->url_path != b->url_path) {
|
||||
if (a->url_path == NULL) return -1;
|
||||
if (b->url_path == NULL) return +1;
|
||||
if ((rv = strcmp(a->url_path, b->url_path)))
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* Params? */
|
||||
|
||||
/* Query */
|
||||
if (a->url_headers != b->url_headers) {
|
||||
if (a->url_headers == NULL) return -1;
|
||||
if (b->url_headers == NULL) return +1;
|
||||
if ((rv = strcmp(a->url_headers, b->url_headers)))
|
||||
return rv;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,573 @@
|
||||
/*
|
||||
* This file is part of the Sofia-SIP package
|
||||
*
|
||||
* Copyright (C) 2005 Nokia Corporation.
|
||||
*
|
||||
* Contact: Pekka Pessi <pekka.pessi@nokia.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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 this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
/**@CFILE http_parser.c
|
||||
*
|
||||
* HTTP parser.
|
||||
*
|
||||
* @author Pekka Pessi <Pekka.Pessi@nokia.com>
|
||||
*
|
||||
* @date Created: Thu Oct 5 14:01:24 2000 ppessi
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
/* Avoid casting http_t to msg_pub_t and http_header_t to msg_header_t */
|
||||
#define MSG_PUB_T struct http_s
|
||||
#define MSG_HDR_T union http_header_u
|
||||
|
||||
#include <sofia-sip/su_alloc.h>
|
||||
#include "sofia-sip/http_parser.h"
|
||||
#include <sofia-sip/msg_parser.h>
|
||||
#include <sofia-sip/http_header.h>
|
||||
#include <sofia-sip/http_status.h>
|
||||
#include <sofia-sip/msg_mclass.h>
|
||||
|
||||
#include <sofia-sip/su_tagarg.h>
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include <limits.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
/** HTTP version 1.1. */
|
||||
char const http_version_1_1[] = "HTTP/1.1";
|
||||
/** HTTP version 1.0. */
|
||||
char const http_version_1_0[] = "HTTP/1.0";
|
||||
/** HTTP version 0.9 is an empty string. */
|
||||
char const http_version_0_9[] = "";
|
||||
|
||||
msg_mclass_t *http_default_mclass(void)
|
||||
{
|
||||
extern msg_mclass_t http_mclass[];
|
||||
|
||||
return http_mclass;
|
||||
}
|
||||
|
||||
static
|
||||
issize_t http_extract_chunk(msg_t *, http_t *, char b[], isize_t bsiz, int eos);
|
||||
|
||||
/** Calculate length of line ending (0, 1 or 2) */
|
||||
#define CRLF_TEST(s) \
|
||||
(((s)[0]) == '\r' ? (((s)[1]) == '\n') + 1 : ((s)[0])=='\n')
|
||||
|
||||
/** Extract the HTTP message body, including separator line.
|
||||
*
|
||||
* @retval -1 error
|
||||
* @retval 0 cannot proceed
|
||||
* @retval other number of bytes extracted
|
||||
*/
|
||||
issize_t http_extract_body(msg_t *msg, http_t *http, char b[], isize_t bsiz, int eos)
|
||||
{
|
||||
issize_t m = 0;
|
||||
size_t body_len;
|
||||
|
||||
int flags = http->http_flags;
|
||||
|
||||
if (eos && bsiz == 0) {
|
||||
msg_mark_as_complete(msg, MSG_FLG_COMPLETE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (flags & MSG_FLG_TRAILERS) {
|
||||
/* The empty line after trailers */
|
||||
if (!eos && (bsiz == 0 || (bsiz == 1 && b[0] == '\r')))
|
||||
return 0;
|
||||
|
||||
m = CRLF_TEST(b);
|
||||
|
||||
assert(m > 0 || eos); /* We should be looking at an empty line */
|
||||
|
||||
/* We have completed trailers */
|
||||
msg_mark_as_complete(msg, MSG_FLG_COMPLETE);
|
||||
|
||||
return m;
|
||||
}
|
||||
|
||||
if (flags & MSG_FLG_CHUNKS)
|
||||
return http_extract_chunk(msg, http, b, bsiz, eos);
|
||||
|
||||
if (!(flags & MSG_FLG_BODY)) {
|
||||
/* We are looking at a potential empty line */
|
||||
m = msg_extract_separator(msg, http, b, bsiz, eos);
|
||||
|
||||
if (m == 0) /* Not yet */
|
||||
return 0;
|
||||
|
||||
http->http_flags |= MSG_FLG_BODY;
|
||||
b += m, bsiz -= m;
|
||||
}
|
||||
|
||||
/* body_len is determined by rules in RFC2616 sections 4.3 and 4.4 */
|
||||
|
||||
/* 1XX, 204, 304 do not have message-body, ever */
|
||||
if (http->http_status) {
|
||||
int status = http->http_status->st_status;
|
||||
|
||||
if (status < 200 || status == 204 || status == 304)
|
||||
flags |= HTTP_FLG_NO_BODY;
|
||||
}
|
||||
|
||||
if (flags & HTTP_FLG_NO_BODY) {
|
||||
msg_mark_as_complete(msg, MSG_FLG_COMPLETE);
|
||||
return m;
|
||||
}
|
||||
|
||||
if (http->http_transfer_encoding) {
|
||||
if (/* NOTE - there is really no Transfer-Encoding: identity in RFC 2616
|
||||
* but it was used in drafts...
|
||||
*/
|
||||
http->http_transfer_encoding->k_items &&
|
||||
http->http_transfer_encoding->k_items[0] &&
|
||||
strcasecmp(http->http_transfer_encoding->k_items[0],
|
||||
"identity") != 0) {
|
||||
http->http_flags |= MSG_FLG_CHUNKS;
|
||||
|
||||
if (http->http_flags & MSG_FLG_STREAMING)
|
||||
msg_set_streaming(msg, msg_start_streaming);
|
||||
|
||||
if (m)
|
||||
return m;
|
||||
|
||||
return http_extract_chunk(msg, http, b, bsiz, eos);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (http->http_content_length)
|
||||
body_len = http->http_content_length->l_length;
|
||||
/* We cannot parse multipart/byteranges ... */
|
||||
else if (http->http_content_type && http->http_content_type->c_type &&
|
||||
strcasecmp(http->http_content_type->c_type, "multipart/byteranges")
|
||||
== 0)
|
||||
return -1;
|
||||
else if (MSG_IS_MAILBOX(flags)) /* message fragments */
|
||||
body_len = 0;
|
||||
else if (http->http_request)
|
||||
body_len = 0;
|
||||
else if (eos)
|
||||
body_len = bsiz;
|
||||
else
|
||||
return 0; /* XXX */
|
||||
|
||||
if (body_len == 0) {
|
||||
msg_mark_as_complete(msg, MSG_FLG_COMPLETE);
|
||||
return m;
|
||||
}
|
||||
|
||||
if (http->http_flags & MSG_FLG_STREAMING)
|
||||
msg_set_streaming(msg, msg_start_streaming);
|
||||
|
||||
if (m)
|
||||
return m;
|
||||
|
||||
m = msg_extract_payload(msg, http, NULL, body_len, b, bsiz, eos);
|
||||
if (m == -1)
|
||||
return -1;
|
||||
|
||||
/* We have now all message fragments in place */
|
||||
http->http_flags |= MSG_FLG_FRAGS;
|
||||
if (bsiz >= body_len) {
|
||||
msg_mark_as_complete(msg, MSG_FLG_COMPLETE);
|
||||
}
|
||||
|
||||
return m;
|
||||
}
|
||||
|
||||
/** Extract a chunk.
|
||||
*
|
||||
* @retval -1 error
|
||||
* @retval 0 cannot proceed
|
||||
* @retval other number of bytes extracted
|
||||
*/
|
||||
issize_t http_extract_chunk(msg_t *msg, http_t *http, char b[], isize_t bsiz, int eos)
|
||||
{
|
||||
size_t n;
|
||||
unsigned crlf, chunk_len;
|
||||
char *b0 = b, *s;
|
||||
union {
|
||||
msg_header_t *header;
|
||||
msg_payload_t *chunk;
|
||||
} h = { NULL };
|
||||
size_t bsiz0 = bsiz;
|
||||
|
||||
if (bsiz == 0)
|
||||
return 0;
|
||||
|
||||
/* We should be looking at an empty line followed by the chunk header */
|
||||
while ((crlf = CRLF_TEST(b))) {
|
||||
if (bsiz == 1 && crlf == 1 && b[0] == '\r' && !eos)
|
||||
return 0;
|
||||
|
||||
if (crlf == bsiz) {
|
||||
if (eos) {
|
||||
msg_mark_as_complete(msg, MSG_FLG_COMPLETE | MSG_FLG_FRAGS);
|
||||
return (b - b0) + crlf;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
assert(crlf < bsiz);
|
||||
|
||||
/* Skip crlf */
|
||||
b += crlf; bsiz -= crlf;
|
||||
}
|
||||
|
||||
/* Now, looking at the chunk header */
|
||||
n = strcspn(b, CRLF);
|
||||
if (!eos && n == bsiz)
|
||||
return 0;
|
||||
crlf = CRLF_TEST(b + n);
|
||||
|
||||
if (n == 0) {
|
||||
if (crlf == bsiz && eos) {
|
||||
msg_mark_as_complete(msg, MSG_FLG_COMPLETE | MSG_FLG_FRAGS);
|
||||
return crlf;
|
||||
}
|
||||
else
|
||||
return -1; /* XXX - should we be more liberal? */
|
||||
}
|
||||
|
||||
if (!eos && n + crlf == bsiz && (crlf == 0 || (crlf == 1 && b[n] == '\r')))
|
||||
return 0;
|
||||
|
||||
chunk_len = strtoul(b, &s, 16);
|
||||
if (s == b)
|
||||
return -1;
|
||||
skip_ws(&s);
|
||||
if (s != b + n && s[0] != ';') /* Extra stuff that is not parameter */
|
||||
return -1;
|
||||
|
||||
if (chunk_len == 0) { /* We found last-chunk */
|
||||
b += n + crlf, bsiz -= n + crlf;
|
||||
|
||||
crlf = bsiz > 0 ? CRLF_TEST(b) : 0;
|
||||
|
||||
if ((eos && bsiz == 0) || crlf == 2 ||
|
||||
(crlf == 1 && (bsiz > 1 || b[0] == '\n'))) {
|
||||
/* Shortcut - We got empty trailers */
|
||||
b += crlf;
|
||||
msg_mark_as_complete(msg, MSG_FLG_COMPLETE | MSG_FLG_FRAGS);
|
||||
} else {
|
||||
/* We have to parse trailers */
|
||||
http->http_flags |= MSG_FLG_TRAILERS;
|
||||
}
|
||||
|
||||
return b - b0;
|
||||
}
|
||||
else {
|
||||
issize_t chunk;
|
||||
|
||||
b += n + crlf, bsiz -= n + crlf;
|
||||
|
||||
/* Extract chunk */
|
||||
chunk = msg_extract_payload(msg, http,
|
||||
&h.header, chunk_len + (b - b0),
|
||||
b0, bsiz0, eos);
|
||||
|
||||
if (chunk != -1 && h.header) {
|
||||
assert(h.chunk->pl_data);
|
||||
h.chunk->pl_data += (b - b0);
|
||||
h.chunk->pl_len -= (b - b0);
|
||||
}
|
||||
|
||||
return chunk;
|
||||
}
|
||||
}
|
||||
|
||||
/** Parse HTTP version.
|
||||
*
|
||||
* The function http_version_d() parses a HTTP method.
|
||||
*
|
||||
* @retval 0 when successful,
|
||||
* @retval -1 upon an error.
|
||||
*/
|
||||
int http_version_d(char **ss, char const **ver)
|
||||
{
|
||||
char *s = *ss;
|
||||
char const *result;
|
||||
int const version_size = sizeof(http_version_1_1) - 1;
|
||||
|
||||
if (strncasecmp(s, http_version_1_1, version_size) == 0 &&
|
||||
!IS_TOKEN(s[version_size])) {
|
||||
result = http_version_1_1;
|
||||
s += version_size;
|
||||
}
|
||||
else if (strncasecmp(s, http_version_1_0, version_size) == 0 &&
|
||||
!IS_TOKEN(s[version_size])) {
|
||||
result = http_version_1_0;
|
||||
s += version_size;
|
||||
}
|
||||
else if (s[0] == '\0') {
|
||||
result = http_version_0_9;
|
||||
} else {
|
||||
/* Version consists of one or two tokens, separated by / */
|
||||
size_t l1 = 0, l2 = 0, n;
|
||||
|
||||
result = s;
|
||||
|
||||
l1 = span_token(s);
|
||||
for (n = l1; IS_LWS(s[n]); n++)
|
||||
s[n] = '\0';
|
||||
if (s[n] == '/') {
|
||||
for (n = n + 1; IS_LWS(s[n]); n++);
|
||||
l2 = span_token(s + n);
|
||||
n += l2;
|
||||
}
|
||||
|
||||
if (l1 == 0)
|
||||
return -1;
|
||||
|
||||
/* If there is extra ws between tokens, compact version */
|
||||
if (l2 > 0 && n > l1 + 1 + l2) {
|
||||
s[l1] = '/';
|
||||
memmove(s + l1 + 1, s + n - l2, l2);
|
||||
s[l1 + 1 + l2] = 0;
|
||||
|
||||
/* Compare again with compacted version */
|
||||
if (strcasecmp(s, http_version_1_1) == 0)
|
||||
result = http_version_1_1;
|
||||
else if (strcasecmp(s, http_version_1_0) == 0)
|
||||
result = http_version_1_0;
|
||||
}
|
||||
|
||||
s += n;
|
||||
}
|
||||
|
||||
while (IS_LWS(*s)) *s++ = '\0';
|
||||
|
||||
*ss = s;
|
||||
|
||||
if (ver)
|
||||
*ver = result;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Calculate extra space required by version string */
|
||||
isize_t http_version_xtra(char const *version)
|
||||
{
|
||||
if (version == http_version_1_1)
|
||||
return 0;
|
||||
else if (version == http_version_1_0)
|
||||
return 0;
|
||||
else
|
||||
return MSG_STRING_SIZE(version);
|
||||
}
|
||||
|
||||
/** Duplicate a transport string */
|
||||
void http_version_dup(char **pp, char const **dd, char const *s)
|
||||
{
|
||||
if (s == http_version_1_1)
|
||||
*dd = s;
|
||||
else if (s == http_version_1_0)
|
||||
*dd = s;
|
||||
else
|
||||
MSG_STRING_DUP(*pp, *dd, s);
|
||||
}
|
||||
|
||||
/** Well-known HTTP method names. */
|
||||
static char const * const methods[] = {
|
||||
"<UNKNOWN>",
|
||||
http_method_name_get,
|
||||
http_method_name_post,
|
||||
http_method_name_head,
|
||||
http_method_name_options,
|
||||
http_method_name_put,
|
||||
http_method_name_delete,
|
||||
http_method_name_trace,
|
||||
http_method_name_connect,
|
||||
NULL,
|
||||
/* If you add something here, add also them to http_method_d! */
|
||||
};
|
||||
|
||||
char const http_method_name_get[] = "GET";
|
||||
char const http_method_name_post[] = "POST";
|
||||
char const http_method_name_head[] = "HEAD";
|
||||
char const http_method_name_options[] = "OPTIONS";
|
||||
char const http_method_name_put[] = "PUT";
|
||||
char const http_method_name_delete[] = "DELETE";
|
||||
char const http_method_name_trace[] = "TRACE";
|
||||
char const http_method_name_connect[] = "CONNECT";
|
||||
|
||||
char const *http_method_name(http_method_t method, char const *name)
|
||||
{
|
||||
if (method > 0 && (size_t)method < sizeof(methods)/sizeof(methods[0]))
|
||||
return methods[method];
|
||||
else if (method == 0)
|
||||
return name;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**Parse a HTTP method name.
|
||||
*
|
||||
* The function @c http_method_d() parses a HTTP method, and returns a code
|
||||
* corresponding to the method. It stores the address of the first non-LWS
|
||||
* character after method name in @c *ss.
|
||||
*
|
||||
* @param ss pointer to pointer to string to be parsed
|
||||
* @param nname pointer to value-result parameter formethod name
|
||||
*
|
||||
* @note
|
||||
* If there is no whitespace after method name, the value in @a *nname
|
||||
* may not be NUL-terminated. The calling function @b must NUL terminate
|
||||
* the value by setting the @a **ss to NUL after first examining its value.
|
||||
*
|
||||
* @return The function @c http_method_d returns the method code if method
|
||||
* was identified, 0 (@c http_method_unknown) if method is not known, or @c -1
|
||||
* (@c http_method_invalid) if an error occurred.
|
||||
*
|
||||
* If the value-result argument @a nname is not @c NULL, http_method_d()
|
||||
* stores a pointer to the method name to it.
|
||||
*/
|
||||
http_method_t http_method_d(char **ss, char const **nname)
|
||||
{
|
||||
char *s = *ss, c = *s;
|
||||
char const *name;
|
||||
int code = http_method_unknown;
|
||||
size_t n = 0;
|
||||
|
||||
#define MATCH(s, m) (strncasecmp(s, m, n = sizeof(m) - 1) == 0)
|
||||
|
||||
if (c >= 'a' && c <= 'z')
|
||||
c += 'A' - 'a';
|
||||
|
||||
switch (c) {
|
||||
case 'C': if (MATCH(s, "CONNECT")) code = http_method_connect; break;
|
||||
case 'D': if (MATCH(s, "DELETE")) code = http_method_delete; break;
|
||||
case 'G': if (MATCH(s, "GET")) code = http_method_get; break;
|
||||
case 'H': if (MATCH(s, "HEAD")) code = http_method_head; break;
|
||||
case 'O': if (MATCH(s, "OPTIONS")) code = http_method_options; break;
|
||||
case 'P': if (MATCH(s, "POST")) code = http_method_post;
|
||||
else
|
||||
if (MATCH(s, "PUT")) code = http_method_put; break;
|
||||
case 'T': if (MATCH(s, "TRACE")) code = http_method_trace; break;
|
||||
}
|
||||
|
||||
#undef MATCH
|
||||
|
||||
if (!code || IS_NON_WS(s[n])) {
|
||||
/* Unknown method */
|
||||
code = http_method_unknown;
|
||||
name = s;
|
||||
for (n = 0; IS_UNRESERVED(s[n]); n++)
|
||||
;
|
||||
if (s[n]) {
|
||||
if (!IS_LWS(s[n]))
|
||||
return http_method_invalid;
|
||||
if (nname)
|
||||
s[n++] = '\0';
|
||||
}
|
||||
}
|
||||
else {
|
||||
name = methods[code];
|
||||
}
|
||||
|
||||
while (IS_LWS(s[n]))
|
||||
n++;
|
||||
|
||||
*ss = (s + n);
|
||||
if (nname) *nname = name;
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
/** Get method enum corresponding to method name */
|
||||
http_method_t http_method_code(char const *name)
|
||||
{
|
||||
/* Note that http_method_d() does not change string if nname is NULL */
|
||||
return http_method_d((char **)&name, NULL);
|
||||
}
|
||||
|
||||
/**Parse HTTP query string.
|
||||
*
|
||||
* The function http_query_parse() searches for the given keys in HTTP @a
|
||||
* query. For each key, a query element (in the form name=value) is searched
|
||||
* from the query string. If a query element has a beginning matching with
|
||||
* the key, a copy of the rest of the element is returned in corresponding
|
||||
* return_value argument.
|
||||
*
|
||||
* @note The @a query string will be modified.
|
||||
*
|
||||
* @return
|
||||
* The function http_query_parse() returns number keys that matched within
|
||||
* the @a query string.
|
||||
*/
|
||||
issize_t http_query_parse(char *query,
|
||||
/* char const *key, char **return_value, */
|
||||
...)
|
||||
{
|
||||
va_list ap;
|
||||
char *q, *q_next;
|
||||
char *name, *value, **return_value;
|
||||
char const *key;
|
||||
size_t namelen, valuelen, keylen;
|
||||
isize_t N;
|
||||
int has_value;
|
||||
|
||||
if (!query)
|
||||
return -1;
|
||||
|
||||
for (q = query, N = 0; *q; q = q_next) {
|
||||
namelen = strcspn(q, "=&");
|
||||
valuelen = namelen + strcspn(q + namelen, "&");
|
||||
|
||||
q_next = q + valuelen;
|
||||
if (*q_next)
|
||||
*q_next++ = '\0';
|
||||
|
||||
value = q + namelen;
|
||||
has_value = (*value) != '\0'; /* is the part in form of name=value? */
|
||||
if (has_value)
|
||||
*value++ = '\0';
|
||||
|
||||
name = url_unescape(q, q);
|
||||
|
||||
if (has_value) {
|
||||
namelen = strlen(name);
|
||||
name[namelen] = '=';
|
||||
url_unescape(name + namelen + 1, value);
|
||||
}
|
||||
|
||||
va_start(ap, query);
|
||||
|
||||
while ((key = va_arg(ap, char const *))) {
|
||||
return_value = va_arg(ap, char **);
|
||||
keylen = strlen(key);
|
||||
|
||||
if (strncmp(key, name, keylen) == 0) {
|
||||
*return_value = name + keylen;
|
||||
N++;
|
||||
}
|
||||
}
|
||||
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
return N;
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
/** -*- C -*-
|
||||
* @IFILE http_parser_table.c.in
|
||||
*
|
||||
* Template for <http_parser_table.c>.
|
||||
*
|
||||
* @date Created: Tue Oct 1 20:37:52 2002 ppessi
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file is part of the Sofia-SIP package
|
||||
*
|
||||
* Copyright (C) 2005 Nokia Corporation.
|
||||
*
|
||||
* Contact: Pekka Pessi <pekka.pessi@nokia.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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 this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
/**@internal
|
||||
* @CFILE http_parser_table.c
|
||||
* @brief HTTP parser table
|
||||
*
|
||||
* #AUTO#
|
||||
*
|
||||
* @author Pekka Pessi <Pekka.Pessi@nokia.com>
|
||||
*
|
||||
* @date Created: Tue Oct 1 20:37:52 2002 ppessi
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
/* Avoid casting http_t to msg_pub_t and http_header_t to msg_header_t */
|
||||
#define MSG_PUB_T struct http_s
|
||||
#define MSG_HDR_T union http_header_u
|
||||
|
||||
#include <sofia-sip/http_parser.h>
|
||||
#include <sofia-sip/msg_mclass.h>
|
||||
|
||||
#define HTTP_PARSER_FLAGS (MSG_FLG_CHUNKING)
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* This file is part of the Sofia-SIP package
|
||||
*
|
||||
* Copyright (C) 2005 Nokia Corporation.
|
||||
*
|
||||
* Contact: Pekka Pessi <pekka.pessi@nokia.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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 this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
/**@CFILE http_status.c HTTP status codes.
|
||||
*
|
||||
* @author Pekka Pessi <Pekka.Pessi@nokia.com>
|
||||
*
|
||||
* @date Created: Tue Sep 18 18:58:21 2001 ppessi
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include <sofia-sip/http_status.h>
|
||||
|
||||
char const
|
||||
http_100_continue[] = "Continue",
|
||||
http_101_switching[] = "Switching Protocols",
|
||||
http_200_ok[] = "OK",
|
||||
http_201_created[] = "Created",
|
||||
http_202_accepted[] = "Accepted",
|
||||
http_203_non_auth_info[] = "Non-Authoritative Information",
|
||||
http_204_no_content[] = "No Content",
|
||||
http_205_reset_content[] = "Reset Content",
|
||||
http_206_partial_content[] = "Partial Content",
|
||||
http_300_multiple_choices[] = "Multiple Choices",
|
||||
http_301_moved_permanently[] = "Moved Permanently",
|
||||
http_302_found[] = "Found",
|
||||
http_303_see_other[] = "See Other",
|
||||
http_304_not_modified[] = "Not Modified",
|
||||
http_305_use_proxy[] = "Use Proxy",
|
||||
http_307_temporary_redirect[] = "Temporary Redirect",
|
||||
http_400_bad_request[] = "Bad Request",
|
||||
http_401_unauthorized[] = "Unauthorized",
|
||||
http_402_payment_required[] = "Payment Required",
|
||||
http_403_forbidden[] = "Forbidden",
|
||||
http_404_not_found[] = "Not Found",
|
||||
http_405_not_allowed[] = "Method Not Allowed",
|
||||
http_406_not_acceptable[] = "Not Acceptable",
|
||||
http_407_proxy_auth[] = "Proxy Authentication Required",
|
||||
http_408_timeout[] = "Request Timeout",
|
||||
http_409_conflict[] = "Conflict",
|
||||
http_410_gone[] = "Gone",
|
||||
http_411_no_length[] = "Length Required",
|
||||
http_412_precondition[] = "Precondition Failed",
|
||||
http_413_entity_too_large[] = "Request Entity Too Large",
|
||||
http_414_uri_too_long[] = "Request-URI Too Long",
|
||||
http_415_media_type[] = "Unsupported Media Type",
|
||||
http_416_requested_range[] = "Requested Range Not Satisfiable",
|
||||
http_417_expectation[] = "Expectation Failed",
|
||||
http_426_upgrade[] = "Upgrade Required",
|
||||
http_500_internal_server[] = "Internal Server Error",
|
||||
http_501_not_implemented[] = "Not Implemented",
|
||||
http_502_bad_gateway[] = "Bad Gateway",
|
||||
http_503_no_service[] = "Service Unavailable",
|
||||
http_504_gateway_timeout[] = "Gateway Timeout",
|
||||
http_505_http_version[] = "HTTP Version Not Supported";
|
||||
|
||||
char const *http_status_phrase(int status)
|
||||
{
|
||||
if (status < 100 || status > 699)
|
||||
return NULL;
|
||||
|
||||
switch (status) {
|
||||
case 100: return http_100_continue;
|
||||
case 101: return http_101_switching;
|
||||
case 200: return http_200_ok;
|
||||
case 201: return http_201_created;
|
||||
case 202: return http_202_accepted;
|
||||
case 203: return http_203_non_auth_info;
|
||||
case 204: return http_204_no_content;
|
||||
case 205: return http_205_reset_content;
|
||||
case 206: return http_206_partial_content;
|
||||
case 300: return http_300_multiple_choices;
|
||||
case 301: return http_301_moved_permanently;
|
||||
case 302: return http_302_found;
|
||||
case 303: return http_303_see_other;
|
||||
case 304: return http_304_not_modified;
|
||||
case 305: return http_305_use_proxy;
|
||||
case 307: return http_307_temporary_redirect;
|
||||
case 400: return http_400_bad_request;
|
||||
case 401: return http_401_unauthorized;
|
||||
case 402: return http_402_payment_required;
|
||||
case 403: return http_403_forbidden;
|
||||
case 404: return http_404_not_found;
|
||||
case 405: return http_405_not_allowed;
|
||||
case 406: return http_406_not_acceptable;
|
||||
case 407: return http_407_proxy_auth;
|
||||
case 408: return http_408_timeout;
|
||||
case 409: return http_409_conflict;
|
||||
case 410: return http_410_gone;
|
||||
case 411: return http_411_no_length;
|
||||
case 412: return http_412_precondition;
|
||||
case 413: return http_413_entity_too_large;
|
||||
case 414: return http_414_uri_too_long;
|
||||
case 415: return http_415_media_type;
|
||||
case 416: return http_416_requested_range;
|
||||
case 417: return http_417_expectation;
|
||||
case 426: return http_426_upgrade;
|
||||
case 500: return http_500_internal_server;
|
||||
case 501: return http_501_not_implemented;
|
||||
case 502: return http_502_bad_gateway;
|
||||
case 503: return http_503_no_service;
|
||||
case 504: return http_504_gateway_timeout;
|
||||
case 505: return http_505_http_version;
|
||||
}
|
||||
|
||||
return " ";
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
/**@HTTP
|
||||
* @IFILE http_tag.c.in
|
||||
*
|
||||
* Template for <http_tag.c>.
|
||||
*
|
||||
* @date Created: Wed Feb 21 11:01:45 2001 ppessi
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file is part of the Sofia-SIP package
|
||||
*
|
||||
* Copyright (C) 2005 Nokia Corporation.
|
||||
*
|
||||
* Contact: Pekka Pessi <pekka.pessi@nokia.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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 this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
/**@file http_tag.c HTTP Tag classes
|
||||
*
|
||||
* This file is autogenerated from <http_tag.c.in>.
|
||||
*
|
||||
* #AUTO#
|
||||
*
|
||||
* @author Pekka Pessi <Pekka.Pessi@nokia.com>
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#define TAG_NAMESPACE "http"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <sofia-sip/su.h>
|
||||
|
||||
#include <sofia-sip/http.h>
|
||||
#include <sofia-sip/http_protos.h>
|
||||
#include <sofia-sip/http_tag.h>
|
||||
#include <sofia-sip/http_tag_class.h>
|
||||
|
||||
tag_typedef_t httptag_any = NSTAG_TYPEDEF(*);
|
||||
|
||||
tag_typedef_t httptag_http = HTTPMSGTAG_TYPEDEF(http);
|
||||
tag_typedef_t httptag_version = STRTAG_TYPEDEF(version);
|
||||
tag_typedef_t httptag_header =
|
||||
{{ TAG_NAMESPACE, "header", httphdrtag_class, 0 }};
|
||||
tag_typedef_t httptag_header_str = STRTAG_TYPEDEF(header_str);
|
||||
|
||||
|
||||
tag_typedef_t httptag_#xxxxxx# = HTTPHDRTAG_TYPEDEF(#xxxxxx#);
|
||||
tag_typedef_t httptag_#xxxxxx#_str = HTTPSTRTAG_TYPEDEF(#xxxxxx#);
|
||||
|
||||
@@ -0,0 +1,222 @@
|
||||
/*
|
||||
* This file is part of the Sofia-SIP package
|
||||
*
|
||||
* Copyright (C) 2005 Nokia Corporation.
|
||||
*
|
||||
* Contact: Pekka Pessi <pekka.pessi@nokia.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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 this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
/**@CFILE http_tag_class.c HTTP tag classes
|
||||
*
|
||||
* @author Pekka Pessi <Pekka.Pessi@nokia.com>
|
||||
*
|
||||
* @date Created: Fri Feb 23 12:46:42 2001 ppessi
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <sofia-sip/su.h>
|
||||
|
||||
/* Avoid casting http_t to msg_pub_t and http_header_t to msg_header_t */
|
||||
#define MSG_PUB_T struct http_s
|
||||
#define MSG_HDR_T union http_header_u
|
||||
|
||||
#include <sofia-sip/http_parser.h>
|
||||
|
||||
#include <sofia-sip/http_tag.h>
|
||||
#include <sofia-sip/su_tag_class.h>
|
||||
#include <sofia-sip/su_tag_inline.h>
|
||||
#include <sofia-sip/http_tag_class.h>
|
||||
#include <sofia-sip/su_tagarg.h>
|
||||
|
||||
tag_class_t httphdrtag_class[1] =
|
||||
{{
|
||||
sizeof(httphdrtag_class),
|
||||
/* tc_next */ NULL,
|
||||
/* tc_len */ NULL,
|
||||
/* tc_move */ NULL,
|
||||
/* tc_xtra */ msghdrtag_xtra,
|
||||
/* tc_dup */ msghdrtag_dup,
|
||||
/* tc_free */ NULL,
|
||||
/* tc_find */ NULL,
|
||||
/* tc_snprintf */ msghdrtag_snprintf,
|
||||
/* tc_filter */ httptag_filter,
|
||||
/* tc_ref_set */ t_ptr_ref_set,
|
||||
/* tc_scan */ msghdrtag_scan,
|
||||
}};
|
||||
|
||||
tag_class_t httpstrtag_class[1] =
|
||||
{{
|
||||
sizeof(httpstrtag_class),
|
||||
/* tc_next */ NULL,
|
||||
/* tc_len */ NULL,
|
||||
/* tc_move */ NULL,
|
||||
/* tc_xtra */ t_str_xtra,
|
||||
/* tc_dup */ t_str_dup,
|
||||
/* tc_free */ NULL,
|
||||
/* tc_find */ NULL,
|
||||
/* tc_snprintf */ t_str_snprintf,
|
||||
/* tc_filter */ NULL /* msgtag_str_filter */,
|
||||
/* tc_ref_set */ t_ptr_ref_set,
|
||||
/* tc_scan */ msghdrtag_scan,
|
||||
}};
|
||||
|
||||
tag_class_t httpmsgtag_class[1] =
|
||||
{{
|
||||
sizeof(httpmsgtag_class),
|
||||
/* tc_next */ NULL,
|
||||
/* tc_len */ NULL,
|
||||
/* tc_move */ NULL,
|
||||
/* tc_xtra */ msgobjtag_xtra,
|
||||
/* tc_dup */ msgobjtag_dup,
|
||||
/* tc_free */ NULL,
|
||||
/* tc_find */ NULL,
|
||||
/* tc_snprintf */ msgobjtag_snprintf,
|
||||
/* tc_filter */ NULL /* httptag_http_filter */,
|
||||
/* tc_ref_set */ t_ptr_ref_set,
|
||||
/* tc_scan */ t_str_scan
|
||||
}};
|
||||
|
||||
/** Filter a HTTP header structure. */
|
||||
tagi_t *httptag_filter(tagi_t *dst,
|
||||
tagi_t const f[],
|
||||
tagi_t const *src,
|
||||
void **bb)
|
||||
{
|
||||
tagi_t stub[2] = {{ NULL }};
|
||||
tag_type_t sctt, tt = f->t_tag;
|
||||
msg_hclass_t *hc = (msg_hclass_t *)tt->tt_magic;
|
||||
|
||||
assert(src);
|
||||
|
||||
sctt = src->t_tag;
|
||||
|
||||
if (sctt && sctt->tt_class == httpmsgtag_class) {
|
||||
http_t const *http;
|
||||
msg_mclass_t const *mc;
|
||||
http_header_t const *h, **hh;
|
||||
|
||||
http = (http_t const *)src->t_value;
|
||||
mc = (void *)http->http_common->h_class;
|
||||
hh = (void *)msg_hclass_offset(mc, http, hc);
|
||||
|
||||
if (http == NULL ||
|
||||
(char *)hh >= ((char *)http + http->http_size) ||
|
||||
(char *)hh < (char *)&http->http_request)
|
||||
return dst;
|
||||
|
||||
h = *hh;
|
||||
|
||||
if (h == NULL)
|
||||
return dst;
|
||||
|
||||
stub[0].t_tag = tt;
|
||||
stub[0].t_value = (tag_value_t)h;
|
||||
src = stub; sctt = tt;
|
||||
}
|
||||
|
||||
if (tt != sctt)
|
||||
return dst;
|
||||
|
||||
if (!src->t_value)
|
||||
return dst;
|
||||
else if (dst) {
|
||||
return t_dup(dst, src, bb);
|
||||
}
|
||||
else {
|
||||
*bb = (char *)*bb + t_xtra(src, (size_t)*bb);
|
||||
return dst + 1;
|
||||
}
|
||||
}
|
||||
|
||||
/** Duplicate headers from taglist and add them to the HTTP message.
|
||||
*
|
||||
* Return the number of headers added to the HTTP message.
|
||||
*/
|
||||
int http_add_tl(msg_t *msg, http_t *http,
|
||||
tag_type_t tag, tag_value_t value, ...)
|
||||
{
|
||||
tagi_t const *t;
|
||||
ta_list ta;
|
||||
int retval = 0;
|
||||
|
||||
if (msg == NULL)
|
||||
return -1;
|
||||
if (http == NULL)
|
||||
http = msg_object(msg);
|
||||
|
||||
ta_start(ta, tag, value);
|
||||
|
||||
for (t = ta_args(ta); t; t = tl_next(t)) {
|
||||
if (!(tag = t->t_tag) || !(value = t->t_value))
|
||||
continue;
|
||||
|
||||
if (HTTPTAG_P(tag)) {
|
||||
msg_hclass_t *hc = (msg_hclass_t *)tag->tt_magic;
|
||||
http_header_t *h = (http_header_t *)value, **hh;
|
||||
|
||||
if (h == HTTP_NONE) { /* Remove header(s) */
|
||||
if (hc == NULL)
|
||||
break;
|
||||
|
||||
hh = msg_hclass_offset(msg_mclass(msg), http, hc);
|
||||
if (!hh)
|
||||
break;
|
||||
|
||||
while (*hh) {
|
||||
msg_header_remove(msg, http, *hh);
|
||||
}
|
||||
}
|
||||
else if (h == NULL) {
|
||||
continue;
|
||||
} else {
|
||||
if (tag == httptag_header)
|
||||
hc = h->sh_class;
|
||||
|
||||
if (msg_header_add_dup_as(msg, http, hc, h) < 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (HTTPTAG_STR_P(tag)) {
|
||||
msg_hclass_t *hc = (msg_hclass_t *)tag->tt_magic;
|
||||
char const *s = (char const *)value;
|
||||
if (s && msg_header_add_make(msg, http, hc, s) < 0)
|
||||
break;
|
||||
}
|
||||
else if (tag == httptag_header_str) {
|
||||
if (msg_header_add_str(msg, http, (char const *)value) < 0)
|
||||
break;
|
||||
}
|
||||
else
|
||||
continue;
|
||||
|
||||
retval++;
|
||||
}
|
||||
|
||||
ta_end(ta);
|
||||
|
||||
if (t)
|
||||
return -1;
|
||||
|
||||
return retval;
|
||||
}
|
||||
@@ -0,0 +1,482 @@
|
||||
/*
|
||||
* This file is part of the Sofia-SIP package
|
||||
*
|
||||
* Copyright (C) 2005 Nokia Corporation.
|
||||
*
|
||||
* Contact: Pekka Pessi <pekka.pessi@nokia.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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 this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef HTTP_H
|
||||
/** Defined when <sofia-sip/http.h> has been included. */
|
||||
#define HTTP_H
|
||||
|
||||
/**@file sofia-sip/http.h
|
||||
*
|
||||
* HTTP message, methods, headers.
|
||||
*
|
||||
* @sa <a href="http://www.ietf.org/rfc/rfc2616.txt">RFC 2616</a>
|
||||
*
|
||||
* @author Pekka Pessi <Pekka.Pessi@nokia.com>.
|
||||
*
|
||||
* @date Created : Thu Jun 8 19:28:55 2000 ppessi
|
||||
*/
|
||||
|
||||
#ifndef MSG_H
|
||||
#include <sofia-sip/msg.h>
|
||||
#endif
|
||||
#ifndef URL_H
|
||||
#include <sofia-sip/url.h>
|
||||
#endif
|
||||
#ifndef MSG_MIME_H
|
||||
#include <sofia-sip/msg_mime.h>
|
||||
#endif
|
||||
|
||||
SOFIA_BEGIN_DECLS
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* 1) Constants
|
||||
*/
|
||||
|
||||
#define HTTP_NONE ((http_header_t *)MSG_HEADER_NONE)
|
||||
#define HTTP_DEFAULT_PORT (80)
|
||||
#define HTTP_DEFAULT_SERV "80"
|
||||
|
||||
/** HTTP protocol identifier */
|
||||
#define HTTP_PROTOCOL_TAG ((void *)0x48545450) /* 'HTTP' */
|
||||
|
||||
/** HTTP parser flags */
|
||||
enum {
|
||||
HTTP_FLG_NO_BODY = (1 << 15)
|
||||
};
|
||||
|
||||
/** IDs for well-known HTTP methods. */
|
||||
typedef enum {
|
||||
http_method_invalid = -1, /**< Invalid method name */
|
||||
http_method_unknown = 0, /**< Unknown method, use @c method_name */
|
||||
http_method_get, /**< GET */
|
||||
http_method_post, /**< POST */
|
||||
http_method_head, /**< HEAD */
|
||||
http_method_options, /**< OPTIONS */
|
||||
http_method_put, /**< PUT */
|
||||
http_method_delete, /**< DELETE */
|
||||
http_method_trace, /**< TRACE */
|
||||
http_method_connect, /**< CONNECT */
|
||||
} http_method_t;
|
||||
|
||||
#define HTTP_METHOD(s) http_method_unknown, #s
|
||||
#define HTTP_NO_METHOD http_method_unknown, NULL
|
||||
#define HTTP_METHOD_GET http_method_get, "GET"
|
||||
#define HTTP_METHOD_POST http_method_post, "POST"
|
||||
#define HTTP_METHOD_HEAD http_method_head, "HEAD"
|
||||
#define HTTP_METHOD_OPTIONS http_method_options, "OPTIONS"
|
||||
#define HTTP_METHOD_PUT http_method_put, "PUT"
|
||||
#define HTTP_METHOD_DELETE http_method_delete, "DELETE"
|
||||
#define HTTP_METHOD_TRACE http_method_trace, "TRACE"
|
||||
#define HTTP_METHOD_CONNECT http_method_connect, "CONNECT"
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* 2) Type declarations
|
||||
*/
|
||||
|
||||
/** HTTP message object. */
|
||||
typedef struct http_s http_t;
|
||||
|
||||
/** Any HTTP header - union of all possible HTTP headers. */
|
||||
typedef union http_header_u http_header_t;
|
||||
|
||||
typedef struct http_request_s http_request_t;
|
||||
typedef struct http_status_s http_status_t;
|
||||
typedef msg_accept_t http_accept_t;
|
||||
typedef msg_accept_charset_t http_accept_charset_t;
|
||||
typedef msg_accept_encoding_t http_accept_encoding_t;
|
||||
typedef msg_accept_language_t http_accept_language_t;
|
||||
typedef msg_list_t http_accept_ranges_t;
|
||||
typedef msg_numeric_t http_age_t;
|
||||
typedef msg_list_t http_allow_t;
|
||||
typedef msg_auth_info_t http_authentication_info_t;
|
||||
typedef msg_auth_t http_authorization_t;
|
||||
typedef msg_list_t http_cache_control_t;
|
||||
typedef msg_list_t http_connection_t;
|
||||
typedef msg_content_encoding_t http_content_encoding_t;
|
||||
typedef msg_content_language_t http_content_language_t;
|
||||
typedef msg_content_length_t http_content_length_t;
|
||||
typedef msg_content_location_t http_content_location_t;
|
||||
typedef msg_generic_t http_content_md5_t;
|
||||
typedef struct http_content_range_s http_content_range_t;
|
||||
typedef msg_content_type_t http_content_type_t;
|
||||
typedef struct http_date_s http_date_t;
|
||||
typedef msg_generic_t http_etag_t;
|
||||
typedef msg_generic_t http_expect_t;
|
||||
typedef http_date_t http_expires_t;
|
||||
typedef msg_generic_t http_from_t;
|
||||
typedef struct http_host_s http_host_t;
|
||||
typedef msg_list_t http_if_match_t;
|
||||
typedef http_date_t http_if_modified_since_t;
|
||||
typedef msg_list_t http_if_none_match_t;
|
||||
typedef struct http_if_range_s http_if_range_t;
|
||||
typedef http_date_t http_if_unmodified_since_t;
|
||||
typedef http_date_t http_last_modified_t;
|
||||
typedef struct http_location_s http_location_t;
|
||||
typedef struct http_max_forwards_s http_max_forwards_t;
|
||||
typedef msg_generic_t http_mime_version_t;
|
||||
typedef msg_list_t http_pragma_t;
|
||||
typedef msg_auth_t http_proxy_authenticate_t;
|
||||
typedef msg_auth_t http_proxy_authorization_t;
|
||||
typedef struct http_range_s http_range_t;
|
||||
typedef struct http_location_s http_referer_t;
|
||||
typedef struct http_retry_after_s http_retry_after_t;
|
||||
typedef msg_generic_t http_server_t;
|
||||
typedef struct http_te_s http_te_t;
|
||||
typedef msg_list_t http_trailer_t;
|
||||
typedef msg_list_t http_transfer_encoding_t;
|
||||
typedef msg_list_t http_upgrade_t;
|
||||
typedef msg_generic_t http_user_agent_t;
|
||||
typedef msg_list_t http_vary_t;
|
||||
typedef struct http_via_s http_via_t;
|
||||
typedef msg_warning_t http_warning_t;
|
||||
typedef msg_auth_t http_www_authenticate_t;
|
||||
|
||||
typedef msg_list_t http_proxy_connection_t;
|
||||
|
||||
typedef struct http_set_cookie_s http_set_cookie_t;
|
||||
typedef struct http_cookie_s http_cookie_t;
|
||||
|
||||
/** Erroneous header. */
|
||||
typedef msg_error_t http_error_t;
|
||||
/** Unknown header. */
|
||||
typedef msg_generic_t http_unknown_t;
|
||||
/** Separator line between headers and message contents */
|
||||
typedef msg_separator_t http_separator_t;
|
||||
/** Entity-body */
|
||||
typedef msg_payload_t http_payload_t;
|
||||
/** Time in seconds since 01-Jan-1900. */
|
||||
typedef unsigned long http_time_t;
|
||||
/** Range offset. */
|
||||
typedef unsigned long http_off_t;
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* 3) Structure definitions
|
||||
*/
|
||||
|
||||
/** HTTP request line */
|
||||
struct http_request_s {
|
||||
msg_common_t rq_common[1];
|
||||
http_error_t *rq_next;
|
||||
http_method_t rq_method; /** Method enum. */
|
||||
char const *rq_method_name; /** Method name. */
|
||||
url_t rq_url[1]; /** URL. */
|
||||
char const *rq_version; /** Protocol version. */
|
||||
};
|
||||
|
||||
/** HTTP status line */
|
||||
struct http_status_s {
|
||||
msg_common_t st_common[1];
|
||||
http_error_t *st_next;
|
||||
char const *st_version;
|
||||
int st_status;
|
||||
char const *st_phrase;
|
||||
};
|
||||
|
||||
/**@ingroup http_authentication_info
|
||||
* @brief Structure for @b Authentication-Info header.
|
||||
*
|
||||
* @deprecated Use struct msg_auth_info_s instead.
|
||||
*/
|
||||
struct http_authentication_info_s
|
||||
{
|
||||
msg_common_t ai_common[1]; /**< Common fragment info */
|
||||
msg_error_t *ai_next; /**< Dummy link to next */
|
||||
msg_param_t const *ai_params; /**< List of authentication info */
|
||||
};
|
||||
|
||||
/** Content-Range */
|
||||
struct http_content_range_s {
|
||||
msg_common_t cr_common[1];
|
||||
http_error_t *cr_next;
|
||||
http_off_t cr_first; /**< First-byte-pos */
|
||||
http_off_t cr_last; /**< Last-byte-pos */
|
||||
http_off_t cr_length; /**< Instance-length */
|
||||
};
|
||||
|
||||
/** Date, Expires, If-Modified-Since, If-Unmodified-Since, Last-Modified */
|
||||
struct http_date_s {
|
||||
msg_common_t d_common[1];
|
||||
http_error_t *d_next;
|
||||
http_time_t d_time; /**< Seconds since Jan 1, 1900 */
|
||||
};
|
||||
|
||||
/** Host */
|
||||
struct http_host_s {
|
||||
msg_common_t h_common[1];
|
||||
http_error_t *h_next;
|
||||
char const *h_host;
|
||||
char const *h_port;
|
||||
};
|
||||
|
||||
/** If-Range */
|
||||
struct http_if_range_s {
|
||||
msg_common_t ifr_common[1];
|
||||
http_error_t *ifr_next;
|
||||
char const *ifr_tag; /**< Tag */
|
||||
http_time_t ifr_time; /**< Timestamp */
|
||||
};
|
||||
|
||||
/** Location, Referer */
|
||||
struct http_location_s {
|
||||
msg_common_t loc_common[1];
|
||||
http_error_t *loc_next;
|
||||
url_t loc_url[1];
|
||||
};
|
||||
|
||||
/** Max-Forwards */
|
||||
struct http_max_forwards_s {
|
||||
msg_common_t mf_common[1];
|
||||
http_error_t *mf_next;
|
||||
unsigned long mf_count;
|
||||
};
|
||||
|
||||
/** Range */
|
||||
struct http_range_s
|
||||
{
|
||||
msg_common_t rng_common[1];
|
||||
http_error_t *rng_next;
|
||||
char const *rng_unit;
|
||||
char const **rng_specs;
|
||||
};
|
||||
|
||||
/** Retry-After. */
|
||||
struct http_retry_after_s {
|
||||
msg_common_t ra_common[1]; /**< Common fragment info */
|
||||
http_error_t *ra_next; /**< Link to next (dummy) */
|
||||
http_time_t ra_date; /**< When to retry */
|
||||
http_time_t ra_delta; /**< Seconds to before retry */
|
||||
};
|
||||
|
||||
/** TE */
|
||||
struct http_te_s {
|
||||
msg_common_t te_common[1]; /**< Common fragment info */
|
||||
http_te_t *te_next; /**< Link to next t-coding */
|
||||
char const *te_extension; /**< Transfer-Extension */
|
||||
msg_param_t const *te_params; /**< List of parameters */
|
||||
char const *te_q; /**< Q-value */
|
||||
};
|
||||
|
||||
/** Via */
|
||||
struct http_via_s {
|
||||
msg_common_t v_common[1];
|
||||
http_via_t *v_next;
|
||||
char const *v_version;
|
||||
char const *v_host;
|
||||
char const *v_port;
|
||||
char const *v_comment;
|
||||
};
|
||||
|
||||
/** Cookie */
|
||||
struct http_cookie_s {
|
||||
msg_common_t c_common[1];
|
||||
http_cookie_t *c_next;
|
||||
msg_param_t const *c_params;
|
||||
char const *c_version;
|
||||
char const *c_name;
|
||||
char const *c_domain;
|
||||
char const *c_path;
|
||||
};
|
||||
|
||||
/** Set-Cookie */
|
||||
struct http_set_cookie_s {
|
||||
msg_common_t sc_common[1];
|
||||
http_set_cookie_t *sc_next;
|
||||
msg_param_t const *sc_params;
|
||||
char const *sc_name;
|
||||
char const *sc_version;
|
||||
char const *sc_domain;
|
||||
char const *sc_path;
|
||||
char const *sc_comment;
|
||||
char const *sc_max_age;
|
||||
unsigned sc_secure;
|
||||
};
|
||||
|
||||
/**HTTP message object.
|
||||
*
|
||||
* This structure contains a HTTP message object. It is used to access the
|
||||
* headers and payload within the message. The generic transport aspects of
|
||||
* the message, like network address, is accessed using a @b msg_t object
|
||||
* directly.
|
||||
*/
|
||||
struct http_s {
|
||||
msg_common_t http_common[1]; /**< For recursive inclusion */
|
||||
msg_pub_t *http_next; /**< Dummy pointer to next part */
|
||||
void *http_user; /**< Application data */
|
||||
unsigned http_size; /**< Size of this structure */
|
||||
int http_flags; /**< Flags */
|
||||
http_error_t *http_error; /**< Erroneous headers */
|
||||
|
||||
http_request_t *http_request; /**< Request line */
|
||||
http_status_t *http_status; /**< Status line */
|
||||
|
||||
/* === Headers start here */
|
||||
http_accept_t *http_accept; /**< Accept */
|
||||
http_accept_charset_t *http_accept_charset; /**< Accept-Charset */
|
||||
http_accept_encoding_t *http_accept_encoding; /**< Accept-Encoding */
|
||||
http_accept_language_t *http_accept_language; /**< Accept-Language */
|
||||
http_accept_ranges_t *http_accept_ranges; /**< Accept-Ranges */
|
||||
http_allow_t *http_allow; /**< Allow */
|
||||
http_authentication_info_t*http_authentication_info;/**<Authentication-Info*/
|
||||
http_authorization_t *http_authorization; /**< Authorization */
|
||||
http_age_t *http_age; /**< Age */
|
||||
http_cache_control_t *http_cache_control; /**< Cache-Control */
|
||||
http_connection_t *http_connection; /**< Connection */
|
||||
http_date_t *http_date; /**< Date */
|
||||
http_etag_t *http_etag; /**< ETag */
|
||||
http_expect_t *http_expect; /**< Expect */
|
||||
http_expires_t *http_expires; /**< Expires */
|
||||
http_from_t *http_from; /**< From */
|
||||
http_host_t *http_host; /**< Host */
|
||||
http_if_match_t *http_if_match; /**< If-Match */
|
||||
http_if_modified_since_t *http_if_modified_since; /**< If-Modified-Since */
|
||||
http_if_none_match_t *http_if_none_match; /**< If-None-Match */
|
||||
http_if_range_t *http_if_range; /**< If-Range */
|
||||
http_if_unmodified_since_t*http_if_unmodified_since;/**<If-Unmodified-Since*/
|
||||
http_last_modified_t *http_last_modified; /**< Last-Modified */
|
||||
http_location_t *http_location; /**< Location */
|
||||
http_max_forwards_t *http_max_forwards; /**< Max-Forwards */
|
||||
http_pragma_t *http_pragma; /**< Pragma */
|
||||
http_proxy_authenticate_t *http_proxy_authenticate;/**< Proxy-Authenticate */
|
||||
http_proxy_authorization_t*http_proxy_authorization;/**<Proxy-Authorization*/
|
||||
http_range_t *http_range; /**< Range */
|
||||
http_referer_t *http_referer; /**< Referer */
|
||||
http_retry_after_t *http_retry_after; /**< Retry-After */
|
||||
http_server_t *http_server; /**< Server */
|
||||
http_te_t *http_te; /**< TE */
|
||||
http_trailer_t *http_trailer; /**< Trailer */
|
||||
http_transfer_encoding_t *http_transfer_encoding; /**< Transfer-Encoding */
|
||||
http_upgrade_t *http_upgrade; /**< Upgrade */
|
||||
http_user_agent_t *http_user_agent; /**< User-Agent */
|
||||
http_vary_t *http_vary; /**< Vary */
|
||||
http_via_t *http_via; /**< Via */
|
||||
http_warning_t *http_warning; /**< Warning */
|
||||
http_www_authenticate_t *http_www_authenticate; /**< WWW-Authenticate */
|
||||
|
||||
http_proxy_connection_t *http_proxy_connection; /**< Proxy-Connection */
|
||||
http_set_cookie_t *http_set_cookie; /**< Set-Cookie */
|
||||
http_cookie_t *http_cookie; /**< Cookie */
|
||||
|
||||
http_mime_version_t *http_mime_version; /**< MIME-Version */
|
||||
http_content_encoding_t *http_content_encoding; /**< Content-Encoding */
|
||||
http_content_language_t *http_content_language; /**< Content-Language */
|
||||
http_content_length_t *http_content_length; /**< Content-Length */
|
||||
http_content_location_t *http_content_location; /**< Content-Location */
|
||||
http_content_md5_t *http_content_md5; /**< Content-MD5 */
|
||||
http_content_range_t *http_content_range; /**< Content-Range */
|
||||
http_content_type_t *http_content_type; /**< Content-Type */
|
||||
|
||||
/* === Headers end here */
|
||||
http_header_t *http_unknown; /**< Unknown headers. */
|
||||
http_separator_t *http_separator;
|
||||
/**< Separator between message and payload */
|
||||
http_payload_t *http_payload; /**< Message entity-body */
|
||||
};
|
||||
|
||||
/**Union representing any HTTP header.
|
||||
*
|
||||
* Each different header is an array of size 1.
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
union http_header_u {
|
||||
msg_common_t sh_common[1];
|
||||
struct {
|
||||
msg_common_t shn_common;
|
||||
http_header_t *shn_next;
|
||||
} sh_header_next[1];
|
||||
|
||||
msg_auth_t sh_auth[1];
|
||||
msg_generic_t sh_generic[1];
|
||||
msg_numeric_t sh_numeric[1];
|
||||
|
||||
http_request_t sh_request[1];
|
||||
http_status_t sh_status[1];
|
||||
http_error_t sh_error[1];
|
||||
http_unknown_t sh_unknown[1];
|
||||
http_separator_t sh_separator[1];
|
||||
http_payload_t sh_payload[1];
|
||||
|
||||
/* Proper headers */
|
||||
http_via_t sh_via[1];
|
||||
http_host_t sh_host[1];
|
||||
http_from_t sh_from[1];
|
||||
http_referer_t sh_referer[1];
|
||||
http_connection_t sh_connection[1];
|
||||
|
||||
http_accept_t sh_accept[1];
|
||||
http_accept_charset_t sh_accept_charset[1];
|
||||
http_accept_encoding_t sh_accept_encoding[1];
|
||||
http_accept_language_t sh_accept_language[1];
|
||||
http_accept_ranges_t sh_accept_ranges[1];
|
||||
http_allow_t sh_allow[1];
|
||||
http_te_t sh_te[1];
|
||||
|
||||
http_authentication_info_t sh_authentication_info[1];
|
||||
http_authorization_t sh_authorization[1];
|
||||
http_www_authenticate_t sh_www_authenticate[1];
|
||||
http_proxy_authenticate_t sh_proxy_authenticate[1];
|
||||
http_proxy_authorization_t sh_proxy_authorization[1];
|
||||
|
||||
http_age_t sh_age[1];
|
||||
http_cache_control_t sh_cache_control[1];
|
||||
http_date_t sh_date[1];
|
||||
http_expires_t sh_expires[1];
|
||||
http_if_match_t sh_if_match[1];
|
||||
http_if_modified_since_t sh_if_modified_since[1];
|
||||
http_if_none_match_t sh_if_none_match[1];
|
||||
http_if_range_t sh_if_range[1];
|
||||
http_if_unmodified_since_t sh_if_unmodified_since[1];
|
||||
|
||||
http_etag_t sh_etag[1];
|
||||
http_expect_t sh_expect[1];
|
||||
http_last_modified_t sh_last_modified[1];
|
||||
http_location_t sh_location[1];
|
||||
http_max_forwards_t sh_max_forwards[1];
|
||||
http_pragma_t sh_pragma[1];
|
||||
http_range_t sh_range[1];
|
||||
http_retry_after_t sh_retry_after[1];
|
||||
http_trailer_t sh_trailer[1];
|
||||
http_upgrade_t sh_upgrade[1];
|
||||
http_vary_t sh_vary[1];
|
||||
http_warning_t sh_warning[1];
|
||||
|
||||
http_user_agent_t sh_user_agent[1];
|
||||
http_server_t sh_server[1];
|
||||
|
||||
http_mime_version_t sh_mime_version[1];
|
||||
http_content_language_t sh_content_language[1];
|
||||
http_content_location_t sh_content_location[1];
|
||||
http_content_md5_t sh_content_md5[1];
|
||||
http_content_range_t sh_content_range[1];
|
||||
http_content_encoding_t sh_content_encoding[1];
|
||||
http_transfer_encoding_t sh_transfer_encoding[1];
|
||||
http_content_type_t sh_content_type[1];
|
||||
http_content_length_t sh_content_length[1];
|
||||
|
||||
};
|
||||
|
||||
SOFIA_END_DECLS
|
||||
|
||||
#endif /* !defined(HTTP_H) */
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* This file is part of the Sofia-SIP package
|
||||
*
|
||||
* Copyright (C) 2005 Nokia Corporation.
|
||||
*
|
||||
* Contact: Pekka Pessi <pekka.pessi@nokia.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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 this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef HTTP_HCLASSES_H
|
||||
/** Defined when <sofia-sip/http_hclasses.h> has been included. */
|
||||
#define HTTP_HCLASSES_H
|
||||
|
||||
/**@file sofia-sip/http_hclasses.h
|
||||
* @brief HTTP header classes.
|
||||
*
|
||||
* @author Pekka Pessi <Pekka.Pessi@nokia.com>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MSG_TYPES_H
|
||||
#include <sofia-sip/msg_types.h>
|
||||
#endif
|
||||
|
||||
SOFIA_BEGIN_DECLS
|
||||
|
||||
/* Use directly these header classes */
|
||||
|
||||
#define http_accept_class msg_accept_class
|
||||
#define http_accept_charset_class msg_accept_charset_class
|
||||
#define http_accept_encoding_class msg_accept_encoding_class
|
||||
#define http_accept_language_class msg_accept_language_class
|
||||
#define http_content_encoding_class msg_content_encoding_class
|
||||
#define http_content_length_class msg_content_length_class
|
||||
#define http_content_md5_class msg_content_md5_class
|
||||
#define http_content_type_class msg_content_type_class
|
||||
#define http_content_id_class msg_content_id_class
|
||||
#define http_content_location_class msg_content_location_class
|
||||
#define http_content_language_class msg_content_language_class
|
||||
#define http_mime_version_class msg_mime_version_class
|
||||
|
||||
#define http_error_class msg_error_class
|
||||
#define http_unknown_class msg_unknown_class
|
||||
#define http_separator_class msg_separator_class
|
||||
#define http_payload_class msg_payload_class
|
||||
|
||||
SOFIA_END_DECLS
|
||||
|
||||
#ifndef HTTP_PROTOS_H
|
||||
#define HTTP_HCLASSES_ONLY
|
||||
#include <sofia-sip/http_protos.h>
|
||||
#undef HTTP_HCLASSES_ONLY
|
||||
#endif
|
||||
|
||||
#endif /* !defined HTTP_HCLASSES_H */
|
||||
@@ -0,0 +1,271 @@
|
||||
/*
|
||||
* This file is part of the Sofia-SIP package
|
||||
*
|
||||
* Copyright (C) 2005 Nokia Corporation.
|
||||
*
|
||||
* Contact: Pekka Pessi <pekka.pessi@nokia.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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 this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef HTTP_HEADER_H
|
||||
/** Defined when <sofia-sip/http_header.h> has been included.*/
|
||||
#define HTTP_HEADER_H
|
||||
|
||||
/**@file sofia-sip/http_header.h
|
||||
*
|
||||
* HTTP library prototypes.
|
||||
*
|
||||
* @author Pekka Pessi <Pekka.Pessi@nokia.com>
|
||||
*
|
||||
* @date Created: Tue Jun 13 02:58:26 2000 ppessi
|
||||
*/
|
||||
|
||||
#ifndef SU_ALLOC_H
|
||||
#include <sofia-sip/su_alloc.h>
|
||||
#endif
|
||||
|
||||
#ifndef SU_TAG_H
|
||||
#include <sofia-sip/su_tag.h>
|
||||
#endif
|
||||
|
||||
#ifndef HTTP_H
|
||||
#include <sofia-sip/http.h>
|
||||
#endif
|
||||
|
||||
#ifndef MSG_HEADER_H
|
||||
#include <sofia-sip/msg_header.h>
|
||||
#endif
|
||||
|
||||
SOFIA_BEGIN_DECLS
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* 1) Macros
|
||||
*/
|
||||
|
||||
/** Initialize a HTTP header structure. */
|
||||
#define HTTP_HEADER_INIT(h, http_class, size) \
|
||||
((void)memset((h), 0, (size)), \
|
||||
(void)(((msg_common_t *)(h))->h_class = (http_class)), \
|
||||
(h))
|
||||
|
||||
#define HTTP_METHOD_NAME(method, name) \
|
||||
((method) == http_method_unknown ? (name) : http_method_name(method, name))
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* 2) Variables
|
||||
*/
|
||||
|
||||
SOFIAPUBVAR char const http_method_name_get[];
|
||||
SOFIAPUBVAR char const http_method_name_post[];
|
||||
SOFIAPUBVAR char const http_method_name_head[];
|
||||
SOFIAPUBVAR char const http_method_name_options[];
|
||||
SOFIAPUBVAR char const http_method_name_put[];
|
||||
SOFIAPUBVAR char const http_method_name_delete[];
|
||||
SOFIAPUBVAR char const http_method_name_trace[];
|
||||
SOFIAPUBVAR char const http_method_name_connect[];
|
||||
|
||||
/** HTTP 0.9 */
|
||||
SOFIAPUBVAR char const http_version_0_9[];
|
||||
|
||||
/** HTTP 1.0 */
|
||||
SOFIAPUBVAR char const http_version_1_0[];
|
||||
|
||||
/** HTTP 1.1 version. */
|
||||
SOFIAPUBVAR char const http_version_1_1[];
|
||||
|
||||
#define HTTP_VERSION_CURRENT http_version_1_1
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* 3) Prototypes
|
||||
*/
|
||||
|
||||
/** HTTP parser description. */
|
||||
SOFIAPUBFUN msg_mclass_t *http_default_mclass(void);
|
||||
|
||||
/** Complete a HTTP request. */
|
||||
SOFIAPUBFUN int http_request_complete(msg_t *msg);
|
||||
|
||||
/** Complete a HTTP message. */
|
||||
SOFIAPUBFUN int http_message_complete(msg_t *msg, http_t *http);
|
||||
|
||||
/** Add a duplicate of header object to a HTTP message. */
|
||||
SOFIAPUBFUN int http_add_dup(msg_t *, http_t *, http_header_t const *);
|
||||
|
||||
/** Add a header to the HTTP message. */
|
||||
SOFIAPUBFUN int http_add_make(msg_t *msg, http_t *http,
|
||||
msg_hclass_t *hc, char const *s);
|
||||
|
||||
/** Add a header to the HTTP message. */
|
||||
SOFIAPUBFUN int http_add_format(msg_t *msg, http_t *http, msg_hclass_t *hc,
|
||||
char const *fmt, ...);
|
||||
|
||||
/** Add tagged headers to the HTTP message */
|
||||
SOFIAPUBFUN int http_add_tl(msg_t *msg, http_t *http,
|
||||
tag_type_t tag, tag_value_t value, ...);
|
||||
|
||||
/** Remove schema, host, and port from URL */
|
||||
SOFIAPUBFUN int http_strip_hostport(url_t *url);
|
||||
|
||||
/** Add required headers to the response message */
|
||||
SOFIAPUBFUN int http_complete_response(msg_t *msg,
|
||||
int status, char const *phrase,
|
||||
http_t const *request);
|
||||
|
||||
/** Return string corresponding to the method. */
|
||||
SOFIAPUBFUN char const *http_method_name(http_method_t method,
|
||||
char const *name);
|
||||
|
||||
/** Return enum corresponding to the method name */
|
||||
SOFIAPUBFUN http_method_t http_method_code(char const *name);
|
||||
|
||||
#if !SU_HAVE_INLINE
|
||||
SOFIAPUBFUN http_t *http_object(msg_t *msg);
|
||||
SOFIAPUBFUN int http_header_insert(msg_t *msg, http_t *http, http_header_t *h);
|
||||
SOFIAPUBFUN int http_header_remove(msg_t *msg, http_t *http, http_header_t *h);
|
||||
SOFIAPUBFUN char const *http_header_name(http_header_t const *h, int compact);
|
||||
SOFIAPUBFUN void *http_header_data(http_header_t *h);
|
||||
SOFIAPUBFUN http_content_length_t *http_content_length_create(su_home_t *home,
|
||||
uint32_t n);
|
||||
SOFIAPUBFUN http_payload_t *http_payload_create(su_home_t *home,
|
||||
void const *data, usize_t len);
|
||||
SOFIAPUBFUN http_separator_t *http_separator_create(su_home_t *home);
|
||||
#endif
|
||||
|
||||
SOFIAPUBFUN http_header_t *http_header_format(su_home_t *home, msg_hclass_t *,
|
||||
char const *fmt, ...);
|
||||
|
||||
|
||||
/** Create a request line object. */
|
||||
SOFIAPUBFUN http_request_t *http_request_create(su_home_t *home,
|
||||
http_method_t method,
|
||||
const char *name,
|
||||
url_string_t const *url,
|
||||
char const *version);
|
||||
|
||||
/** Create a status line object. */
|
||||
SOFIAPUBFUN http_status_t *http_status_create(su_home_t *home,
|
||||
unsigned status,
|
||||
char const *phrase,
|
||||
char const *version);
|
||||
|
||||
/** Create an @b Host header object. */
|
||||
SOFIAPUBFUN http_host_t *http_host_create(su_home_t *home,
|
||||
char const *host,
|
||||
char const *port);
|
||||
|
||||
/** Create an @b Date header object. */
|
||||
SOFIAPUBFUN http_date_t *http_date_create(su_home_t *home, http_time_t t);
|
||||
|
||||
/** Create an @b Expires header object. */
|
||||
SOFIAPUBFUN http_expires_t *http_expires_create(su_home_t *home,
|
||||
http_time_t delta);
|
||||
|
||||
/** Compare two HTTP URLs. */
|
||||
SOFIAPUBFUN int http_url_cmp(url_t const *a, url_t const *b);
|
||||
|
||||
/** Parse query part in HTTP URL. */
|
||||
SOFIAPUBFUN issize_t http_query_parse(char *query,
|
||||
/* char const *key, char **return_value, */
|
||||
...);
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* 4) Inlined functions
|
||||
*/
|
||||
|
||||
#if SU_HAVE_INLINE
|
||||
/** Get HTTP structure from msg. */
|
||||
su_inline
|
||||
http_t *http_object(msg_t *msg)
|
||||
{
|
||||
return (http_t *)msg_public(msg, HTTP_PROTOCOL_TAG);
|
||||
}
|
||||
|
||||
/** Insert a (list of) header(s) to the header structure and fragment chain.
|
||||
*
|
||||
* The function @c http_header_insert() inserts header or list of headers
|
||||
* into a HTTP message. It also inserts them into the the message fragment
|
||||
* chain, if it exists.
|
||||
*
|
||||
* When inserting headers into the fragment chain, a request (or status) is
|
||||
* inserted first and replaces the existing request (or status). The Via
|
||||
* headers are inserted after the request or status, and rest of the headers
|
||||
* after request, status, or Via headers.
|
||||
*
|
||||
* If the header is a singleton, existing headers with the same class are
|
||||
* removed.
|
||||
*
|
||||
* @param msg message owning the fragment chain
|
||||
* @param http HTTP message structure to which header is added
|
||||
* @param h list of header(s) to be added
|
||||
*/
|
||||
su_inline
|
||||
int http_header_insert(msg_t *msg, http_t *http, http_header_t *h)
|
||||
{
|
||||
return msg_header_insert(msg, (msg_pub_t *)http, (msg_header_t *)h);
|
||||
}
|
||||
|
||||
/** Remove a header from a HTTP message. */
|
||||
su_inline
|
||||
int http_header_remove(msg_t *msg, http_t *http, http_header_t *h)
|
||||
{
|
||||
return msg_header_remove(msg, (msg_pub_t *)http, (msg_header_t *)h);
|
||||
}
|
||||
|
||||
/** Return name of the header. */
|
||||
su_inline
|
||||
char const *http_header_name(http_header_t const *h, int compact)
|
||||
{
|
||||
if (compact && h->sh_class->hc_short[0])
|
||||
return h->sh_class->hc_short;
|
||||
else
|
||||
return h->sh_class->hc_name;
|
||||
}
|
||||
|
||||
/** Return data after header structure. */
|
||||
su_inline
|
||||
void *http_header_data(http_header_t *h)
|
||||
{
|
||||
return h && h != HTTP_NONE ? h->sh_class->hc_size + (char *)h : NULL;
|
||||
}
|
||||
|
||||
su_inline
|
||||
http_content_length_t *http_content_length_create(su_home_t *home, uint32_t n)
|
||||
{
|
||||
return msg_content_length_create(home, n);
|
||||
}
|
||||
|
||||
su_inline
|
||||
http_payload_t *http_payload_create(su_home_t *home, void const *data, isize_t len)
|
||||
{
|
||||
return msg_payload_create(home, data, len);
|
||||
}
|
||||
|
||||
su_inline
|
||||
http_separator_t *http_separator_create(su_home_t *home)
|
||||
{
|
||||
return msg_separator_create(home);
|
||||
}
|
||||
#endif
|
||||
|
||||
SOFIA_END_DECLS
|
||||
|
||||
#ifndef HTTP_PROTOS_H
|
||||
#include <sofia-sip/http_protos.h>
|
||||
#endif
|
||||
|
||||
#endif /* !defined(HTTP_HEADER_H) */
|
||||
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* This file is part of the Sofia-SIP package
|
||||
*
|
||||
* Copyright (C) 2005 Nokia Corporation.
|
||||
*
|
||||
* Contact: Pekka Pessi <pekka.pessi@nokia.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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 this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef HTTP_PARSER_H
|
||||
/**Defined when <sofia-sip/http_parser.h> has been included.*/
|
||||
#define HTTP_PARSER_H
|
||||
/**@file sofia-sip/http_parser.h
|
||||
* @brief Typedefs and prototypes used by HTTP parser.
|
||||
*
|
||||
* @author Pekka Pessi <Pekka.Pessi@nokia.com>
|
||||
*
|
||||
* @date Created: Tue Jun 13 02:58:26 2000 ppessi
|
||||
*/
|
||||
|
||||
#ifndef SU_ALLOC_H
|
||||
#include <sofia-sip/su_alloc.h>
|
||||
#endif
|
||||
|
||||
#ifndef MSG_H
|
||||
#include <sofia-sip/msg.h>
|
||||
#endif
|
||||
|
||||
#ifndef MSG_PARSER_H
|
||||
#include <sofia-sip/msg_parser.h>
|
||||
#endif
|
||||
|
||||
#ifndef HTTP_H
|
||||
#include <sofia-sip/http.h>
|
||||
#endif
|
||||
|
||||
#ifndef HTTP_HEADER_H
|
||||
#include <sofia-sip/http_header.h>
|
||||
#endif
|
||||
|
||||
SOFIA_BEGIN_DECLS
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* 1) Macros for defining boilerplate functions and structures for each header
|
||||
*/
|
||||
|
||||
#define HTTP_HCLASS_TAG HTTP_PROTOCOL_TAG
|
||||
#define HTTP_HCLASS_TEST(x) ((x) && (x)->hc_tag == HTTP_PROTOCOL_TAG)
|
||||
#define HTTP_HDR_TEST(x) ((x)->sh_class && HTTP_HCLASS_TEST((x)->sh_class))
|
||||
|
||||
/** Define a header class for a HTTP header. */
|
||||
#define HTTP_HEADER_CLASS(c, l, params, kind, dup) \
|
||||
MSG_HEADER_CLASS(http_, c, l, "", params, kind, http_ ## dup, http_no)
|
||||
|
||||
/** This is used by headers with no extra data in copy */
|
||||
#define HTTP_HEADER_CLASS_G(c, l, kind) \
|
||||
MSG_HEADER_CLASS(http_, c, l, "", g_common, kind, msg_generic, http_no)
|
||||
|
||||
/** Define a header class for a msg_list_t kind of header */
|
||||
#define HTTP_HEADER_CLASS_LIST(c, l, kind) \
|
||||
MSG_HEADER_CLASS(http_, c, l, "", k_items, kind, msg_list, http_no)
|
||||
|
||||
/** Define a authorization header class */
|
||||
#define HTTP_HEADER_CLASS_AUTH(c, l, kind) \
|
||||
MSG_HEADER_CLASS(http_, c, l, "", au_params, kind, msg_auth, http_no)
|
||||
|
||||
#define http_numeric_dup_xtra msg_default_dup_xtra
|
||||
#define http_numeric_dup_one msg_default_dup_one
|
||||
|
||||
#define http_default_dup_xtra msg_default_dup_xtra
|
||||
#define http_default_dup_one msg_default_dup_one
|
||||
|
||||
#define http_no_update NULL
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* 2) Prototypes for HTTP-specific decoding/encoding functions
|
||||
*/
|
||||
|
||||
/* Version strings */
|
||||
SOFIAPUBFUN int http_version_d(char **ss, char const **ver);
|
||||
SOFIAPUBFUN isize_t http_version_xtra(char const *version);
|
||||
SOFIAPUBFUN void http_version_dup(char **pp, char const **dd, char const *s);
|
||||
|
||||
/* Method */
|
||||
SOFIAPUBFUN http_method_t http_method_d(char **ss, char const **nname);
|
||||
SOFIAPUBFUN char const *http_method_name(http_method_t method,
|
||||
char const *name);
|
||||
|
||||
/** Extract HTTP message body */
|
||||
SOFIAPUBFUN issize_t http_extract_body(msg_t *, http_t *,
|
||||
char b[], isize_t bsiz, int eos);
|
||||
|
||||
SOFIA_END_DECLS
|
||||
|
||||
#endif /* !defined(HTTP_PARSER_H) */
|
||||
@@ -0,0 +1,311 @@
|
||||
/** -*- C -*-
|
||||
* @file sofia-sip/http_protos.h.in
|
||||
*
|
||||
* Template for <http_protos.h>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file is part of the Sofia-SIP package
|
||||
*
|
||||
* Copyright (C) 2005 Nokia Corporation.
|
||||
*
|
||||
* Contact: Pekka Pessi <pekka.pessi@nokia.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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 this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef HTTP_PROTOS_H
|
||||
/** Defined when <sofia-sip/http_protos.h> has been included. */
|
||||
#define HTTP_PROTOS_H
|
||||
|
||||
/**@file sofia-sip/http_protos.h
|
||||
*
|
||||
* Macros for each HTTP header.
|
||||
*
|
||||
* #AUTO#
|
||||
*
|
||||
* @author Pekka Pessi <Pekka.Pessi@nokia.com>
|
||||
*/
|
||||
|
||||
#include <sofia-sip/su_config.h>
|
||||
|
||||
#ifndef HTTP_HEADER_H
|
||||
#include <sofia-sip/http_header.h>
|
||||
#endif
|
||||
#ifndef HTTP_HCLASSES_H
|
||||
#include <sofia-sip/http_hclasses.h>
|
||||
#endif
|
||||
|
||||
#define http_header_make(h, c, s) \
|
||||
((http_header_t *)msg_header_make((h), (c), (s)))
|
||||
#define http_header_vformat(h, c, f, a) \
|
||||
((http_header_t *)msg_header_vformat((h), (c), (f), (a)))
|
||||
|
||||
SOFIA_BEGIN_DECLS
|
||||
|
||||
/* Declare internal prototypes for #xxxxxxx_xxxxxxx# */
|
||||
|
||||
/**@addtogroup http_#xxxxxx#*/ /** @{ */
|
||||
|
||||
enum {
|
||||
/** Hash of #xxxxxxx_xxxxxxx#. @internal*/
|
||||
http_#xxxxxx#_hash = #hash#
|
||||
};
|
||||
|
||||
/**Header class for HTTP #xxxxxxx_xxxxxxx#.
|
||||
*
|
||||
* The header class http_#xxxxxx#_class defines how a HTTP
|
||||
* #xxxxxxx_xxxxxxx# is parsed and printed. It also
|
||||
* contains methods used by HTTP parser and other functions
|
||||
* to manipulate the http_#xxxxxx#_t header structure.
|
||||
*
|
||||
*/
|
||||
SOFIAPUBVAR msg_hclass_t http_#xxxxxx#_class[];
|
||||
|
||||
#ifndef HTTP_HCLASSES_ONLY
|
||||
|
||||
/** Decode (parse) a #xxxxxxx_xxxxxxx#. @internal */
|
||||
SOFIAPUBFUN msg_parse_f http_#xxxxxx#_d;
|
||||
|
||||
/** Encode (print) a #xxxxxxx_xxxxxxx#. @internal */
|
||||
SOFIAPUBFUN msg_print_f http_#xxxxxx#_e;
|
||||
|
||||
/**Initializer for structure http_#xxxxxx#_t.
|
||||
*
|
||||
* A static http_#xxxxxx#_t structure must be initialized
|
||||
* with the HTTP_#XXXXXX#_INIT() macro. For instance,
|
||||
* @code
|
||||
*
|
||||
* http_#xxxxxx#_t http_#xxxxxx# = HTTP_#XXXXXX#_INIT;
|
||||
*
|
||||
* @endcode
|
||||
* @HI
|
||||
*/
|
||||
#define HTTP_#XXXXXX#_INIT() HTTP_HDR_INIT(#xxxxxx#)
|
||||
|
||||
/**Initialize a structure http_#xxxxxx#_t.
|
||||
*
|
||||
* An http_#xxxxxx#_t structure can be initialized with the
|
||||
* http_#xxxxxx#_init() function/macro. For instance,
|
||||
* @code
|
||||
*
|
||||
* http_#xxxxxx#_t http_#xxxxxx#;
|
||||
*
|
||||
* http_#xxxxxx#_init(&http_#xxxxxx#);
|
||||
*
|
||||
* @endcode
|
||||
* @HI
|
||||
*/
|
||||
#if SU_HAVE_INLINE
|
||||
su_inline http_#xxxxxx#_t *http_#xxxxxx#_init(http_#xxxxxx#_t x[1])
|
||||
{
|
||||
return HTTP_HEADER_INIT(x, http_#xxxxxx#_class, sizeof(http_#xxxxxx#_t));
|
||||
}
|
||||
#else
|
||||
#define http_#xxxxxx#_init(x) \
|
||||
HTTP_HEADER_INIT(x, http_#xxxxxx#_class, sizeof(http_#xxxxxx#_t))
|
||||
#endif
|
||||
|
||||
/**Test if header object is instance of http_#xxxxxx#_t.
|
||||
*
|
||||
* The function http_is_#xxxxxx#() returns true (nonzero) if
|
||||
* the header class is an instance of #xxxxxxx_xxxxxxx#
|
||||
* object and false (zero) otherwise.
|
||||
*
|
||||
* @param header pointer to the header structure to be tested
|
||||
*
|
||||
* @return
|
||||
* The function http_is_x#xxxxxx#() returns true (nonzero) if
|
||||
* the header object is an instance of header #xxxxxx# and
|
||||
* false (zero) otherwise.
|
||||
*/
|
||||
#if SU_HAVE_INLINE
|
||||
su_inline
|
||||
int http_is_#xxxxxx#(http_header_t const *header)
|
||||
{
|
||||
return header && header->sh_class->hc_hash == http_#xxxxxx#_hash;
|
||||
}
|
||||
#else
|
||||
#define http_is_#xxxxxx#(h) \
|
||||
((h) && ((msg_common_t *)(h))->h_class->hc_hash == http_#xxxxxx#_hash)
|
||||
#endif
|
||||
|
||||
/**Duplicate (deep copy) @c http_#xxxxxx#_t.
|
||||
*
|
||||
* The function http_#xxxxxx#_dup() duplicates a header
|
||||
* structure @a hdr. If the header structure @a hdr
|
||||
* contains a reference (@c hdr->x_next) to a list of
|
||||
* headers, all the headers in the list are duplicated, too.
|
||||
*
|
||||
* @param home memory home used to allocate new structure
|
||||
* @param hdr header structure to be duplicated
|
||||
*
|
||||
* When duplicating, all parameter lists and non-constant
|
||||
* strings attached to the header are copied, too. The
|
||||
* function uses given memory @a home to allocate all the
|
||||
* memory areas used to copy the header.
|
||||
*
|
||||
* @par Example
|
||||
* @code
|
||||
*
|
||||
* #xxxxxx# = http_#xxxxxx#_dup(home, http->http_#xxxxxx#);
|
||||
*
|
||||
* @endcode
|
||||
*
|
||||
* @return
|
||||
* The function http_#xxxxxx#_dup() returns a pointer to the
|
||||
* newly duplicated http_#xxxxxx#_t header structure, or NULL
|
||||
* upon an error.
|
||||
*/
|
||||
#if SU_HAVE_INLINE
|
||||
su_inline
|
||||
#endif
|
||||
http_#xxxxxx#_t *http_#xxxxxx#_dup(su_home_t *home,
|
||||
http_#xxxxxx#_t const *hdr)
|
||||
__attribute__((__malloc__));
|
||||
|
||||
/**Copy a http_#xxxxxx#_t header structure.
|
||||
*
|
||||
* The function http_#xxxxxx#_copy() copies a header structure @a
|
||||
* hdr. If the header structure @a hdr contains a reference (@c
|
||||
* hdr->h_next) to a list of headers, all the headers in that
|
||||
* list are copied, too. The function uses given memory @a home
|
||||
* to allocate all the memory areas used to copy the header
|
||||
* structure @a hdr.
|
||||
*
|
||||
* @param home memory home used to allocate new structure
|
||||
* @param hdr pointer to the header structure to be duplicated
|
||||
*
|
||||
* When copying, only the header structure and parameter lists
|
||||
* attached to it are duplicated. The new header structure
|
||||
* retains all the references to the strings within the old @a
|
||||
* header, including the encoding of the old header, if present.
|
||||
*
|
||||
* @par Example
|
||||
* @code
|
||||
*
|
||||
* #xxxxxx# = http_#xxxxxx#_copy(home, http->http_#xxxxxx#);
|
||||
*
|
||||
* @endcode
|
||||
*
|
||||
* @return
|
||||
* The function http_#xxxxxx#_copy() returns a pointer to
|
||||
* newly copied header structure, or NULL upon an error.
|
||||
*/
|
||||
#if SU_HAVE_INLINE
|
||||
su_inline
|
||||
#endif
|
||||
http_#xxxxxx#_t *http_#xxxxxx#_copy(su_home_t *home,
|
||||
http_#xxxxxx#_t const *hdr)
|
||||
__attribute__((__malloc__));
|
||||
|
||||
/**Make a header structure http_#xxxxxx#_t.
|
||||
*
|
||||
* The function http_#xxxxxx#_make() makes a new
|
||||
* http_#xxxxxx#_t header structure. It allocates a new
|
||||
* header structure, and decodes the string @a s as the
|
||||
* value of the structure.
|
||||
*
|
||||
* @param home memory home used to allocate new header structure.
|
||||
* @param s string to be decoded as value of the new header structure
|
||||
*
|
||||
* @note This function is usually implemented as a macro calling
|
||||
* http_header_make().
|
||||
*
|
||||
* @return
|
||||
* The function http_#xxxxxx#_make() returns a pointer to
|
||||
* newly maked http_#xxxxxx#_t header structure, or NULL upon
|
||||
* an error.
|
||||
*/
|
||||
#if SU_HAVE_INLINE
|
||||
su_inline
|
||||
#endif
|
||||
http_#xxxxxx#_t *http_#xxxxxx#_make(su_home_t *home, char const *s)
|
||||
__attribute__((__malloc__));
|
||||
|
||||
/**Make a #xxxxxxx_xxxxxxx# from formatting result.
|
||||
*
|
||||
* The function http_#xxxxxx#_format() makes a new
|
||||
* #xxxxxxx_xxxxxxx# object using formatting result as its
|
||||
* value. The function first prints the arguments according to
|
||||
* the format @a fmt specified. Then it allocates a new header
|
||||
* structure, and uses the formatting result as the header
|
||||
* value.
|
||||
*
|
||||
* @param home memory home used to allocate new header structure.
|
||||
* @param fmt string used as a printf()-style format
|
||||
* @param ... argument list for format
|
||||
*
|
||||
* @note This function is usually implemented as a macro calling
|
||||
* msg_header_format().
|
||||
*
|
||||
* @return
|
||||
* The function http_#xxxxxx#_format() returns a pointer to newly
|
||||
* makes header structure, or NULL upon an error.
|
||||
*
|
||||
* @HIDE
|
||||
*/
|
||||
#if SU_HAVE_INLINE
|
||||
su_inline
|
||||
#endif
|
||||
http_#xxxxxx#_t *http_#xxxxxx#_format(su_home_t *home, char const *fmt, ...)
|
||||
__attribute__((__malloc__, __format__ (printf, 2, 3)));
|
||||
|
||||
|
||||
/* Inlined functions */
|
||||
#if SU_HAVE_INLINE
|
||||
su_inline
|
||||
http_#xxxxxx#_t *http_#xxxxxx#_format(su_home_t *home, char const *fmt, ...)
|
||||
{
|
||||
http_header_t *h;
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
h = http_header_vformat(home, http_#xxxxxx#_class, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
return (http_#xxxxxx#_t *)h;
|
||||
}
|
||||
|
||||
su_inline
|
||||
http_#xxxxxx#_t *http_#xxxxxx#_dup(su_home_t *home, http_#xxxxxx#_t const *o)
|
||||
{
|
||||
return (http_#xxxxxx#_t *)
|
||||
msg_header_dup_as(home, http_#xxxxxx#_class, (msg_header_t const *)o);
|
||||
}
|
||||
|
||||
su_inline
|
||||
http_#xxxxxx#_t *http_#xxxxxx#_copy(su_home_t *home, http_#xxxxxx#_t const *o)
|
||||
{
|
||||
return (http_#xxxxxx#_t *)
|
||||
msg_header_copy_as(home, http_#xxxxxx#_class, (msg_header_t const *)o);
|
||||
}
|
||||
|
||||
su_inline
|
||||
http_#xxxxxx#_t *http_#xxxxxx#_make(su_home_t *home, char const *s)
|
||||
{
|
||||
return (http_#xxxxxx#_t *)http_header_make(home, http_#xxxxxx#_class, s);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !define HTTP_HCLASSES_ONLY */
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
SOFIA_END_DECLS
|
||||
#endif /* !defined(HTTP_PROTOS_H) */
|
||||
@@ -0,0 +1,129 @@
|
||||
/*
|
||||
* This file is part of the Sofia-SIP package
|
||||
*
|
||||
* Copyright (C) 2005 Nokia Corporation.
|
||||
*
|
||||
* Contact: Pekka Pessi <pekka.pessi@nokia.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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 this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef HTTP_STATUS_H
|
||||
#define HTTP_STATUS_H
|
||||
|
||||
/**@file sofia-sip/http_status.h
|
||||
*
|
||||
* HTTP status codes.
|
||||
*
|
||||
* @author Pekka Pessi <Pekka.Pessi@nokia.com>
|
||||
*
|
||||
* @date Created: Tue Sep 18 18:55:09 2001 ppessi
|
||||
*/
|
||||
|
||||
#include <sofia-sip/su_config.h>
|
||||
|
||||
SOFIA_BEGIN_DECLS
|
||||
|
||||
SOFIAPUBFUN char const *http_status_phrase(int status);
|
||||
|
||||
#define HTTP_100_CONTINUE 100, http_100_continue
|
||||
#define HTTP_101_SWITCHING 101, http_101_switching
|
||||
#define HTTP_200_OK 200, http_200_ok
|
||||
#define HTTP_201_CREATED 201, http_201_created
|
||||
#define HTTP_202_ACCEPTED 202, http_202_accepted
|
||||
#define HTTP_203_NON_AUTH_INFO 203, http_203_non_auth_info
|
||||
#define HTTP_204_NO_CONTENT 204, http_204_no_content
|
||||
#define HTTP_205_RESET_CONTENT 205, http_205_reset_content
|
||||
#define HTTP_206_PARTIAL_CONTENT 206, http_206_partial_content
|
||||
#define HTTP_300_MULTIPLE_CHOICES 300, http_300_multiple_choices
|
||||
#define HTTP_301_MOVED_PERMANENTLY 301, http_301_moved_permanently
|
||||
#define HTTP_302_FOUND 302, http_302_found
|
||||
#define HTTP_303_SEE_OTHER 303, http_303_see_other
|
||||
#define HTTP_304_NOT_MODIFIED 304, http_304_not_modified
|
||||
#define HTTP_305_USE_PROXY 305, http_305_use_proxy
|
||||
#define HTTP_307_TEMPORARY_REDIRECT 307, http_307_temporary_redirect
|
||||
#define HTTP_400_BAD_REQUEST 400, http_400_bad_request
|
||||
#define HTTP_401_UNAUTHORIZED 401, http_401_unauthorized
|
||||
#define HTTP_402_PAYMENT_REQUIRED 402, http_402_payment_required
|
||||
#define HTTP_403_FORBIDDEN 403, http_403_forbidden
|
||||
#define HTTP_404_NOT_FOUND 404, http_404_not_found
|
||||
#define HTTP_405_NOT_ALLOWED 405, http_405_not_allowed
|
||||
#define HTTP_406_NOT_ACCEPTABLE 406, http_406_not_acceptable
|
||||
#define HTTP_407_PROXY_AUTH 407, http_407_proxy_auth
|
||||
#define HTTP_408_TIMEOUT 408, http_408_timeout
|
||||
#define HTTP_409_CONFLICT 409, http_409_conflict
|
||||
#define HTTP_410_GONE 410, http_410_gone
|
||||
#define HTTP_411_NO_LENGTH 411, http_411_no_length
|
||||
#define HTTP_412_PRECONDITION 412, http_412_precondition
|
||||
#define HTTP_413_ENTITY_TOO_LARGE 413, http_413_entity_too_large
|
||||
#define HTTP_414_URI_TOO_LONG 414, http_414_uri_too_long
|
||||
#define HTTP_415_MEDIA_TYPE 415, http_415_media_type
|
||||
#define HTTP_416_REQUESTED_RANGE 416, http_416_requested_range
|
||||
#define HTTP_417_EXPECTATION 417, http_417_expectation
|
||||
#define HTTP_426_UPGRADE 426, http_426_upgrade
|
||||
#define HTTP_500_INTERNAL_SERVER 500, http_500_internal_server
|
||||
#define HTTP_501_NOT_IMPLEMENTED 501, http_501_not_implemented
|
||||
#define HTTP_502_BAD_GATEWAY 502, http_502_bad_gateway
|
||||
#define HTTP_503_NO_SERVICE 503, http_503_no_service
|
||||
#define HTTP_504_GATEWAY_TIMEOUT 504, http_504_gateway_timeout
|
||||
#define HTTP_505_HTTP_VERSION 505, http_505_http_version
|
||||
|
||||
SOFIAPUBVAR char const http_100_continue[];
|
||||
SOFIAPUBVAR char const http_101_switching[];
|
||||
SOFIAPUBVAR char const http_200_ok[];
|
||||
SOFIAPUBVAR char const http_201_created[];
|
||||
SOFIAPUBVAR char const http_202_accepted[];
|
||||
SOFIAPUBVAR char const http_203_non_auth_info[];
|
||||
SOFIAPUBVAR char const http_204_no_content[];
|
||||
SOFIAPUBVAR char const http_205_reset_content[];
|
||||
SOFIAPUBVAR char const http_206_partial_content[];
|
||||
SOFIAPUBVAR char const http_300_multiple_choices[];
|
||||
SOFIAPUBVAR char const http_301_moved_permanently[];
|
||||
SOFIAPUBVAR char const http_302_found[];
|
||||
SOFIAPUBVAR char const http_303_see_other[];
|
||||
SOFIAPUBVAR char const http_304_not_modified[];
|
||||
SOFIAPUBVAR char const http_305_use_proxy[];
|
||||
SOFIAPUBVAR char const http_307_temporary_redirect[];
|
||||
SOFIAPUBVAR char const http_400_bad_request[];
|
||||
SOFIAPUBVAR char const http_401_unauthorized[];
|
||||
SOFIAPUBVAR char const http_402_payment_required[];
|
||||
SOFIAPUBVAR char const http_403_forbidden[];
|
||||
SOFIAPUBVAR char const http_404_not_found[];
|
||||
SOFIAPUBVAR char const http_405_not_allowed[];
|
||||
SOFIAPUBVAR char const http_406_not_acceptable[];
|
||||
SOFIAPUBVAR char const http_407_proxy_auth[];
|
||||
SOFIAPUBVAR char const http_408_timeout[];
|
||||
SOFIAPUBVAR char const http_409_conflict[];
|
||||
SOFIAPUBVAR char const http_410_gone[];
|
||||
SOFIAPUBVAR char const http_411_no_length[];
|
||||
SOFIAPUBVAR char const http_412_precondition[];
|
||||
SOFIAPUBVAR char const http_413_entity_too_large[];
|
||||
SOFIAPUBVAR char const http_414_uri_too_long[];
|
||||
SOFIAPUBVAR char const http_415_media_type[];
|
||||
SOFIAPUBVAR char const http_416_requested_range[];
|
||||
SOFIAPUBVAR char const http_417_expectation[];
|
||||
SOFIAPUBVAR char const http_426_upgrade[];
|
||||
SOFIAPUBVAR char const http_500_internal_server[];
|
||||
SOFIAPUBVAR char const http_501_not_implemented[];
|
||||
SOFIAPUBVAR char const http_502_bad_gateway[];
|
||||
SOFIAPUBVAR char const http_503_no_service[];
|
||||
SOFIAPUBVAR char const http_504_gateway_timeout[];
|
||||
SOFIAPUBVAR char const http_505_http_version[];
|
||||
|
||||
SOFIA_END_DECLS
|
||||
|
||||
#endif /* HTTP_STATUS_H */
|
||||
@@ -0,0 +1,236 @@
|
||||
/**@file sofia-sip/http_tag.h.in
|
||||
*
|
||||
* Template for <http_tag.h>.
|
||||
*
|
||||
* @date Created: Wed Feb 21 11:01:45 2001 ppessi
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file is part of the Sofia-SIP package
|
||||
*
|
||||
* Copyright (C) 2005 Nokia Corporation.
|
||||
*
|
||||
* Contact: Pekka Pessi <pekka.pessi@nokia.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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 this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef HTTP_TAG_H
|
||||
/** Defined when <sofia-sip/http_tag.h> has been included. */
|
||||
#define HTTP_TAG_H
|
||||
|
||||
/**@file sofia-sip/http_tag.h
|
||||
* @brief Tag class for HTTP headers
|
||||
*
|
||||
* #AUTO#
|
||||
*
|
||||
* @author Pekka Pessi <Pekka.Pessi@nokia.com>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SU_TAG_H
|
||||
#include <sofia-sip/su_tag.h>
|
||||
#endif
|
||||
#ifndef SU_TAG_CLASS_H
|
||||
#include <sofia-sip/su_tag_class.h>
|
||||
#endif
|
||||
#ifndef SU_TAG_CLASS_H
|
||||
#include <sofia-sip/su_tag_class.h>
|
||||
#endif
|
||||
|
||||
#ifndef HTTP_H
|
||||
#include <sofia-sip/http.h>
|
||||
#endif
|
||||
|
||||
SOFIA_BEGIN_DECLS
|
||||
|
||||
#define HTTPTAG(c, x) httptag_##c, httptag_##c##_v(x)
|
||||
#define HTTPTAG_REF(c, x) httptag_##c##_ref, httptag_##c##_vr(&(x))
|
||||
#define HTTPTAG_STR(c, s) httptag_##c##_str, tag_str_v(s)
|
||||
#define HTTPTAG_STR_REF(c, s) httptag_##c##_str_ref, tag_str_vr(&(s))
|
||||
|
||||
/** Test if tag type marks a http_t structure. @HIDE */
|
||||
#define HTTPTAG_P(tt) ((tt)->tt_class == httphdrtag_class)
|
||||
/** Test if tag type marks a HTTP header string. @HIDE */
|
||||
#define HTTPTAG_STR_P(tt) ((tt)->tt_class == httpstrtag_class)
|
||||
/** Test if tag type marks a HTTP header structure. @HIDE */
|
||||
#define HTTPTAG_HTTP_P(tt) ((tt)->tt_class == httpmsgtag_class)
|
||||
|
||||
/** Test if tag item contains http_t structure. @HIDE */
|
||||
#define HTTPTAGI_P(t) (HTTPTAG_P((t)->t_tag))
|
||||
/** Test if tag item contains a HTTP header string. @HIDE */
|
||||
#define HTTPTAGI_STR_P(t) (HTTPTAG_STR_P((t)->t_tag))
|
||||
/** Test if tag item contains a HTTP header structure. @HIDE */
|
||||
#define HTTPTAGI_HTTP_P(t) (HTTPTAG_HTTP_P((t)->t_tag))
|
||||
|
||||
SOFIAPUBVAR tag_class_t httphdrtag_class[1];
|
||||
SOFIAPUBVAR tag_class_t httpstrtag_class[1];
|
||||
SOFIAPUBVAR tag_class_t httpmsgtag_class[1];
|
||||
|
||||
/** Filter tag matching any http tag. */
|
||||
#define HTTPTAG_ANY() httptag_any, ((tag_value_t)0)
|
||||
SOFIAPUBVAR tag_typedef_t httptag_any;
|
||||
|
||||
/**Tag list item for @c http_t object.
|
||||
*
|
||||
* The HTTPTAG_HTTP() macro is used to include a tag item for a http_t object
|
||||
* in the tag list.
|
||||
*
|
||||
* @param x pointer to a http_t message object, or NULL.
|
||||
*
|
||||
* @HIDE
|
||||
*/
|
||||
#define HTTPTAG_HTTP(x) httptag_http, httptag_http_v((x))
|
||||
|
||||
/** Tag for @c http_t */
|
||||
SOFIAPUBVAR tag_typedef_t httptag_http;
|
||||
|
||||
#define HTTPTAG_HTTP_REF(x) httptag_http_ref, httptag_http_vr(&(x))
|
||||
SOFIAPUBVAR tag_typedef_t httptag_http_ref;
|
||||
|
||||
#if SU_HAVE_INLINE
|
||||
static inline
|
||||
tag_value_t httptag_http_v(http_t const *v) { return (tag_value_t)v; }
|
||||
static inline
|
||||
tag_value_t httptag_http_vr(http_t const **vp) { return (tag_value_t)vp; }
|
||||
#else
|
||||
#define httptag_http_v(v) (tag_value_t)(v)
|
||||
#define httptag_http_vr(vp) (tag_value_t)(vp)
|
||||
#endif
|
||||
|
||||
/**Tag list item for http protocol version.
|
||||
*
|
||||
* The HTTPTAG_VERSION() macro is used to include a tag item for a HTTP
|
||||
* protocol version in the tag list.
|
||||
*
|
||||
* @param x pointer to a http_t message object, or NULL.
|
||||
*/
|
||||
#define HTTPTAG_VERSION(x) httptag_http, (tag_value_t)x
|
||||
|
||||
extern tag_typedef_t httptag_version;
|
||||
|
||||
/** Reference to HTTPTAG_VERSION */
|
||||
#define HTTPTAG_VERSION_REF(x) httptag_http_ref, (tag_value_t)&(x)
|
||||
|
||||
extern tag_typedef_t httptag_version_ref;
|
||||
|
||||
/**Tag list item for header string.
|
||||
*
|
||||
* The HTTPTAG_HEADER() macro is used to include a tag item containing an
|
||||
* unknown HTTP header in the tag list, e.g.,
|
||||
* @code
|
||||
* http_header_t *hdr;
|
||||
*
|
||||
* HTTPTAG_HEADER(hdr).
|
||||
* @endcode
|
||||
*
|
||||
* @param x pointer to a header structure, or NULL.
|
||||
*
|
||||
* @HIDE
|
||||
*/
|
||||
#define HTTPTAG_HEADER(x) httptag_header, httptag_header_v((x))
|
||||
|
||||
/** Tag for header string */
|
||||
SOFIAPUBVAR tag_typedef_t httptag_header;
|
||||
|
||||
#define HTTPTAG_HEADER_REF(x) httptag_header_ref, httptag_header_vr(&(x))
|
||||
SOFIAPUBVAR tag_typedef_t httptag_header_ref;
|
||||
|
||||
#if SU_HAVE_INLINE
|
||||
static inline tag_value_t
|
||||
httptag_header_v(http_header_t const *v)
|
||||
{ return (tag_value_t)v; }
|
||||
static inline tag_value_t
|
||||
httptag_header_vr(http_header_t const **vp)
|
||||
{ return (tag_value_t)vp; }
|
||||
#else
|
||||
#define httptag_header_v(v) (tag_value_t)(v)
|
||||
#define httptag_header_vr(vp) (tag_value_t)(vp)
|
||||
#endif
|
||||
|
||||
/**Tag list item for header string.
|
||||
*
|
||||
* The HTTPTAG_HEADER_STR() macro is used to include a tag item containing a
|
||||
* header string in the tag list.
|
||||
*
|
||||
* @param x pointer to a string, or NULL.
|
||||
*
|
||||
* @HIDE
|
||||
*/
|
||||
#define HTTPTAG_HEADER_STR(x) httptag_header_str, tag_str_v((x))
|
||||
|
||||
/** Tag for header string */
|
||||
SOFIAPUBVAR tag_typedef_t httptag_header_str;
|
||||
|
||||
#define HTTPTAG_HEADER_STR_REF(x) httptag_header_str_ref, tag_str_vr(&(x))
|
||||
SOFIAPUBVAR tag_typedef_t httptag_header_str_ref;
|
||||
|
||||
|
||||
/**@ingroup http_#xxxxxx#
|
||||
*
|
||||
* Tag list item for pointer to a #xxxxxxx_xxxxxxx# object.
|
||||
*
|
||||
* The HTTPTAG_#XXXXXX#() macro is used to include a tag item with a
|
||||
* pointer to a http_#xxxxxx#_t object in a tag list.
|
||||
*
|
||||
* @param x pointer to a http_#xxxxxx#_t header structure, or NULL.
|
||||
*
|
||||
* @HIDE
|
||||
*/
|
||||
#define HTTPTAG_#XXXXXX#(x) HTTPTAG(#xxxxxx#, x)
|
||||
|
||||
SOFIAPUBVAR tag_typedef_t httptag_#xxxxxx#;
|
||||
|
||||
/**@ingroup http_#xxxxxx#
|
||||
*
|
||||
* Tag list item for string with #xxxxxxx_xxxxxxx# value.
|
||||
*
|
||||
* The HTTPTAG_#XXXXXX#_STR() macro is used to include a tag item with a
|
||||
* string containing value of a http_#xxxxxx#_t header in a tag list.
|
||||
*
|
||||
* @param s pointer to a string containing http_#xxxxxx#_t value, or NULL.
|
||||
*
|
||||
* The HTTPTAG_#XXXXXX#_STR string can be converted to a
|
||||
* http_#xxxxxx#_t header structure by giving the string @a s has
|
||||
* second argument to function http_#xxxxxx#_make().
|
||||
*
|
||||
* @HIDE
|
||||
*/
|
||||
#define HTTPTAG_#XXXXXX#_STR(s) HTTPTAG_STR(#xxxxxx#, s)
|
||||
|
||||
SOFIAPUBVAR tag_typedef_t httptag_#xxxxxx#_str;
|
||||
|
||||
#define HTTPTAG_#XXXXXX#_REF(x) HTTPTAG_REF(#xxxxxx#, x)
|
||||
SOFIAPUBVAR tag_typedef_t httptag_#xxxxxx#_ref;
|
||||
|
||||
#define HTTPTAG_#XXXXXX#_STR_REF(x) HTTPTAG_STR_REF(#xxxxxx#, x)
|
||||
SOFIAPUBVAR tag_typedef_t httptag_#xxxxxx#_str_ref;
|
||||
|
||||
#if SU_HAVE_INLINE
|
||||
static inline tag_value_t
|
||||
httptag_#xxxxxx#_v(http_#xxxxxx#_t const *v)
|
||||
{ return (tag_value_t)v; }
|
||||
static inline tag_value_t
|
||||
httptag_#xxxxxx#_vr(http_#xxxxxx#_t const **vp)
|
||||
{ return (tag_value_t)vp; }
|
||||
#else
|
||||
#define httptag_#xxxxxx#_v(v) (tag_value_t)(v)
|
||||
#define httptag_#xxxxxx#_vr(vp) (tag_value_t)(vp)
|
||||
#endif
|
||||
|
||||
SOFIA_END_DECLS
|
||||
#endif /* !defined(HTTP_TAG_H) */
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* This file is part of the Sofia-SIP package
|
||||
*
|
||||
* Copyright (C) 2005 Nokia Corporation.
|
||||
*
|
||||
* Contact: Pekka Pessi <pekka.pessi@nokia.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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 this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef HTTP_TAG_CLASS_H
|
||||
/**Defined when http_tag_class.h have been included*/
|
||||
#define HTTP_TAG_CLASS_H
|
||||
|
||||
/**@file sofia-sip/http_tag_class.h
|
||||
* @brief Tag classes for HTTP headers.
|
||||
*
|
||||
* @author Pekka Pessi <Pekka.Pessi@nokia.com>
|
||||
*
|
||||
* @date Created: Wed Feb 21 11:01:45 2001 ppessi
|
||||
*/
|
||||
|
||||
#ifndef SU_TAG_CLASS_H
|
||||
#include <sofia-sip/su_tag_class.h>
|
||||
#endif
|
||||
|
||||
#ifndef MSG_TAG_CLASS_H
|
||||
#include <sofia-sip/msg_tag_class.h>
|
||||
#endif
|
||||
|
||||
SOFIA_BEGIN_DECLS
|
||||
|
||||
/** Define a named tag type for HTTP header @a t. */
|
||||
#define HTTPHDRTAG_NAMED_TYPEDEF(n, t) \
|
||||
{{ TAG_NAMESPACE, #n, httphdrtag_class, \
|
||||
(tag_value_t)http_##t##_class }}
|
||||
|
||||
/** Define a tag type for HTTP header @a t. */
|
||||
#define HTTPHDRTAG_TYPEDEF(t) HTTPHDRTAG_NAMED_TYPEDEF(t, t)
|
||||
|
||||
/** Define a string tag type for HTTP header @a t. */
|
||||
#define HTTPSTRTAG_TYPEDEF(t) \
|
||||
{{ TAG_NAMESPACE, #t "_str", httpstrtag_class, \
|
||||
(tag_value_t)http_##t##_class }}
|
||||
|
||||
/** Define a tag type for HTTP message @a t. */
|
||||
#define HTTPMSGTAG_TYPEDEF(t) \
|
||||
{{ TAG_NAMESPACE, #t, httpmsgtag_class, \
|
||||
(tag_value_t)HTTP_PROTOCOL_TAG }}
|
||||
|
||||
/**@internal Filter HTTP header tag items. */
|
||||
SOFIAPUBFUN tagi_t *httptag_filter(tagi_t *dst, tagi_t const f[],
|
||||
tagi_t const *src,
|
||||
void **bb);
|
||||
|
||||
SOFIA_END_DECLS
|
||||
|
||||
#endif /* !defined(HTTP_TAG_CLASS_H) */
|
||||
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user