Hello all, I think there is a mismatch in the semantics of timeout for the http:request datastructure. expath says it's in seconds where as the basex impl treats it as milliseconds. Could you confirm this? The expath states: [...] |timeout|is the maximum number of seconds to wait for the server to respond. If this time duration is reached, an error is thrown[err:HC006] <http://expath.org/spec/http-client#errHC006>. [...] whereas in the HttpClient (lines 168 and 169) the code for setting the timeout is the following: [...] final String timeout = request.attribute(TIMEOUT); if(timeout != null) conn.setConnectTimeout(Strings.toInt(timeout)); [...] conn being an instance of HttpUrlConnection and the documentation of setConnectTimeout states it to be in milliseconds. If this is not my bad interpretation, maybe a note in the docs should be provided ... Regards, Marco.
Hello Marco, looks like you are right. However, I don't think this is a deliberate design decision, but a simple bug in our implementation. Do you think you could send us a small pull request so we can fix this and match the specification? Cheers Dirk On 09/09/2015 12:26 PM, Marco Lettere wrote:
Hello all, I think there is a mismatch in the semantics of timeout for the http:request datastructure. expath says it's in seconds where as the basex impl treats it as milliseconds. Could you confirm this?
The expath states:
[...] |timeout| is the maximum number of seconds to wait for the server to respond. If this time duration is reached, an error is thrown [err:HC006] <http://expath.org/spec/http-client#errHC006>. [...]
whereas in the HttpClient (lines 168 and 169) the code for setting the timeout is the following:
[...] final String timeout = request.attribute(TIMEOUT); if(timeout != null) conn.setConnectTimeout(Strings.toInt(timeout)); [...]
conn being an instance of HttpUrlConnection and the documentation of setConnectTimeout states it to be in milliseconds.
If this is not my bad interpretation, maybe a note in the docs should be provided ... Regards, Marco.
-- Dirk Kirsten, BaseX GmbH, http://basexgmbh.de |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22
I totally agree. Thanks for the pull request! On Wed, Sep 9, 2015 at 12:26 PM, Marco Lettere <marco.lettere@dedalus.eu> wrote:
Hello all, I think there is a mismatch in the semantics of timeout for the http:request datastructure. expath says it's in seconds where as the basex impl treats it as milliseconds. Could you confirm this?
The expath states:
[...] timeout is the maximum number of seconds to wait for the server to respond. If this time duration is reached, an error is thrown [err:HC006]. [...]
whereas in the HttpClient (lines 168 and 169) the code for setting the timeout is the following:
[...] final String timeout = request.attribute(TIMEOUT); if(timeout != null) conn.setConnectTimeout(Strings.toInt(timeout)); [...]
conn being an instance of HttpUrlConnection and the documentation of setConnectTimeout states it to be in milliseconds.
If this is not my bad interpretation, maybe a note in the docs should be provided ... Regards, Marco.
participants (3)
-
Christian Grün -
Dirk Kirsten -
Marco Lettere