http:request timeout
Wednesday, 9 September 2015 · 3 messages · last reply 13 Sep 2015
ML
Marco Lettere9 Sep 2015 12:26 #
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.DK
Dirk Kirsten9 Sep 2015 13:34 #
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
Quoted text · Marco Lettere · 29 lines
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
CG
I totally agree. Thanks for the pull request!
Quoted text · Marco Lettere · 28 lines
On Wed, Sep 9, 2015 at 12:26 PM, Marco Lettere <marco.lettere at 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.
Written for BaseX 8.2. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery