summaryrefslogtreecommitdiffstats
path: root/varnish-upstream.patch
blob: 7330ae31f5017c904421d78897186279fd0e3ff8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
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
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
--- pecl/varnish/trunk/config.m4	2016/10/20 10:50:51	340568
+++ pecl/varnish/trunk/config.m4	2016/10/20 14:14:46	340569
@@ -22,7 +22,11 @@
 
       PHP_EVAL_INCLINE($VARNISH_INCLUDE)
       PHP_EVAL_LIBLINE($VARNISH_LIBRARY, VARNISH_SHARED_LIBADD)
-      if $PKG_CONFIG varnishapi --atleast-version=4 ; then
+      if $PKG_CONFIG varnishapi --atleast-version=5 ; then
+        AC_DEFINE(HAVE_VARNISHAPILIB,5,[ ])
+        AC_TYPE_UINTPTR_T
+        AC_TYPE_UINT64_T
+      elif $PKG_CONFIG varnishapi --atleast-version=4 ; then
         AC_DEFINE(HAVE_VARNISHAPILIB,4,[ ])
         AC_TYPE_UINTPTR_T
         AC_TYPE_UINT64_T
--- pecl/varnish/trunk/varnish_lib.h	2016/10/20 10:50:51	340568
+++ pecl/varnish/trunk/varnish_lib.h	2016/10/20 14:14:46	340569
@@ -36,6 +36,9 @@
 #endif
 
 #ifndef PHP_WIN32
+#if HAVE_VARNISHAPILIB >= 5
+#include <vapi/vsm.h>
+#endif
 #if HAVE_VARNISHAPILIB >= 4
 #include <vcli.h>
 #include <vapi/vsl.h>
