Wget and sendHttpGetRequest (empty) response differend?

Setup:
Release = Raspbian GNU/Linux 11 (bullseye)
Kernel = Linux 6.1.21-v8+
Platform = Raspberry Pi 4 Model B Rev 1.5
openHAB 4.3.1 - Release Build

I use a rule with sendHttpGetRequest to get information from judo server.
Since 10 day the rule don’t run because the answer of the request is empty!
I havent made a update and it is no update problem (I think so)

I use following statement im my rule
var String json = sendHttpGetRequest ( “https://www.myjudo.eu/interface/?group=register&command=login&name=login&user=NAME&password=MD5hash&role=customer” )
NAME and MD5hash not real of course!; The result is “”

Same as a test with WGET
wget -O test.txt “https://www.myjudo.eu/interface/?group=register&command=login&name=login&user=N
AME&password=MD5hash&role=customer”
Contents of test.txt is {“status”:“error”,“data”:“Login fehlgeschlagen”}

What I am doing wrong? Or have to change?
Before 12/20/24 ist runs???

Regards Burkhard

This is my temporary solution
var String json = executeCommandLine ( Duration.ofSeconds(2), “wget”, “-nv”, “-O-”, “https://www.myjudo.eu/interface/?group=register&command=login&name=login&user=NAME&password=MD5hash&role=customer" )
It is quit rusty and not my kind :frowning:
I’m still looking to the correct solution …

I can confirm this and I think I have encountered this recently too.

I found that this issue also occurred in openHAB 4.2.3.

I am not familiar with Jetty client library and its idiosyncrasies, but I suspect it doesn’t handle the Upgrade: h2 header that the server is sending back. It returns status 200 without following up on the upgrade header.

I’m not sure if this is something that can/need to be fixed within openHAB (maybe it is, but I’m not knowledgeable enough about it / Jetty, and I haven’t dug deeper).
The current Jetty client in use in openHAB is old, and an upgrade to a newer version is not imminent. See discussion here: Upgrade to Jetty 10.x (or Jetty 11.x) · Issue #3315 · openhab/openhab-core · GitHub

You can continue using your current approach of calling wget. The other solution I can offer is using JRuby, because it has its own HTTP client implementation.

In JRuby, your code would look like this:

json = Net::HTTP.get(URI("https://www.myjudo.eu/interface/?group=register&command=login&name=login&user=NAME&password=MD5hash&role=customer"))
logger.info json

If you need help in converting your entire script, I’ll be happy to offer assistance.

Thx for your help and the background infos :slight_smile:
I’ll stick with wget and wait for Jetty 10.x …

Maybe the following PR will have fixed it? Although that PR is aimed at the Jetty server rather than the Jetty client…

I doubt it. It seems unrelated, like you said.

To solve this issue, either something needs to be tweaked inside HttpUtil.java, or Jetty client itself doesn’t support it (or a bug?), although I’d be surprised if that were the case. http/2 isn’t super new.

A-ha! Just as I was writing the above post… something just came to me. It could be server-side filtering!

@BitBroker This code works:

      val headers = newHashMap("User-Agent" -> "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36 Edg/130.0.0.0")
      val json = sendHttpGetRequest("https://www.myjudo.eu/interface/?group=register&command=login&name=login&user=NAME&password=MD5hash&role=customer", headers, 5000)
      logInfo("XX", "json: {}", json)

@jimtng
Brilliant, that’s exactly the solution I was looking for!
I didn’t really understand what was causing it, but it works great!