Merge lp:~zorba-coders/zorba/bug-867363-disable-http into lp:zorba

Proposed by Chris Hillery
Status: Merged
Approved by: Chris Hillery
Approved revision: 11130
Merged at revision: 11125
Proposed branch: lp:~zorba-coders/zorba/bug-867363-disable-http
Merge into: lp:zorba
Diff against target: 558 lines (+168/-42)
30 files modified
ChangeLog (+2/-0)
bin/CMakeLists.txt (+17/-5)
bin/zorbacmd.cpp (+4/-3)
bin/zorbacmdproperties_base.h (+8/-1)
doc/zorba/options.dox (+15/-2)
doc/zorba/uriresolvers.dox (+4/-3)
include/zorba/pregenerated/diagnostic_list.h (+2/-0)
modules/com/zorba-xquery/www/modules/pregenerated/errors.xq (+4/-0)
src/compiler/translator/translator.cpp (+6/-0)
src/context/default_uri_mappers.cpp (+9/-1)
src/context/default_uri_mappers.h (+2/-2)
src/context/default_url_resolvers.cpp (+31/-22)
src/context/default_url_resolvers.h (+2/-0)
src/context/features.cpp (+5/-0)
src/context/features.h (+2/-1)
src/context/root_static_context.cpp (+1/-0)
src/diagnostics/diagnostic_en.xml (+5/-1)
src/diagnostics/pregenerated/diagnostic_list.cpp (+3/-0)
src/diagnostics/pregenerated/dict_en.cpp (+2/-1)
test/rbkt/ExpQueryResults/zorba/uris/disable-http-3.xml.res (+1/-0)
test/rbkt/Queries/CMakeLists.txt (+7/-0)
test/rbkt/Queries/zorba/uris/disable-http-2.spec (+2/-0)
test/rbkt/Queries/zorba/uris/disable-http-2.xq (+4/-0)
test/rbkt/Queries/zorba/uris/disable-http-3.spec (+1/-0)
test/rbkt/Queries/zorba/uris/disable-http-3.xq (+2/-0)
test/rbkt/Queries/zorba/uris/disable-http-5.spec (+1/-0)
test/rbkt/Queries/zorba/uris/disable-http-5.xq (+8/-0)
test/rbkt/Queries/zorba/uris/disable-http.spec (+2/-0)
test/rbkt/Queries/zorba/uris/disable-http.xq (+5/-0)
test/rbkt/Queries/zorba/uris/slow.xqlib (+11/-0)
To merge this branch: bzr merge lp:~zorba-coders/zorba/bug-867363-disable-http
Reviewer Review Type Date Requested Status
Markos Zaharioudakis Approve
Chris Hillery Approve
Review via email: mp+133032@code.launchpad.net

Commit message

Added http-uri-resolution feature, default enabled. If disabled via normal option mechanism (or the convenience --disable-http-resolution command-line parameter), Zorba will not attempt to download HTTP/HTTPS/FTP URLs.

To post a comment you must log in.
Revision history for this message
Chris Hillery (ceejatec) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job bug-867363-disable-http-2012-11-06T10-17-50.354Z is finished. The final status was:

All tests succeeded!

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Voting does not meet specified criteria. Required: Approve > 1, Disapprove < 1, Needs Fixing < 1, Pending < 1. Got: 1 Approve, 2 Pending.

Revision history for this message
Markos Zaharioudakis (markos-za) wrote :

1. I don't see the zorba cmd doing anything with the --disable-http-resolution option, if that option is actually specified in the command line.

2. If a user uses the option inside an xquery module, it will have no effect because options are processed after the imports. Such a user will then be very confused. We should probably consider moving the processing of options before the imports, but until we do this, we should throw an error if the disable-http-resolution option is encountered inside a module prolog. The error (and the documentation) should say that this option is applicable only at the C++ api.

Revision history for this message
Markos Zaharioudakis (markos-za) :
review: Needs Fixing
Revision history for this message
Chris Hillery (ceejatec) wrote :

> 1. I don't see the zorba cmd doing anything with the --disable-http-resolution
> option, if that option is actually specified in the command line.

See the second diff in zorbacmdproperties_base.h. It just explicitly sets the disable-http-resolution option on the static context by using the same code as --option.