--- pecl/varnish/trunk/varnish.c	2016/10/20 14:14:46	340569
+++ pecl/varnish/trunk/varnish.c	2016/10/20 14:19:33	340570
@@ -279,8 +279,11 @@
 {
 	php_info_print_table_start();
 	php_info_print_table_header(2, "varnish support", "enabled");
-	php_info_print_table_row(2, "Version", PHP_VARNISH_VERSION);
+	php_info_print_table_row(2, "Extension version", PHP_VARNISH_VERSION);
 	php_info_print_table_row(2, "Revision", "$Id: varnish.c 335937 2015-02-13 20:17:30Z ab $");
+#ifdef VMOD_ABI_Version
+	php_info_print_table_row(2, "Varnish version", VMOD_ABI_Version);
+#endif
 	php_info_print_table_end();
 
 	/* 
--- pecl/varnish/trunk/varnish_lib.h	2016/10/20 14:14:46	340569
+++ pecl/varnish/trunk/varnish_lib.h	2016/10/20 14:19:33	340570
@@ -41,6 +41,7 @@
 #endif
 #if HAVE_VARNISHAPILIB >= 4
 #include <vcli.h>
+#include <vmod_abi.h>
 #include <vapi/vsl.h>
 #include <vapi/vsc.h>
 #else
Index: config.m4
===================================================================
--- pecl/varnish/trunk/config.m4	(révision 340569)
+++ pecl/varnish/trunk/config.m4	(copie de travail)
@@ -23,16 +23,16 @@
       PHP_EVAL_INCLINE($VARNISH_INCLUDE)
       PHP_EVAL_LIBLINE($VARNISH_LIBRARY, VARNISH_SHARED_LIBADD)
       if $PKG_CONFIG varnishapi --atleast-version=5 ; then
-        AC_DEFINE(HAVE_VARNISHAPILIB,5,[ ])
-        AC_TYPE_UINTPTR_T
-        AC_TYPE_UINT64_T
+        AC_DEFINE(HAVE_VARNISHAPILIB,50,[ ])
+      elif $PKG_CONFIG varnishapi --atleast-version=4.1 ; then
+        AC_DEFINE(HAVE_VARNISHAPILIB,41,[ ])
       elif $PKG_CONFIG varnishapi --atleast-version=4 ; then
-        AC_DEFINE(HAVE_VARNISHAPILIB,4,[ ])
-        AC_TYPE_UINTPTR_T
-        AC_TYPE_UINT64_T
+        AC_DEFINE(HAVE_VARNISHAPILIB,40,[ ])
       else
-        AC_DEFINE(HAVE_VARNISHAPILIB,3,[ ])
+        AC_DEFINE(HAVE_VARNISHAPILIB,30,[ ])
       fi
+      AC_TYPE_UINTPTR_T
+      AC_TYPE_UINT64_T
     else
       AC_MSG_RESULT(version too old)
       AC_MSG_ERROR(Please reinstall varnish version >= 3.0)
@@ -46,11 +46,11 @@
       for j in $SEARCH_FOR ; do
         if test -r $i/include/varnish/$j; then
           VARNISH_INCDIR=$i/include/varnish
-          VARNISH_LIBDIR=$i/lib
+          VARNISH_LIBDIR=$i/$PHP_LIBDIR
           break
         elif test -r $i/include/$j; then
           VARNISH_INCDIR=$i/include
-          VARNISH_LIBDIR=$i/lib
+          VARNISH_LIBDIR=$i/$PHP_LIBDIR
           break
         fi
       done
@@ -75,19 +75,22 @@
 
       if test -f $VARNISH_INCDIR/varnishapi.h; then
         dnl this is 3.x or earlier
-        AC_DEFINE(HAVE_VARNISHAPILIB,1,[ ])
+        AC_DEFINE(HAVE_VARNISHAPILIB,30,[ ])
         AC_CHECK_HEADER([$VARNISH_INCDIR/varnishapi.h], [], AC_MSG_ERROR('varnishapi.h' header not found))
         AC_CHECK_HEADER([$VARNISH_INCDIR/vsl.h], [], AC_MSG_ERROR('vsl.h' header not found))
+      elif test -f $VARNISH_INCDIR/vapi/vsm.h; then
+        dnl this is approx at least 4.1.x, for later will probably have to check for some specific stuff
+        AC_DEFINE(HAVE_VARNISHAPILIB,41,[ ])
       else
         dnl this is approx at least 4.x, for later will probably have to check for some specific stuff
-        AC_DEFINE(HAVE_VARNISHAPILIB,4,[ ])
+        AC_DEFINE(HAVE_VARNISHAPILIB,40,[ ])
         dnl there's an issue with two lines below, it might be because STLM macro isn't defined,
         dnl so the compiler decides them to be unusable
         dnl AC_CHECK_HEADER([$VARNISH_INCDIR/tbl/vsl_tags.h], [], AC_MSG_ERROR('tbl/vsl_tags.h' header not found))
         dnl AC_CHECK_HEADER([$VARNISH_INCDIR/vapi/vsl.h], [], AC_MSG_ERROR('vapi/vsl.h' header not found))
-        AC_TYPE_UINTPTR_T
-        AC_TYPE_UINT64_T
       fi
+      AC_TYPE_UINTPTR_T
+      AC_TYPE_UINT64_T
     ],[
       AC_MSG_ERROR([wrong varnishapi lib version or lib not found])
     ],[
Index: log.c
===================================================================
--- pecl/varnish/trunk/log.c	(révision 340568)
+++ pecl/varnish/trunk/log.c	(copie de travail)
@@ -140,7 +140,7 @@
  *  Varnish admin constructor */
 PHP_METHOD(VarnishLog, __construct)
 {
-#if defined(HAVE_VARNISHAPILIB) && HAVE_VARNISHAPILIB >= 4
+#if defined(HAVE_VARNISHAPILIB) && HAVE_VARNISHAPILIB >= 40
 	 php_varnish_throw_win_unimpl_exception("VarnishLog functionality isn't available for Varnish >= 4" TSRMLS_CC);
 	 return;
 #elif !defined(PHP_WIN32)
@@ -212,7 +212,7 @@
 }
 /* }}} */
 
-#if defined(HAVE_VARNISHAPILIB) && HAVE_VARNISHAPILIB < 4
+#if defined(HAVE_VARNISHAPILIB) && HAVE_VARNISHAPILIB < 40
 /* {{{ proto array VarnishLog::getLine(void)
  * Get the next log entry */
 PHP_METHOD(VarnishLog, getLine)
Index: php_varnish.h
===================================================================
--- pecl/varnish/trunk/php_varnish.h	(révision 340568)
+++ pecl/varnish/trunk/php_varnish.h	(copie de travail)
@@ -82,12 +82,12 @@
 PHP_METHOD(VarnishAdmin, disconnect);
 
 PHP_METHOD(VarnishStat, __construct);
-#if defined(HAVE_VARNISHAPILIB) && HAVE_VARNISHAPILIB < 4
+#if defined(HAVE_VARNISHAPILIB) && HAVE_VARNISHAPILIB < 40
 PHP_METHOD(VarnishStat, getSnapshot);
 #endif
 
 PHP_METHOD(VarnishLog, __construct);
-#if defined(HAVE_VARNISHAPILIB) && HAVE_VARNISHAPILIB < 4
+#if defined(HAVE_VARNISHAPILIB) && HAVE_VARNISHAPILIB < 40
 PHP_METHOD(VarnishLog, getLine);
 PHP_METHOD(VarnishLog, getTagName);
 #endif
Index: stat.c
===================================================================
--- pecl/varnish/trunk/stat.c	(révision 340568)
+++ pecl/varnish/trunk/stat.c	(copie de travail)
@@ -129,7 +129,7 @@
  *  Varnish admin constructor */
 PHP_METHOD(VarnishStat, __construct)
 {
-#if defined(HAVE_VARNISHAPILIB) && HAVE_VARNISHAPILIB >= 4
+#if defined(HAVE_VARNISHAPILIB) && HAVE_VARNISHAPILIB >= 40
 	 php_varnish_throw_win_unimpl_exception("VarnishStat functionality isn't available for Varnish >= 4" TSRMLS_CC);
 	 return;
 #elif !defined(PHP_WIN32)
@@ -181,7 +181,7 @@
 }
 /* }}} */
 
-#if defined(HAVE_VARNISHAPILIB) && HAVE_VARNISHAPILIB < 4
+#if defined(HAVE_VARNISHAPILIB) && HAVE_VARNISHAPILIB < 40
 /* {{{ proto array VarnishStat::getSnapshot(void)
   Get a statistics snapshot */
 PHP_METHOD(VarnishStat, getSnapshot)
Index: varnish.c
===================================================================
--- pecl/varnish/trunk/varnish.c	(révision 340570)
+++ pecl/varnish/trunk/varnish.c	(copie de travail)
@@ -98,7 +98,7 @@
 /* {{{ VarnishStat_methods{} */
 const zend_function_entry VarnishStat_methods[] = {
 	PHP_ME(VarnishStat, __construct, NULL, ZEND_ACC_PUBLIC)
-#if defined(HAVE_VARNISHAPILIB) && HAVE_VARNISHAPILIB < 4
+#if defined(HAVE_VARNISHAPILIB) && HAVE_VARNISHAPILIB < 40
 	PHP_ME(VarnishStat, getSnapshot, NULL, ZEND_ACC_PUBLIC)
 #endif
 	{NULL, NULL, NULL}
@@ -108,7 +108,7 @@
 /* {{{ VarnishLog_methods{} */
 const zend_function_entry VarnishLog_methods[] = {
 	PHP_ME(VarnishLog, __construct, NULL, ZEND_ACC_PUBLIC)
-#if defined(HAVE_VARNISHAPILIB) && HAVE_VARNISHAPILIB < 4
+#if defined(HAVE_VARNISHAPILIB) && HAVE_VARNISHAPILIB < 40
 	PHP_ME(VarnishLog, getLine, NULL, ZEND_ACC_PUBLIC)
 	PHP_ME(VarnishLog, getTagName, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
 #endif
@@ -215,7 +215,7 @@
 
 /* log is not working on windows at the time*/
 #ifndef PHP_WIN32
-#if HAVE_VARNISHAPILIB >= 4
+#if HAVE_VARNISHAPILIB >= 40
 #define SLTM(name, flags, shortdesc, longdesc) \
 zend_declare_class_constant_long(VarnishLog_ce, "TAG_"#name, strlen("TAG_"#name), SLT_##name TSRMLS_CC);
 #include "tbl/vsl_tags.h"
Index: varnish_lib.c
===================================================================
--- pecl/varnish/trunk/varnish_lib.c	(révision 340568)
+++ pecl/varnish/trunk/varnish_lib.c	(copie de travail)
@@ -348,12 +348,12 @@
 	int sock = -1, j;
 	struct VSM_data *vsd;
 	char *t_arg, *t_start, *p, tmp_addr[41];
-#if HAVE_VARNISHAPILIB >= 4
+#if HAVE_VARNISHAPILIB >= 40
 	struct VSM_fantom vt;
 #endif
 
 	vsd = VSM_New();
-#if HAVE_VARNISHAPILIB >= 4
+#if HAVE_VARNISHAPILIB >= 40
 	if (VSM_n_Arg(vsd, ident) > 0) {
 		if (VSM_Open(vsd)) {
 #else
@@ -363,7 +363,7 @@
 			zend_throw_exception_ex(
 				VarnishException_ce,
 				PHP_VARNISH_SHM_EXCEPTION TSRMLS_CC,
-#if HAVE_VARNISHAPILIB >= 4
+#if HAVE_VARNISHAPILIB >= 40
 				VSM_Error(vsd)
 #else
 				"Could not open shared memory"
@@ -372,7 +372,7 @@
 			return sock;
 		}
 
-#if HAVE_VARNISHAPILIB >= 4
+#if HAVE_VARNISHAPILIB >= 40
 		if (!VSM_Get(vsd, &vt, "Arg", "-T", "")) {
 #else
 		p = VSM_Find_Chunk(vsd, "Arg", "-T", "", NULL);
@@ -381,7 +381,7 @@
 			zend_throw_exception_ex(
 				VarnishException_ce,
 				PHP_VARNISH_SHM_EXCEPTION TSRMLS_CC,
-#if HAVE_VARNISHAPILIB >= 4
+#if HAVE_VARNISHAPILIB >= 40
 				VSM_Error(vsd)
 #else
 				"No address and port found in the shared memory"
@@ -390,7 +390,7 @@
 			VSM_Delete(vsd);
 			return sock;
 		}
-#if HAVE_VARNISHAPILIB >= 4
+#if HAVE_VARNISHAPILIB >= 40
 		t_start = t_arg = estrdup(vt.b);
 #else
 		t_start = t_arg = estrdup(p);
@@ -406,7 +406,7 @@
 		return sock;
 	}
 
-#if HAVE_VARNISHAPILIB >= 4
+#if HAVE_VARNISHAPILIB >= 40
 	VSM_Delete(vsd);
 #endif
 
@@ -528,7 +528,7 @@
 	char *s_arg, *answer = NULL;
 	int fd;
 	char buf[CLI_AUTH_RESPONSE_LEN + 1];
-#if HAVE_VARNISHAPILIB >= 4
+#if HAVE_VARNISHAPILIB >= 40
 	struct VSM_fantom vt;
 #else
 	char *p;
@@ -538,7 +538,7 @@
 	if (PHP_VARNISH_STATUS_AUTH == *status) {
 		vsd = VSM_New();
 		if (VSM_n_Arg(vsd, ident)) {
-#if HAVE_VARNISHAPILIB >= 4
+#if HAVE_VARNISHAPILIB >= 40
 			if (VSM_Open(vsd)) {
 #else
 			if (VSM_Open(vsd, 1)) {
@@ -551,7 +551,7 @@
 				return sock;
 			}
 
-#if HAVE_VARNISHAPILIB >= 4
+#if HAVE_VARNISHAPILIB >= 40
 			if (VSM_Get(vsd, &vt, "Arg", "-S", "")) {
 				s_arg = estrdup(vt.b);
 #else
@@ -570,7 +570,7 @@
 					return 0;
 				}
 				efree(s_arg);
-#if HAVE_VARNISHAPILIB >= 4
+#if HAVE_VARNISHAPILIB >= 40
 			} else {
 				VSM_Delete(vsd);
 				return 0;
@@ -775,7 +775,7 @@
 }/*}}}*/
 
 #ifndef PHP_WIN32
-#if HAVE_VARNISHAPILIB < 4
+#if HAVE_VARNISHAPILIB < 40
 static int
 php_varnish_snap_stats_cb(void *priv, const struct VSC_point const *pt)
 {/*{{{*/
@@ -783,7 +783,7 @@
 	int f0, f1;
 	zval *storage, *current;
 	char buf0[128];
-#if HAVE_VARNISHAPILIB >= 4
+#if HAVE_VARNISHAPILIB >= 40
 	const char *type  = pt->section->type;
 	const char *ident = pt->section->ident;
 	const char *name  = pt->desc->name;
@@ -812,7 +812,7 @@
 }/*}}}*/
 #endif
 
-#if HAVE_VARNISHAPILIB >= 4
+#if HAVE_VARNISHAPILIB >= 40
 int
 php_varnish_snap_stats(zval *storage, const char *ident TSRMLS_DC)
 {/*{{{*/
@@ -845,7 +845,7 @@
 }/*}}}*/
 #endif
 
-#if HAVE_VARNISHAPILIB >= 4
+#if HAVE_VARNISHAPILIB >= 40
 int
 php_varnish_get_log(const struct VSM_data *vd, zval *line TSRMLS_DC)
 {/*{{{*/ 
Index: varnish_lib.h
===================================================================
--- pecl/varnish/trunk/varnish_lib.h	(révision 340570)
+++ pecl/varnish/trunk/varnish_lib.h	(copie de travail)
@@ -36,10 +36,10 @@
 #endif
 
 #ifndef PHP_WIN32
-#if HAVE_VARNISHAPILIB >= 5
+#if HAVE_VARNISHAPILIB >= 41
 #include <vapi/vsm.h>
 #endif
-#if HAVE_VARNISHAPILIB >= 4
+#if HAVE_VARNISHAPILIB >= 40
 #include <vcli.h>
 #include <vmod_abi.h>
 #include <vapi/vsl.h>