summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--configure.ac5
-rw-r--r--include/opkele/tidy.h7
-rw-r--r--lib/discovery.cc3
3 files changed, 12 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac
index 0aa1272..a66e53d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -128,59 +128,60 @@ if test "${WANT_DOXYGEN}" = "yes" ; then
128 AC_WITH_DOXYGEN 128 AC_WITH_DOXYGEN
129 AC_WITH_DOT 129 AC_WITH_DOT
130else 130else
131 AM_CONDITIONAL([HAVE_DOXYGEN],[false]) 131 AM_CONDITIONAL([HAVE_DOXYGEN],[false])
132 AM_CONDITIONAL([HAVE_DOT],[false]) 132 AM_CONDITIONAL([HAVE_DOT],[false])
133fi 133fi
134 134
135LIBCURL_CHECK_CONFIG(,,,[ 135LIBCURL_CHECK_CONFIG(,,,[
136 AC_MSG_ERROR([no required libcurl library. get one from http://curl.haxx.se/]) 136 AC_MSG_ERROR([no required libcurl library. get one from http://curl.haxx.se/])
137]) 137])
138 138
139AC_CHECK_HEADER([expat.h],[ 139AC_CHECK_HEADER([expat.h],[
140 AC_CHECK_LIB([expat],[XML_ParserCreate],[ 140 AC_CHECK_LIB([expat],[XML_ParserCreate],[
141 EXPAT_LIBS=-lexpat 141 EXPAT_LIBS=-lexpat
142 EXPAT_CFLAGS= 142 EXPAT_CFLAGS=
143 AC_SUBST([EXPAT_LIBS]) 143 AC_SUBST([EXPAT_LIBS])
144 AC_SUBST([EXPAT_CFLAGS]) 144 AC_SUBST([EXPAT_CFLAGS])
145 ],[ 145 ],[
146 AC_MSG_ERROR([no required expat library. get one from http://expat.sourceforge.net/]) 146 AC_MSG_ERROR([no required expat library. get one from http://expat.sourceforge.net/])
147 ]) 147 ])
148],[ 148],[
149 AC_MSG_ERROR([no required expat library. get one from http://expat.sourceforge.net/]) 149 AC_MSG_ERROR([no required expat library. get one from http://expat.sourceforge.net/])
150]) 150])
151 151
152AC_CHECK_HEADER([tidy.h],[ 152AC_CHECK_HEADERS([tidy.h tidy/tidy.h],[
153 AC_CHECK_LIB([tidy],[tidyParseBuffer],[ 153 AC_CHECK_LIB([tidy],[tidyParseBuffer],[
154 TIDY_LIBS=-ltidy 154 TIDY_LIBS=-ltidy
155 TIDY_CFLAGS= 155 TIDY_CFLAGS=
156 AC_SUBST([TIDY_LIBS]) 156 AC_SUBST([TIDY_LIBS])
157 AC_SUBST([TIDY_CFLAGS]) 157 AC_SUBST([TIDY_CFLAGS])
158 ],[ 158 ],[
159 AC_MSG_ERROR([no required htmltidy library found. get one from http://tidy.sourceforge.net/]) 159 AC_MSG_ERROR([no required htmltidy library found. get one from http://tidy.sourceforge.net/])
160 ]) 160 ])
161],[ 161],[
162 AC_MSG_ERROR([no required htmltidy library found. get one from http://tidy.sourceforge.net/]) 162 test "$ac_header" = "tidy/tidy.h" \
163 && AC_MSG_ERROR([no required htmltidy library found. get one from http://tidy.sourceforge.net/])
163]) 164])
164 165
165if test -n "$PCRE_LIBS" -a -n "$PCRE_CFLAGS" ; then 166if test -n "$PCRE_LIBS" -a -n "$PCRE_CFLAGS" ; then
166 AC_SUBST([PCRE_CFLAGS]) 167 AC_SUBST([PCRE_CFLAGS])
167 AC_SUBST([PCRE_LIBS]) 168 AC_SUBST([PCRE_LIBS])
168 : 169 :
169else 170else
170 PKG_CHECK_MODULES([PCRE],[libpcre],,[ 171 PKG_CHECK_MODULES([PCRE],[libpcre],,[
171 AC_MSG_ERROR([no libpcre found, go get it at http://www.pcre.org/]) 172 AC_MSG_ERROR([no libpcre found, go get it at http://www.pcre.org/])
172 ]) 173 ])
173fi 174fi
174 175
175PKG_CHECK_MODULES([SQLITE3],[sqlite3],[have_sqlite3=true],[have_sqlite3=false]) 176PKG_CHECK_MODULES([SQLITE3],[sqlite3],[have_sqlite3=true],[have_sqlite3=false])
176AM_CONDITIONAL([HAVE_SQLITE3],[$have_sqlite3]) 177AM_CONDITIONAL([HAVE_SQLITE3],[$have_sqlite3])
177PKG_CHECK_MODULES([KINGATE],[kingate-plaincgi],[have_kingate=true],[have_kingate=false]) 178PKG_CHECK_MODULES([KINGATE],[kingate-plaincgi],[have_kingate=true],[have_kingate=false])
178AM_CONDITIONAL([HAVE_KINGATE],[$have_kingate]) 179AM_CONDITIONAL([HAVE_KINGATE],[$have_kingate])
179PKG_CHECK_MODULES([UUID],[uuid],[have_uuid=true],[have_uuid=false]) 180PKG_CHECK_MODULES([UUID],[uuid],[have_uuid=true],[have_uuid=false])
180AM_CONDITIONAL([HAVE_UUID],[$have_uuid]) 181AM_CONDITIONAL([HAVE_UUID],[$have_uuid])
181if $have_uuid ; then 182if $have_uuid ; then
182 AC_DEFINE([HAVE_LIBUUID],,[defined in presence of libuuid]) 183 AC_DEFINE([HAVE_LIBUUID],,[defined in presence of libuuid])
183 AC_SUBST([UUID_UUID],[uuid]) 184 AC_SUBST([UUID_UUID],[uuid])
184fi 185fi
185 186
186curl_ssl_verify_host="true" 187curl_ssl_verify_host="true"
diff --git a/include/opkele/tidy.h b/include/opkele/tidy.h
index 888e7d4..059656d 100644
--- a/include/opkele/tidy.h
+++ b/include/opkele/tidy.h
@@ -1,30 +1,37 @@
1#ifndef __OPKELE_TIDY_H 1#ifndef __OPKELE_TIDY_H
2#define __OPKELE_TIDY_H 2#define __OPKELE_TIDY_H
3 3
4#include <cassert> 4#include <cassert>
5#ifdef HAVE_TIDY_H
5#include <tidy.h> 6#include <tidy.h>
6#include <buffio.h> 7#include <buffio.h>
8#elif HAVE_TIDY_TIDY_H
9# include <tidy/tidy.h>
10# include <tidy/buffio.h>
11#else
12# error "Don't know where to look for htmltidy headers"
13#endif
7 14
8namespace opkele { 15namespace opkele {
9 namespace util { 16 namespace util {
10 17
11 class tidy_buf_t { 18 class tidy_buf_t {
12 public: 19 public:
13 TidyBuffer _x; 20 TidyBuffer _x;
14 21
15 tidy_buf_t() { tidyBufInit(&_x); } 22 tidy_buf_t() { tidyBufInit(&_x); }
16 virtual ~tidy_buf_t() throw() { 23 virtual ~tidy_buf_t() throw() {
17 tidyBufFree(&_x); } 24 tidyBufFree(&_x); }
18 25
19 inline operator const TidyBuffer&(void) const { return _x; } 26 inline operator const TidyBuffer&(void) const { return _x; }
20 inline operator TidyBuffer&(void) { return _x; } 27 inline operator TidyBuffer&(void) { return _x; }
21 28
22 inline operator const char*(void) const { return (const char*)_x.bp; } 29 inline operator const char*(void) const { return (const char*)_x.bp; }
23 inline operator char*(void) { return (char*)_x.bp; } 30 inline operator char*(void) { return (char*)_x.bp; }
24 31
25 inline const char *c_str() const { 32 inline const char *c_str() const {
26 return (const char*)_x.bp; } 33 return (const char*)_x.bp; }
27 inline size_t size() const { 34 inline size_t size() const {
28 return _x.size; } 35 return _x.size; }
29 }; 36 };
30 37
diff --git a/lib/discovery.cc b/lib/discovery.cc
index 3b90977..d1989ec 100644
--- a/lib/discovery.cc
+++ b/lib/discovery.cc
@@ -1,37 +1,38 @@
1#include <list> 1#include <list>
2#include <opkele/curl.h> 2#include <opkele/curl.h>
3#include <opkele/expat.h> 3#include <opkele/expat.h>
4#include <opkele/uris.h> 4#include <opkele/uris.h>
5#include <opkele/discovery.h> 5#include <opkele/discovery.h>
6#include <opkele/exception.h> 6#include <opkele/exception.h>
7#include <opkele/util.h> 7#include <opkele/util.h>
8#include <opkele/tidy.h>
9#include <opkele/data.h> 8#include <opkele/data.h>
10#include <opkele/debug.h> 9#include <opkele/debug.h>
11 10
12#include "config.h" 11#include "config.h"
13 12
13#include <opkele/tidy.h>
14
14#define XRDS_HEADER "X-XRDS-Location" 15#define XRDS_HEADER "X-XRDS-Location"
15#define CT_HEADER "Content-Type" 16#define CT_HEADER "Content-Type"
16 17
17namespace opkele { 18namespace opkele {
18 using std::list; 19 using std::list;
19 using xrd::XRD_t; 20 using xrd::XRD_t;
20 using xrd::service_t; 21 using xrd::service_t;
21 22
22 /* TODO: the whole discovery thing needs cleanup and optimization due to 23 /* TODO: the whole discovery thing needs cleanup and optimization due to
23 * many changes of concept. */ 24 * many changes of concept. */
24 25
25 static const size_t max_html = 16384; 26 static const size_t max_html = 16384;
26 27
27 static const struct service_type_t { 28 static const struct service_type_t {
28 const char *uri; 29 const char *uri;
29 const char *forceid; 30 const char *forceid;
30 } op_service_types[] = { 31 } op_service_types[] = {
31 { STURI_OPENID20_OP, IDURI_SELECT20 }, 32 { STURI_OPENID20_OP, IDURI_SELECT20 },
32 { STURI_OPENID20, 0 }, 33 { STURI_OPENID20, 0 },
33 { STURI_OPENID11, 0 }, 34 { STURI_OPENID11, 0 },
34 { STURI_OPENID10, 0 } 35 { STURI_OPENID10, 0 }
35 }; 36 };
36 enum { 37 enum {
37 st_index_1 = 2, st_index_2 = 1 38 st_index_1 = 2, st_index_2 = 1