-rw-r--r-- | configure.ac | 5 | ||||
-rw-r--r-- | include/opkele/tidy.h | 11 | ||||
-rw-r--r-- | lib/discovery.cc | 3 |
3 files changed, 14 insertions, 5 deletions
diff --git a/configure.ac b/configure.ac index 0aa1272..a66e53d 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -120,75 +120,76 @@ fi | |||
120 | WANT_DOXYGEN="yes" | 120 | WANT_DOXYGEN="yes" |
121 | AC_ARG_ENABLE([doxygen], | 121 | AC_ARG_ENABLE([doxygen], |
122 | AC_HELP_STRING([--disable-doxygen],[do not generate documentation]), | 122 | AC_HELP_STRING([--disable-doxygen],[do not generate documentation]), |
123 | [ | 123 | [ |
124 | test "${enableval}" = "no" && WANT_DOXYGEN="no" | 124 | test "${enableval}" = "no" && WANT_DOXYGEN="no" |
125 | ] | 125 | ] |
126 | ) | 126 | ) |
127 | if test "${WANT_DOXYGEN}" = "yes" ; then | 127 | if test "${WANT_DOXYGEN}" = "yes" ; then |
128 | AC_WITH_DOXYGEN | 128 | AC_WITH_DOXYGEN |
129 | AC_WITH_DOT | 129 | AC_WITH_DOT |
130 | else | 130 | else |
131 | AM_CONDITIONAL([HAVE_DOXYGEN],[false]) | 131 | AM_CONDITIONAL([HAVE_DOXYGEN],[false]) |
132 | AM_CONDITIONAL([HAVE_DOT],[false]) | 132 | AM_CONDITIONAL([HAVE_DOT],[false]) |
133 | fi | 133 | fi |
134 | 134 | ||
135 | LIBCURL_CHECK_CONFIG(,,,[ | 135 | LIBCURL_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 | ||
139 | AC_CHECK_HEADER([expat.h],[ | 139 | AC_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 | ||
152 | AC_CHECK_HEADER([tidy.h],[ | 152 | AC_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 | ||
165 | if test -n "$PCRE_LIBS" -a -n "$PCRE_CFLAGS" ; then | 166 | if 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 | : |
169 | else | 170 | else |
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 | ]) |
173 | fi | 174 | fi |
174 | 175 | ||
175 | PKG_CHECK_MODULES([SQLITE3],[sqlite3],[have_sqlite3=true],[have_sqlite3=false]) | 176 | PKG_CHECK_MODULES([SQLITE3],[sqlite3],[have_sqlite3=true],[have_sqlite3=false]) |
176 | AM_CONDITIONAL([HAVE_SQLITE3],[$have_sqlite3]) | 177 | AM_CONDITIONAL([HAVE_SQLITE3],[$have_sqlite3]) |
177 | PKG_CHECK_MODULES([KINGATE],[kingate-plaincgi],[have_kingate=true],[have_kingate=false]) | 178 | PKG_CHECK_MODULES([KINGATE],[kingate-plaincgi],[have_kingate=true],[have_kingate=false]) |
178 | AM_CONDITIONAL([HAVE_KINGATE],[$have_kingate]) | 179 | AM_CONDITIONAL([HAVE_KINGATE],[$have_kingate]) |
179 | PKG_CHECK_MODULES([UUID],[uuid],[have_uuid=true],[have_uuid=false]) | 180 | PKG_CHECK_MODULES([UUID],[uuid],[have_uuid=true],[have_uuid=false]) |
180 | AM_CONDITIONAL([HAVE_UUID],[$have_uuid]) | 181 | AM_CONDITIONAL([HAVE_UUID],[$have_uuid]) |
181 | if $have_uuid ; then | 182 | if $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]) |
184 | fi | 185 | fi |
185 | 186 | ||
186 | curl_ssl_verify_host="true" | 187 | curl_ssl_verify_host="true" |
187 | AC_ARG_ENABLE([ssl-verify-host], | 188 | AC_ARG_ENABLE([ssl-verify-host], |
188 | AC_HELP_STRING([--disable-ssl-verify-host],[disable cURL cert/host relationships verification]), | 189 | AC_HELP_STRING([--disable-ssl-verify-host],[disable cURL cert/host relationships verification]), |
189 | [ test "${enableval}" = "no" && curl_ssl_verify_host="false" ] | 190 | [ test "${enableval}" = "no" && curl_ssl_verify_host="false" ] |
190 | ) | 191 | ) |
191 | ${curl_ssl_verify_host} || AC_DEFINE([DISABLE_CURL_SSL_VERIFYHOST],,[defined if cURL is not to verify cert/host]) | 192 | ${curl_ssl_verify_host} || AC_DEFINE([DISABLE_CURL_SSL_VERIFYHOST],,[defined if cURL is not to verify cert/host]) |
192 | 193 | ||
193 | curl_ssl_verify_peer="true" | 194 | curl_ssl_verify_peer="true" |
194 | AC_ARG_ENABLE([ssl-verify-peer], | 195 | AC_ARG_ENABLE([ssl-verify-peer], |
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,38 +1,45 @@ | |||
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 | #include <tidy.h> | 5 | #ifdef HAVE_TIDY_H |
6 | #include <buffio.h> | 6 | # include <tidy.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 | ||
8 | namespace opkele { | 15 | namespace 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 | ||
31 | class tidy_doc_t { | 38 | class tidy_doc_t { |
32 | public: | 39 | public: |
33 | TidyDoc _x; | 40 | TidyDoc _x; |
34 | 41 | ||
35 | tidy_doc_t() : _x(0) { } | 42 | tidy_doc_t() : _x(0) { } |
36 | tidy_doc_t(TidyDoc x) : _x(x) { } | 43 | tidy_doc_t(TidyDoc x) : _x(x) { } |
37 | virtual ~tidy_doc_t() throw() { | 44 | virtual ~tidy_doc_t() throw() { |
38 | if(_x) tidyRelease(_x); } | 45 | if(_x) tidyRelease(_x); } |
diff --git a/lib/discovery.cc b/lib/discovery.cc index 3b90977..d1989ec 100644 --- a/lib/discovery.cc +++ b/lib/discovery.cc | |||
@@ -1,45 +1,46 @@ | |||
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 | ||
17 | namespace opkele { | 18 | namespace 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 |
38 | }; | 39 | }; |
39 | 40 | ||
40 | 41 | ||
41 | static inline bool is_qelement(const XML_Char *n,const char *qen) { | 42 | static inline bool is_qelement(const XML_Char *n,const char *qen) { |
42 | return !strcasecmp(n,qen); | 43 | return !strcasecmp(n,qen); |
43 | } | 44 | } |
44 | static inline bool is_element(const XML_Char *n,const char *en) { | 45 | static inline bool is_element(const XML_Char *n,const char *en) { |
45 | if(!strcasecmp(n,en)) return true; | 46 | if(!strcasecmp(n,en)) return true; |