> 2. If a user uses the option inside an xquery module, it will have no effect
> because options are processed after the imports. Such a user will then be very
> confused. We should probably consider moving the processing of options before
> the imports, but until we do this, we should throw an error if the disable-
> http-resolution option is encountered inside a module prolog.

I'll implement something for this.

> The error (and
> the documentation) should say that this option is applicable only at the C++
> api.

Yes, you're right; I'll fix that too.

Revision history for this message
Markos Zaharioudakis (markos-za) wrote :

> > 1. I don't see the zorba cmd doing anything with the --disable-http-
> resolution
> > option, if that option is actually specified in the command line.
>
> See the second diff in zorbacmdproperties_base.h. It just explicitly sets the
> disable-http-resolution option on the static context by using the same code as
> --option.
>

Ok, I got it. But the actual update of the static context is not done in zorbacmdproperties_base.h; it is done in zorbacmd.cpp:179.

>
> > 2. If a user uses the option inside an xquery module, it will have no effect
> > because options are processed after the imports. Such a user will then be
> very
> > confused. We should probably consider moving the processing of options
> before
> > the imports, but until we do this, we should throw an error if the disable-
> > http-resolution option is encountered inside a module prolog.
>
> I'll implement something for this.
>
> > The error (and
> > the documentation) should say that this option is applicable only at the C++
> > api.
>
> Yes, you're right; I'll fix that too.

Revision history for this message
Chris Hillery (ceejatec) wrote :

> Ok, I got it. But the actual update of the static context is not done in
> zorbacmdproperties_base.h; it is done in zorbacmd.cpp:179.

Yes, by iterating through the options from zorbacmdproperties.. :) I did test the command-line option, it definitely does the trick. I will add a test case in bin/ to verify this.

Revision history for this message
Markos Zaharioudakis (markos-za) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

The attempt to merge lp:~zorba-coders/zorba/bug-867363-disable-http into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:275 (message):
  Validation queue job bug-867363-disable-http-2012-11-08T16-14-48.2Z is
  finished. The final status was:

  1 tests did not succeed - changes not commited.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

11129. By Chris Hillery

Fix for path of test case.

11130. By Chris Hillery

Test case for inability to set http-uri-resolution option from within
query text.

Revision history for this message
Chris Hillery (ceejatec) wrote :

Fixed the broken test (path oversight), and added the test case for option-in-query text (forgot to "bzr add" it before).

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job bug-867363-disable-http-2012-11-08T22-01-03.465Z is finished. The final status was:

All tests succeeded!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ChangeLog'
2--- ChangeLog 2012-10-29 12:31:50 +0000
3+++ ChangeLog 2012-11-08 22:00:29 +0000
4@@ -5,6 +5,8 @@
5
6 New Features:
7 * (bug #1039284) Implemented jn:json-doc().
8+ * (bug #867363) Added http-uri-resolution feature to disable HTTP
9+ when resolving URIs.
10
11 Optimizations:
12 * Various optimizations in the implementation of the optimizer rules.
13
14=== modified file 'bin/CMakeLists.txt'
15--- bin/CMakeLists.txt 2012-09-19 21:16:15 +0000
16+++ bin/CMakeLists.txt 2012-11-08 22:00:29 +0000
17@@ -93,30 +93,42 @@
18 # test the --uri-path, --lib-path, and --module-path args.
19 # Use the versioning tests as they utilize test modules already.
20 SET (_testdir
21- "${CMAKE_CURRENT_SOURCE_DIR}/../test/rbkt/Queries/zorba/versioning")
22+ "${CMAKE_CURRENT_SOURCE_DIR}/../test/rbkt/Queries/zorba")
23 SET (_uridir "${CMAKE_BINARY_DIR}/TEST_URI_PATH")
24 SET (_libdir "${CMAKE_BINARY_DIR}/TEST_LIB_PATH")
25-ZORBA_ADD_TEST(bin/zorba_uri_path_1 zorbacmd -f -q "${_testdir}/import1.xq"
26+ZORBA_ADD_TEST(bin/zorba_uri_path_1 zorbacmd
27+ -f -q "${_testdir}/versioning/import1.xq"
28 --uri-path "${_uridir}")
29 ZORBA_SET_TEST_PROPERTY(bin/zorba_uri_path_1
30 PASS_REGULAR_EXPRESSION "hello, v2")
31
32-ZORBA_ADD_TEST(bin/zorba_uri_path_2 zorbacmd -f -q "${_testdir}/external1.xq"
33+ZORBA_ADD_TEST(bin/zorba_uri_path_2 zorbacmd
34+ -f -q "${_testdir}/versioning/external1.xq"
35 --uri-path "${_uridir}")
36 ZORBA_SET_TEST_PROPERTY(bin/zorba_uri_path_2
37 PASS_REGULAR_EXPRESSION "ZXQP0008")
38
39-ZORBA_ADD_TEST(bin/zorba_uri_path_3 zorbacmd -f -q "${_testdir}/external1.xq"
40+ZORBA_ADD_TEST(bin/zorba_uri_path_3 zorbacmd
41+ -f -q "${_testdir}/versioning/external1.xq"
42 --uri-path "${_uridir}" --lib-path "${_libdir}")
43 ZORBA_SET_TEST_PROPERTY(bin/zorba_uri_path_3
44 PASS_REGULAR_EXPRESSION "hello, v2")
45
46+# test the --disable-http-resolution flag, using the corresponding test query
47+# from rbkt/zorba/uris/disable-http and a timeout.
48+ZORBA_ADD_TEST(bin/zorba_disable_http_download zorbacmd
49+ -f -q "${_testdir}/uris/disable-http.xq" --disable-http-resolution)
50+ZORBA_SET_TEST_PROPERTY(bin/zorba_disable_http_download
51+ PASS_REGULAR_EXPRESSION "XQST0059")
52+ZORBA_SET_TEST_PROPERTY(bin/zorba_disable_http_download TIMEOUT 5)
53+
54 IF(WIN32)
55 SET(PATH_SEP ";")
56 ELSE(WIN32)
57 SET(PATH_SEP ":")
58 ENDIF(WIN32)
59-ZORBA_ADD_TEST(bin/zorba_module_path_1 zorbacmd -f -q "${_testdir}/external1.xq"
60+ZORBA_ADD_TEST(bin/zorba_module_path_1 zorbacmd
61+ -f -q "${_testdir}/versioning/external1.xq"
62 --module-path "${_libdir}${PATH_SEP}${_uridir}")
63 ZORBA_SET_TEST_PROPERTY(bin/zorba_module_path_1
64 PASS_REGULAR_EXPRESSION "hello, v2")
65
66=== modified file 'bin/zorbacmd.cpp'
67--- bin/zorbacmd.cpp 2012-10-10 21:15:05 +0000
68+++ bin/zorbacmd.cpp 2012-11-08 22:00:29 +0000
69@@ -178,10 +178,10 @@
70 Item lQName = zorba->getItemFactory()->createQName(lIter->clark_qname);
71 sctx->declareOption(lQName, lIter->value);
72 }
73- catch (zorba::ZorbaException const& /* e */)
74+ catch (zorba::ZorbaException const& e)
75 {
76 std::cerr << "unable to set static context option with qname "
77- << lIter->clark_qname << std::endl;
78+ << lIter->clark_qname << ": " << e.what() << std::endl;
79 return false;
80 }
81 }
82@@ -251,7 +251,8 @@
83 sctx->registerURIMapper(&theThesaurusMapper);
84 }
85 }
86-#endif
87+#endif /* ZORBA_NO_FULL_TEXT */
88+
89 return true;
90 }
91
92
93=== modified file 'bin/zorbacmdproperties_base.h'
94--- bin/zorbacmdproperties_base.h 2012-09-19 21:16:15 +0000
95+++ bin/zorbacmdproperties_base.h 2012-11-08 22:00:29 +0000
96@@ -42,7 +42,8 @@
97 "--no-serializer", "--debug", "--debug-host", "--debug-port", "--no-logo",
98 "--timeout", "--uri-path", "--lib-path", "--module-path", "--classpath",
99 "--option", "--trailing-nl", "--stop-words", "--thesaurus",
100- "--compile-plan", "--execute-plan --serialize-plan", NULL };
101+ "--compile-plan", "--execute-plan", "--serialize-plan",
102+ "--disable-http-resolution", NULL };
103 return result;
104 }
105
106@@ -426,6 +427,11 @@
107 {
108 theLoadPlan = true;
109 }
110+ else if (strcmp (*argv, "--disable-http-resolution") == 0)
111+ {
112+ init_val ("{http://www.zorba-xquery.com/options/features}disable=http-uri-resolution",
113+ theOption, 0);
114+ }
115 else if (strcmp (*argv, "--") == 0)
116 {
117 copy_args (++argv);
118@@ -489,6 +495,7 @@
119 "--serialize-plan, -s\nSerialize and then load the query execution plan.\n\n"
120 "--compile-plan,\nDo not execute the query; just compile it and save the execution plan in the file specified with the -o option.\n\n"
121 "--execute-plan\nDo not compile the query; instead load the execution plan from the file specified by the -f -q options, and execute the loaded plan.\n\n"
122+ "--disable-http-resolution\nDo not use HTTP to resolve URIs\n\n"
123 ;
124 }
125
126
127=== modified file 'doc/zorba/options.dox'
128--- doc/zorba/options.dox 2012-10-08 12:09:36 +0000
129+++ doc/zorba/options.dox 2012-11-08 22:00:29 +0000
130@@ -67,8 +67,9 @@
131 <li><b>scripting:</b> This local name can be used to enable or disable the
132 Zorba Scripting Extension. Per default, the feature is enabled.
133 </li>
134-<li><b>xqddf:</b> The <tt>xqddf</tt> local name refers to the Zorba specific
135-XQuery Data Definition Facility. The feature is enabled by default.
136+<li><b>ddl:</b> The <tt>ddl</tt> local name refers to the static
137+(language-level) Data Description Language portion of the \ref xqddf.
138+The feature is enabled by default.
139 </li>
140 <li><b>trace:</b> The
141 <a href="http://www.w3.org/TR/xpath-functions-30/#func-trace">fn:trace</a>
142@@ -86,6 +87,18 @@
143 <a href="http://www.w3.org/TR/xpath-functions-30/#func-doc">fn:doc</a>. DTD
144 validation is disabled by default.
145 </li>
146+<li><b>http-uri-resolution:</b> When resolving URIs for schema and module
147+import statements, Zorba always first attempts to map the URI to a local
148+filesystem location (see \ref builtin_uri_resolver). As a fallback, Zorba
149+will then by default attempt to use HTTP, HTTPS, or FTP (depending on the
150+URI scheme) to download the resource from the internet. The local name
151+<tt>http-uri-resolution</tt> can be used to enable or disable this network
152+fallback. By default it is enabled.
153+\note Because XQuery options must appear in queries after import statements,
154+unfortunately the <tt>http-uri-resolution</tt> option can have no effect if
155+it is specified inside query text. It must be specified using the C++ API
156+or a Zorba command-line option. An error will be raised if this option is
157+specified inside query text to avoid confusion.
158 </ul>
159
160
161
162=== modified file 'doc/zorba/uriresolvers.dox'
163--- doc/zorba/uriresolvers.dox 2012-09-19 21:16:15 +0000
164+++ doc/zorba/uriresolvers.dox 2012-11-08 22:00:29 +0000
165@@ -20,7 +20,7 @@
166 which will allow you to resolve URIs from queries in almost any way
167 imaginable to handle application-specific problems.
168
169-\section builtin Zorba's Built-in URI Resolver
170+\section builtin_uri_resolver Zorba's Built-in URI Resolver
171
172 XQuery itself offers an approach to locating resources via the "at"
173 clause in <code>import module</code> and <code>import schema</code>
174@@ -143,8 +143,9 @@
175
176 If, after searching all URI path directories, no match is found for
177 a given URI, Zorba will by default fall back to interpretting the URI
178-as a URL and loading the resource via HTTP (assuming the URI
179-has the http: scheme).
180+as a URL and loading the resource via HTTP / HTTPS / FTP (depending on
181+the URI scheme). This behaviour can be defeated by disabling the
182+<tt>http-uri-resolution</tt> Zorba option (see \ref options_features).
183
184 \section libpath Zorba's Library Path
185
186
187=== modified file 'include/zorba/pregenerated/diagnostic_list.h'
188--- include/zorba/pregenerated/diagnostic_list.h 2012-10-08 12:09:36 +0000
189+++ include/zorba/pregenerated/diagnostic_list.h 2012-11-08 22:00:29 +0000
190@@ -450,6 +450,8 @@
191
192 extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZXQP0060_OPTION_NOT_KNOWN;
193
194+extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZXQP0061_DISABLE_HTTP_OPTION_IN_QUERY;
195+
196 #if !defined(ZORBA_NO_FULL_TEXT)
197 extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZXQP8401_THESAURUS_VERSION_MISMATCH;
198
199
200=== modified file 'modules/com/zorba-xquery/www/modules/pregenerated/errors.xq'
201--- modules/com/zorba-xquery/www/modules/pregenerated/errors.xq 2012-10-08 12:09:36 +0000
202+++ modules/com/zorba-xquery/www/modules/pregenerated/errors.xq 2012-11-08 22:00:29 +0000
203@@ -180,6 +180,10 @@
204 declare variable $zerr:ZXQP0060 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0060");
205
206 (:~
207+:)
208+declare variable $zerr:ZXQP0061 as xs:QName := fn:QName($zerr:NS, "zerr:ZXQP0061");
209+
210+(:~
211 :
212 : The version of the thesaurus is not the expected version.
213 :
214
215=== modified file 'src/compiler/translator/translator.cpp'
216--- src/compiler/translator/translator.cpp 2012-10-29 12:31:50 +0000
217+++ src/compiler/translator/translator.cpp 2012-11-08 22:00:29 +0000
218@@ -3334,6 +3334,12 @@
219 if (qnameItem->getPrefix().empty() && qnameItem->getNamespace().empty())
220 RAISE_ERROR(err::XPST0081, loc, ERROR_PARAMS(qnameItem->getStringValue()));
221
222+ if (qnameItem->getNamespace() == static_context::ZORBA_OPTION_FEATURE_NS &&
223+ value == "http-uri-resolution")
224+ {
225+ RAISE_ERROR(zerr::ZXQP0061_DISABLE_HTTP_OPTION_IN_QUERY, loc,
226+ ERROR_PARAMS(value));
227+ }
228 theSctx->bind_option(qnameItem, value, opt_decl->get_location());
229
230 if (qnameItem->getNamespace() == static_context::ZORBA_OPTION_OPTIM_NS &&
231
232=== modified file 'src/context/default_uri_mappers.cpp'
233--- src/context/default_uri_mappers.cpp 2012-09-19 21:16:15 +0000
234+++ src/context/default_uri_mappers.cpp 2012-11-08 22:00:29 +0000
235@@ -17,6 +17,7 @@
236 #include "stdafx.h"
237
238 #include <context/default_uri_mappers.h>
239+#include <context/default_url_resolvers.h>
240 #include <util/uri_util.h>
241 #include <util/fs_util.h>
242 #include <zorbatypes/URI.h>
243@@ -192,7 +193,14 @@
244
245 // Finally, append the original URI, so that it will be resolved
246 // as-is if there's nothing appropriate on the local filesystem.
247- oUris.push_back(aUri);
248+ // Note: For module or schema imports, don't do this if it's a
249+ // network (HTTP) URI and the "http_resolution" feature is disabled
250+ // on this context.
251+ if ( (lKind != EntityData::MODULE && lKind != EntityData::SCHEMA) ||
252+ aSctx.is_feature_set(feature::http_resolution) ||
253+ (HTTPURLResolver::isHTTPScheme(aUri) == false) ) {
254+ oUris.push_back(aUri);
255+ }
256 }
257
258 ZorbaCollectionURIMapper::~ZorbaCollectionURIMapper()
259
260=== modified file 'src/context/default_uri_mappers.h'
261--- src/context/default_uri_mappers.h 2012-09-19 21:16:15 +0000
262+++ src/context/default_uri_mappers.h 2012-11-08 22:00:29 +0000
263@@ -91,10 +91,10 @@
264 virtual void mapURI(zstring const& aUri,
265 EntityData const* aEntityData,
266 static_context const& aSctx,
267- std::vector<zstring>& oUrls);
268+ std::vector<zstring>& oUris);
269 };
270
271-} /* namespace zorba::impl */
272+} /* namespace zorba::internal */
273
274 } /* namespace zorba */
275
276
277=== modified file 'src/context/default_url_resolvers.cpp'
278--- src/context/default_url_resolvers.cpp 2012-09-19 21:16:15 +0000
279+++ src/context/default_url_resolvers.cpp 2012-11-08 22:00:29 +0000
280@@ -34,34 +34,44 @@
281
282 namespace internal {
283
284-/******
285- * http: (and https: and ftp:) URL resolver.
286- ******/
287-
288-Resource*
289-HTTPURLResolver::resolveURL
290-(zstring const& aUrl, EntityData const* aEntityData)
291+/**
292+ * Utility function that identifies URL schemes that will be handled
293+ * by the HttpStream class.
294+ */
295+bool
296+HTTPURLResolver::isHTTPScheme(zstring const& aUrl)
297 {
298- switch ( aEntityData->getKind() ) {
299- case EntityData::COLLECTION:
300-#ifndef ZORBA_NO_FULL_TEXT
301- case EntityData::THESAURUS:
302-#endif /* ZORBA_NO_FULL_TEXT */
303- return nullptr;
304- default:
305- break;
306- }
307-
308 uri::scheme lScheme = uri::get_scheme(aUrl);
309 switch (lScheme) {
310 case uri::http:
311 case uri::https:
312 case uri::ftp:
313- // Fall through to actual implementation
314+ return true;
315+ default:
316+ return false;
317+ }
318+}
319+
320+/******
321+ * http: (and https: and ftp:) URL resolver.
322+ ******/
323+
324+Resource*
325+HTTPURLResolver::resolveURL
326+(zstring const& aUrl, EntityData const* aEntityData)
327+{
328+ switch ( aEntityData->getKind() ) {
329+ case EntityData::COLLECTION:
330+#ifndef ZORBA_NO_FULL_TEXT
331+ case EntityData::THESAURUS:
332+#endif /* ZORBA_NO_FULL_TEXT */
333+ return nullptr;
334+ default:
335 break;
336- default:
337- // We don't implement other schemes
338- return NULL;
339+ }
340+
341+ if (!isHTTPScheme(aUrl)) {
342+ return nullptr;
343 }
344 try {
345 std::auto_ptr<HttpStream> lStream(new HttpStream(aUrl));
346@@ -76,7 +86,6 @@
347 }
348 }
349
350-
351 /******
352 * file: URL resolver.
353 ******/
354
355=== modified file 'src/context/default_url_resolvers.h'
356--- src/context/default_url_resolvers.h 2012-09-19 21:16:15 +0000
357+++ src/context/default_url_resolvers.h 2012-11-08 22:00:29 +0000
358@@ -42,6 +42,8 @@
359 {
360 public:
361
362+ static bool isHTTPScheme(zstring const& aUrl);
363+
364 virtual Resource* resolveURL(zstring const& aUrl,
365 EntityData const* aEntityData);
366 };
367
368=== modified file 'src/context/features.cpp'
369--- src/context/features.cpp 2012-09-19 21:16:15 +0000
370+++ src/context/features.cpp 2012-11-08 22:00:29 +0000
371@@ -49,6 +49,11 @@
372 res = dtd;
373 return true;
374 }
375+ else if ( ztd::equals(s, "http-uri-resolution") )
376+ {
377+ res = http_resolution;
378+ return true;
379+ }
380 return false;
381 }
382 }
383
384=== modified file 'src/context/features.h'
385--- src/context/features.h 2012-09-19 21:16:15 +0000
386+++ src/context/features.h 2012-11-08 22:00:29 +0000
387@@ -30,7 +30,8 @@
388 scripting = 4,
389 hof = 8,
390 trace = 16,
391- dtd = 32
392+ dtd = 32,
393+ http_resolution = 64,
394 };
395
396 bool kind_for( char const*, kind& );
397
398=== modified file 'src/context/root_static_context.cpp'
399--- src/context/root_static_context.cpp 2012-10-08 12:09:36 +0000
400+++ src/context/root_static_context.cpp 2012-11-08 22:00:29 +0000
401@@ -185,6 +185,7 @@
402 set_feature( feature::ddl );
403 set_feature( feature::scripting );
404 set_feature( feature::trace );
405+ set_feature( feature::http_resolution );
406 }
407
408
409
410=== modified file 'src/diagnostics/diagnostic_en.xml'
411--- src/diagnostics/diagnostic_en.xml 2012-10-23 19:07:56 +0000
412+++ src/diagnostics/diagnostic_en.xml 2012-11-08 22:00:29 +0000
413@@ -1808,7 +1808,11 @@
414 </diagnostic>
415
416 <diagnostic code="ZXQP0060" name="OPTION_NOT_KNOWN">
417- <value>"$1": unkown option</value>
418+ <value>"$1": unknown option</value>
419+ </diagnostic>
420+
421+ <diagnostic code="ZXQP0061" name="DISABLE_HTTP_OPTION_IN_QUERY">
422+ <value>"$1": this option cannot be specified in a query, it must be set via C++ API or command-line parameter</value>
423 </diagnostic>
424
425 <diagnostic code="ZXQP8401" name="THESAURUS_VERSION_MISMATCH"
426
427=== modified file 'src/diagnostics/pregenerated/diagnostic_list.cpp'
428--- src/diagnostics/pregenerated/diagnostic_list.cpp 2012-10-08 12:09:36 +0000
429+++ src/diagnostics/pregenerated/diagnostic_list.cpp 2012-11-08 22:00:29 +0000
430@@ -655,6 +655,9 @@
431 ZorbaErrorCode ZXQP0060_OPTION_NOT_KNOWN( "ZXQP0060" );
432
433
434+ZorbaErrorCode ZXQP0061_DISABLE_HTTP_OPTION_IN_QUERY( "ZXQP0061" );
435+
436+
437 #if !defined(ZORBA_NO_FULL_TEXT)
438 ZorbaErrorCode ZXQP8401_THESAURUS_VERSION_MISMATCH( "ZXQP8401" );
439
440
441=== modified file 'src/diagnostics/pregenerated/dict_en.cpp'
442--- src/diagnostics/pregenerated/dict_en.cpp 2012-10-23 19:07:56 +0000
443+++ src/diagnostics/pregenerated/dict_en.cpp 2012-11-08 22:00:29 +0000
444@@ -497,7 +497,8 @@
445 { "ZXQP0039", "\"$1\": invalid version specification" },
446 { "ZXQP0040", "\"$1\": function invokes a nondeterministic function but is missing the nondeterministic annotation" },
447 { "ZXQP0050", "\"$1\": feature not available" },
448- { "ZXQP0060", "\"$1\": unkown option" },
449+ { "ZXQP0060", "\"$1\": unknown option" },
450+ { "ZXQP0061", "\"$1\": this option cannot be specified in a query, it must be set via C++ API or command-line parameter" },
451 #if !defined(ZORBA_NO_FULL_TEXT)
452 { "ZXQP8401", "\"$1\": wrong WordNet file version; should be \"$2\"" },
453 #endif
454
455=== added file 'test/rbkt/ExpQueryResults/zorba/uris/disable-http-3.xml.res'
456--- test/rbkt/ExpQueryResults/zorba/uris/disable-http-3.xml.res 1970-01-01 00:00:00 +0000
457+++ test/rbkt/ExpQueryResults/zorba/uris/disable-http-3.xml.res 2012-11-08 22:00:29 +0000
458@@ -0,0 +1,1 @@
459+<query>querystring</query>
460
461=== modified file 'test/rbkt/Queries/CMakeLists.txt'
462--- test/rbkt/Queries/CMakeLists.txt 2012-10-20 21:29:37 +0000
463+++ test/rbkt/Queries/CMakeLists.txt 2012-11-08 22:00:29 +0000
464@@ -491,6 +491,13 @@
465 # hitting w3.org for the DTD, which is bad.
466 SET_TESTS_PROPERTIES(test/rbkt/zorba/schemas/local-xhtml
467 PROPERTIES TIMEOUT 5)
468+# Bug 867363. These should fail or pass quickly because HTTP download
469+# is disabled.
470+SET_TESTS_PROPERTIES(test/rbkt/zorba/uris/disable-http
471+ PROPERTIES TIMEOUT 5)
472+SET_TESTS_PROPERTIES(test/rbkt/zorba/uris/disable-http-2
473+ PROPERTIES TIMEOUT 5)
474+
475
476 # --------------------------------------------------------------------------
477 # the list of tests that are failing but can be accepted by the commit queue
478
479=== added file 'test/rbkt/Queries/zorba/uris/disable-http-2.spec'
480--- test/rbkt/Queries/zorba/uris/disable-http-2.spec 1970-01-01 00:00:00 +0000
481+++ test/rbkt/Queries/zorba/uris/disable-http-2.spec 2012-11-08 22:00:29 +0000
482@@ -0,0 +1,2 @@
483+Options: {http://www.zorba-xquery.com/options/features}disable=http-uri-resolution
484+Error: http://www.w3.org/2005/xqt-errors:XQST0059
485
486=== added file 'test/rbkt/Queries/zorba/uris/disable-http-2.xq'
487--- test/rbkt/Queries/zorba/uris/disable-http-2.xq 1970-01-01 00:00:00 +0000
488+++ test/rbkt/Queries/zorba/uris/disable-http-2.xq 2012-11-08 22:00:29 +0000
489@@ -0,0 +1,4 @@
490+import module namespace slow = "http://www.zorba-xquery.com/test/uris/slow"
491+ at "slow.xqlib";
492+
493+slow:ok()
494
495=== added file 'test/rbkt/Queries/zorba/uris/disable-http-3.spec'
496--- test/rbkt/Queries/zorba/uris/disable-http-3.spec 1970-01-01 00:00:00 +0000
497+++ test/rbkt/Queries/zorba/uris/disable-http-3.spec 2012-11-08 22:00:29 +0000
498@@ -0,0 +1,1 @@
499+Options: {http://www.zorba-xquery.com/options/features}disable=http-uri-resolution
500
501=== added file 'test/rbkt/Queries/zorba/uris/disable-http-3.xq'
502--- test/rbkt/Queries/zorba/uris/disable-http-3.xq 1970-01-01 00:00:00 +0000
503+++ test/rbkt/Queries/zorba/uris/disable-http-3.xq 2012-11-08 22:00:29 +0000
504@@ -0,0 +1,2 @@
505+(: Ensure that disabling HTTP URI resolution doesn't defeat fn:doc(). :)
506+fn:doc("http://zorbatest.lambda.nu:8080/cgi-bin/test-xml?querystring")/body/query
507
508=== added file 'test/rbkt/Queries/zorba/uris/disable-http-5.spec'
509--- test/rbkt/Queries/zorba/uris/disable-http-5.spec 1970-01-01 00:00:00 +0000
510+++ test/rbkt/Queries/zorba/uris/disable-http-5.spec 2012-11-08 22:00:29 +0000
511@@ -0,0 +1,1 @@
512+Error: http://www.zorba-xquery.com/errors:ZXQP0061
513
514=== added file 'test/rbkt/Queries/zorba/uris/disable-http-5.xq'
515--- test/rbkt/Queries/zorba/uris/disable-http-5.xq 1970-01-01 00:00:00 +0000
516+++ test/rbkt/Queries/zorba/uris/disable-http-5.xq 2012-11-08 22:00:29 +0000
517@@ -0,0 +1,8 @@
518+(: Cannot specify this option inside query, unfortunately, since options :)
519+(: must come after imports. :)
520+declare namespace op = "http://www.zorba-xquery.com/options/features";
521+declare option op:disable "http-uri-resolution";
522+
523+1
524+
525+
526
527=== added file 'test/rbkt/Queries/zorba/uris/disable-http.spec'
528--- test/rbkt/Queries/zorba/uris/disable-http.spec 1970-01-01 00:00:00 +0000
529+++ test/rbkt/Queries/zorba/uris/disable-http.spec 2012-11-08 22:00:29 +0000
530@@ -0,0 +1,2 @@
531+Options: {http://www.zorba-xquery.com/options/features}disable=http-uri-resolution
532+Error: http://www.w3.org/2005/xqt-errors:XQST0059
533
534=== added file 'test/rbkt/Queries/zorba/uris/disable-http.xq'
535--- test/rbkt/Queries/zorba/uris/disable-http.xq 1970-01-01 00:00:00 +0000
536+++ test/rbkt/Queries/zorba/uris/disable-http.xq 2012-11-08 22:00:29 +0000
537@@ -0,0 +1,5 @@
538+(: For various reasons, importing a bad schema via HTTP can take :)
539+(: minutes to complete. This test should time out unless the :)
540+(: http-uri-resolution feature is disabled. :)
541+import schema "http://www.w3.org/";
542+1
543
544=== added file 'test/rbkt/Queries/zorba/uris/slow.xqlib'
545--- test/rbkt/Queries/zorba/uris/slow.xqlib 1970-01-01 00:00:00 +0000
546+++ test/rbkt/Queries/zorba/uris/slow.xqlib 2012-11-08 22:00:29 +0000
547@@ -0,0 +1,11 @@
548+(: For various reasons, importing a bad schema via HTTP can take :)
549+(: minutes to complete. A test importing this module should time out :)
550+(: unless the http-uri-resolution feature is disabled. :)
551+module namespace slow = "http://www.zorba-xquery.com/test/uris/slow";
552+
553+import schema "http://www.w3.org/";
554+
555+declare function slow:ok() as xs:string
556+{
557+ "OK"
558+};

Subscribers

People subscribed via source and target branches