Commit 6aad349
committed
Added error callback infrastructure.
This adds three levels and four kinds of callbacks for reporting errors
from Serf: global, context-specific and (incoming or outgoing) connection
-specific. Request and response code will use their their connection's
callback, but add extra flags to indicate the source of the error message.
The SSL code in ssl_buckets.c uses an error context that callers can (or
rather "will be able to") define so that error messages get sent to
the appropriate, caller-specific callback. This part is not yet implemented
because it requires revising some of our SSL APIs.
* CMakeLists.txt: Check if <unistd.h> is available, used by tests.
(SOURCES): Add the error_callbacks.c file.
* SConstruct: Check for <unistd.h>, as above.
* serf.h: Add public error callback prototypes and constants.
Too many of them to list here individually.
* serf_bucket_types.h
(serf_ssl_error_cb_set, serf_ssl_error_cb_t): Removed, obsolete.
* serf_private.h: Add private helpers for sending error messages to
callbacks and the ssl_context infrastructure for handling errors.
(serf_context_t): Add error_callback and error_callback_baton.
(serf_incoming_t): Likewise.
(serf_connection_t): Here, too.
* buckets/ssl_buckets.c:
Update all calls to the removed ssl-specific error callback to use
the new dispatch_ssl_error.
(serf_ssl_context_t) Remove error_callback and error_baton.
(global_error_ctx): New fallback error context, sends to global callback.
(dispatch_ssl_error): New, calls an error context's dispatcher.
(log_ssl_error): Use dispatch_ssl_error().
* src/error_callbacks.c: New file. Implements all the private helpers
declared in serf_private.h, and also:
(serf_global_error_callback_set): Implement here.
* src/context.c
(serf_context_error_callback_set): Implement here.
* src/incoming.c
(serf_incoming_error_callback_set): Implement here.
* src/outgoing.c
(serf_connection_error_callback_set): Implement here.
* test/test_util.c
(isatty): Import from headers if available, otherwise fake it.
(test_error_callback): New, an error callback for the test suite.
(setup_test_context): Register test_error_callback in verbose mode.
git-svn-id: https://svn.apache.org/repos/asf/serf/trunk@1931047 13f79535-47bb-0310-9956-ffa450edef681 parent 257f68b commit 6aad349
File tree
11 files changed
+578
-115
lines changed- buckets
- src
- test
11 files changed
+578
-115
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
| 140 | + | |
140 | 141 | | |
141 | 142 | | |
142 | 143 | | |
| |||
393 | 394 | | |
394 | 395 | | |
395 | 396 | | |
| 397 | + | |
396 | 398 | | |
397 | 399 | | |
398 | 400 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
727 | 727 | | |
728 | 728 | | |
729 | 729 | | |
| 730 | + | |
| 731 | + | |
730 | 732 | | |
731 | 733 | | |
732 | 734 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
206 | 206 | | |
207 | 207 | | |
208 | 208 | | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | 209 | | |
214 | 210 | | |
215 | 211 | | |
| |||
229 | 225 | | |
230 | 226 | | |
231 | 227 | | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
232 | 253 | | |
233 | 254 | | |
234 | 255 | | |
| |||
355 | 376 | | |
356 | 377 | | |
357 | 378 | | |
358 | | - | |
359 | | - | |
360 | | - | |
361 | | - | |
362 | | - | |
363 | | - | |
364 | | - | |
365 | | - | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | | - | |
370 | | - | |
371 | | - | |
372 | | - | |
373 | 379 | | |
374 | 380 | | |
375 | 381 | | |
| |||
1096 | 1102 | | |
1097 | 1103 | | |
1098 | 1104 | | |
1099 | | - | |
| 1105 | + | |
1100 | 1106 | | |
1101 | 1107 | | |
1102 | 1108 | | |
| |||
1110 | 1116 | | |
1111 | 1117 | | |
1112 | 1118 | | |
1113 | | - | |
| 1119 | + | |
1114 | 1120 | | |
1115 | 1121 | | |
1116 | 1122 | | |
| |||
1217 | 1223 | | |
1218 | 1224 | | |
1219 | 1225 | | |
1220 | | - | |
| 1226 | + | |
1221 | 1227 | | |
1222 | 1228 | | |
1223 | 1229 | | |
| |||
1675 | 1681 | | |
1676 | 1682 | | |
1677 | 1683 | | |
| 1684 | + | |
| 1685 | + | |
| 1686 | + | |
| 1687 | + | |
1678 | 1688 | | |
1679 | | - | |
1680 | | - | |
1681 | | - | |
1682 | | - | |
1683 | | - | |
1684 | | - | |
1685 | | - | |
| 1689 | + | |
1686 | 1690 | | |
1687 | 1691 | | |
1688 | 1692 | | |
| |||
1697 | 1701 | | |
1698 | 1702 | | |
1699 | 1703 | | |
| 1704 | + | |
| 1705 | + | |
| 1706 | + | |
| 1707 | + | |
1700 | 1708 | | |
1701 | | - | |
1702 | | - | |
1703 | | - | |
1704 | | - | |
1705 | | - | |
1706 | | - | |
1707 | | - | |
| 1709 | + | |
1708 | 1710 | | |
1709 | 1711 | | |
1710 | 1712 | | |
| |||
1824 | 1826 | | |
1825 | 1827 | | |
1826 | 1828 | | |
1827 | | - | |
1828 | | - | |
| 1829 | + | |
1829 | 1830 | | |
1830 | 1831 | | |
1831 | 1832 | | |
| |||
1888 | 1889 | | |
1889 | 1890 | | |
1890 | 1891 | | |
1891 | | - | |
1892 | | - | |
1893 | | - | |
1894 | | - | |
1895 | | - | |
1896 | | - | |
1897 | | - | |
| 1892 | + | |
| 1893 | + | |
| 1894 | + | |
| 1895 | + | |
| 1896 | + | |
| 1897 | + | |
| 1898 | + | |
1898 | 1899 | | |
1899 | 1900 | | |
1900 | 1901 | | |
| |||
1926 | 1927 | | |
1927 | 1928 | | |
1928 | 1929 | | |
| 1930 | + | |
1929 | 1931 | | |
1930 | 1932 | | |
1931 | 1933 | | |
1932 | | - | |
| 1934 | + | |
| 1935 | + | |
1933 | 1936 | | |
1934 | 1937 | | |
1935 | 1938 | | |
| |||
1973 | 1976 | | |
1974 | 1977 | | |
1975 | 1978 | | |
| 1979 | + | |
| 1980 | + | |
| 1981 | + | |
1976 | 1982 | | |
1977 | | - | |
1978 | | - | |
1979 | | - | |
1980 | | - | |
1981 | | - | |
1982 | | - | |
1983 | | - | |
1984 | | - | |
| 1983 | + | |
1985 | 1984 | | |
1986 | 1985 | | |
1987 | 1986 | | |
1988 | 1987 | | |
1989 | 1988 | | |
1990 | 1989 | | |
1991 | 1990 | | |
1992 | | - | |
1993 | | - | |
1994 | | - | |
1995 | | - | |
1996 | | - | |
1997 | | - | |
| 1991 | + | |
| 1992 | + | |
| 1993 | + | |
1998 | 1994 | | |
1999 | | - | |
| 1995 | + | |
2000 | 1996 | | |
2001 | 1997 | | |
2002 | 1998 | | |
2003 | 1999 | | |
2004 | 2000 | | |
2005 | 2001 | | |
2006 | | - | |
2007 | | - | |
2008 | | - | |
2009 | | - | |
2010 | | - | |
2011 | | - | |
| 2002 | + | |
| 2003 | + | |
2012 | 2004 | | |
2013 | | - | |
| 2005 | + | |
2014 | 2006 | | |
2015 | 2007 | | |
2016 | 2008 | | |
| |||
2088 | 2080 | | |
2089 | 2081 | | |
2090 | 2082 | | |
2091 | | - | |
2092 | | - | |
2093 | | - | |
2094 | | - | |
2095 | | - | |
2096 | | - | |
2097 | | - | |
2098 | | - | |
2099 | | - | |
2100 | 2083 | | |
2101 | 2084 | | |
2102 | 2085 | | |
| |||
2162 | 2145 | | |
2163 | 2146 | | |
2164 | 2147 | | |
2165 | | - | |
2166 | | - | |
2167 | | - | |
2168 | 2148 | | |
2169 | 2149 | | |
2170 | 2150 | | |
| |||
2410 | 2390 | | |
2411 | 2391 | | |
2412 | 2392 | | |
2413 | | - | |
2414 | | - | |
2415 | | - | |
2416 | | - | |
2417 | | - | |
2418 | | - | |
2419 | 2393 | | |
2420 | | - | |
| 2394 | + | |
| 2395 | + | |
| 2396 | + | |
2421 | 2397 | | |
2422 | 2398 | | |
2423 | 2399 | | |
| |||
2479 | 2455 | | |
2480 | 2456 | | |
2481 | 2457 | | |
2482 | | - | |
| 2458 | + | |
2483 | 2459 | | |
2484 | 2460 | | |
2485 | 2461 | | |
| |||
0 commit comments