OH2.2 - sendHttpGetRequest(URL)

I installed the very new OH 2.2 for just a couple of minutes and launch the OPENHAB2 service.

I was surprised to have a HTTP Parser issue since it was working very well in OH 2.1.

11:25:04.013 [WARN ] [org.eclipse.jetty.http.HttpParser    ] - Illegal character 0x20 in state=HEADER_IN_NAME for buffer DirectByteBuffer@552496[p=140,l=395,c=16384,r=255]={HTTP/1.1 200 OK\r\n...lose\r\nHTTP/1.1 <<<200 OK\r\nAccess-Co...ion: close\r\n\r\n{>>>": 20, "levee_oeu...\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00}
11:25:04.154 [WARN ] [org.eclipse.jetty.http.HttpParser    ] - bad HTTP parsed: 400 Illegal character 0x20 for HttpReceiverOverHTTP@529ea(rsp=HEADER,failure=null)[HttpParser{s=HEADER_IN_NAME,0 of 0}]
11:25:04.261 [ERROR] [e.smarthome.model.script.actions.HTTP] - Fatal transport error: java.util.concurrent.ExecutionException: org.eclipse.jetty.client.HttpResponseException: HTTP protocol violation: bad response on HttpConnectionOverHTTP@15d7f3a(l:/ <-> r:/,closed=false)[HttpChannelOverHTTP@1139b10(exchange=HttpExchange@1eeb560 req=TERMINATED/null@null res=PENDING/null@null)[send=HttpSenderOverHTTP@4b934e(req=QUEUED,snd=COMPLETED,failure=null)[HttpGenerator@ef9092{s=START}],recv=HttpReceiverOverHTTP@529ea(rsp=HEADER,failure=null)[HttpParser{s=CLOSE,0 of 0}]]]

As we can see, the space caracter (’ ') is mention illegal but the HTTP response is valid (HTTP/1.1 200 OK).

Whitch space caracter could be illegal ?

Non surprisely, Firefox is able to decode the HTTP answer as a real JSON string

{"Loc": 1513679169, "Lev": 1513667760, "Couch": 1513697940, "Last_MAJ": 1513638050, "Decal_Lev": 20, "Decal_Couch": 20, "levee_oeufs": 1511248398, "CurTemp": 5, "CurHum": 44, "MaxTemp": 6, "MinTemp": 2, "MaxHum": 46, "MinHum": 44, "Doorpos": 1, "Status_err_1": 0, "Time_err1": 1513623668, "Status_err_2": 0, "Time_err2": 1512935641, "Status_err_3": 0, "Time_err3": 0}

And rule hasn’t change :

        var String URL= ""
        var String json = sendHttpGetRequest(URL)
        var DateTime time_HLOC = new DateTime(new Integer(transform("JSONPATH", "$.Loc", json))*1000L)

Is this a new issue on OH2.2 ? or any other ideas ?

It sure looks like a regression. I’d file an issue on the Eclipse SmartHome repo.

Thank you but hummm… not sure !

Here the header from Firefox.


It seems the I have 3 times connection close and server type.

Indeed, after cheking the teensy sketch it was sending the header several times.

So it was a bug on my side but the new OH2.2 is not as tolerant as the previous release.

That in and of itself is probably worth filing an issue on.