http:sent-request with username, password and auth-method results in improper use msg
Hi Cristian, When I add the username, password,auth-method to a http-request [1] I get an improper use message from BaseX[2]. The message suggest a bug. I hope this helps solving it. Kind regards, Rob [1] http:send-request( <http:request method='post' username='admin' password='admin' auth-method='Basic' > <http:body media-type='text/plain'/> </http:request> , 'http://LAPTOP-F17D4BIM:8984/test' , "test" ) [2] Error: Improper use? Potential bug? Your feedback is welcome: Contact: basex-talk@mailman.uni-konstanz.de Version: BaseX 9.5.3 beta Java: Oracle Corporation, 1.8.0_271 OS: Windows 10, amd64 Stack Trace: java.lang.IllegalStateException: Already connected at sun.net.www.protocol.http.HttpURLConnection.setRequestProperty(Unknown Source) at org.basex.util.http.HttpClient.setContentType(HttpClient.java:258) at org.basex.util.http.HttpClient.sendRequest(HttpClient.java:82) at org.basex.query.func.http.HttpSendRequest.value(HttpSendRequest.java:34) at org.basex.query.expr.ParseExpr.iter(ParseExpr.java:46) at org.basex.query.scope.MainModule.iter(MainModule.java:97) at org.basex.query.QueryContext.iter(QueryContext.java:326) at org.basex.query.QueryContext.cache(QueryContext.java:607) at org.basex.query.QueryProcessor.cache(QueryProcessor.java:113) at org.basex.core.cmd.AQuery.query(AQuery.java:99) at org.basex.core.cmd.XQuery.run(XQuery.java:22) at org.basex.core.Command.run(Command.java:257) at org.basex.core.Command.execute(Command.java:93) at org.basex.gui.GUI.exec(GUI.java:416) at org.basex.gui.GUI.lambda$4(GUI.java:359) at java.lang.Thread.run(Unknown Source) Sent from Mail for Windows 10 -- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus
Hi Rob, If my assumption is correct that the URL points to a RESTXQ function… Could you share this function with us, or provide us with a minimized version of it? Thanks in advance Christian On Tue, Jun 15, 2021 at 9:59 AM Rob Stapper <r.stapper@lijbrandt.nl> wrote:
Hi Cristian,
When I add the username, password,auth-method to a http-request [1] I get an improper use message from BaseX[2]. The message suggest a bug. I hope this helps solving it.
Kind regards,
Rob
[1]
http:send-request( <http:request method='post' username='admin' password='admin' auth-method='Basic' >
<http:body media-type='text/plain'/>
</http:request>
, 'http://LAPTOP-F17D4BIM:8984/test'
, "test"
)
[2]
Error:
Improper use? Potential bug? Your feedback is welcome:
Contact: basex-talk@mailman.uni-konstanz.de
Version: BaseX 9.5.3 beta
Java: Oracle Corporation, 1.8.0_271
OS: Windows 10, amd64
Stack Trace:
java.lang.IllegalStateException: Already connected
at sun.net.www.protocol.http.HttpURLConnection.setRequestProperty(Unknown Source)
at org.basex.util.http.HttpClient.setContentType(HttpClient.java:258)
at org.basex.util.http.HttpClient.sendRequest(HttpClient.java:82)
at org.basex.query.func.http.HttpSendRequest.value(HttpSendRequest.java:34)
at org.basex.query.expr.ParseExpr.iter(ParseExpr.java:46)
at org.basex.query.scope.MainModule.iter(MainModule.java:97)
at org.basex.query.QueryContext.iter(QueryContext.java:326)
at org.basex.query.QueryContext.cache(QueryContext.java:607)
at org.basex.query.QueryProcessor.cache(QueryProcessor.java:113)
at org.basex.core.cmd.AQuery.query(AQuery.java:99)
at org.basex.core.cmd.XQuery.run(XQuery.java:22)
at org.basex.core.Command.run(Command.java:257)
at org.basex.core.Command.execute(Command.java:93)
at org.basex.gui.GUI.exec(GUI.java:416)
at org.basex.gui.GUI.lambda$4(GUI.java:359)
at java.lang.Thread.run(Unknown Source)
Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient&utm_term=icon> Virus-free. www.avast.com <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient&utm_term=link> <#m_-2459511351204831494_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
Hi Rob, A fix is available [1]. Could you give it another go? Dank je wel, Christian [1] https://files.basex.org/releases/latest/ On Tue, Jun 15, 2021 at 9:59 AM Rob Stapper <r.stapper@lijbrandt.nl> wrote:
Hi Cristian,
When I add the username, password,auth-method to a http-request [1] I get an improper use message from BaseX[2]. The message suggest a bug. I hope this helps solving it.
Kind regards,
Rob
[1]
http:send-request( <http:request method='post' username='admin' password='admin' auth-method='Basic' >
<http:body media-type='text/plain'/>
</http:request>
, 'http://LAPTOP-F17D4BIM:8984/test'
, "test"
)
[2]
Error:
Improper use? Potential bug? Your feedback is welcome:
Contact: basex-talk@mailman.uni-konstanz.de
Version: BaseX 9.5.3 beta
Java: Oracle Corporation, 1.8.0_271
OS: Windows 10, amd64
Stack Trace:
java.lang.IllegalStateException: Already connected
at sun.net.www.protocol.http.HttpURLConnection.setRequestProperty(Unknown Source)
at org.basex.util.http.HttpClient.setContentType(HttpClient.java:258)
at org.basex.util.http.HttpClient.sendRequest(HttpClient.java:82)
at org.basex.query.func.http.HttpSendRequest.value(HttpSendRequest.java:34)
at org.basex.query.expr.ParseExpr.iter(ParseExpr.java:46)
at org.basex.query.scope.MainModule.iter(MainModule.java:97)
at org.basex.query.QueryContext.iter(QueryContext.java:326)
at org.basex.query.QueryContext.cache(QueryContext.java:607)
at org.basex.query.QueryProcessor.cache(QueryProcessor.java:113)
at org.basex.core.cmd.AQuery.query(AQuery.java:99)
at org.basex.core.cmd.XQuery.run(XQuery.java:22)
at org.basex.core.Command.run(Command.java:257)
at org.basex.core.Command.execute(Command.java:93)
at org.basex.gui.GUI.exec(GUI.java:416)
at org.basex.gui.GUI.lambda$4(GUI.java:359)
at java.lang.Thread.run(Unknown Source)
Sent from Mail for Windows 10
Virus-free. www.avast.com
participants (2)
-
Christian Grün -
Rob Stapper