Closed niccokunzmann closed 5 years ago
@niccokunzmann This is an upstream issue, which also has been fixed with the jsoninfo plugin 1.1.
- Why are there no headers?
I don't know, but it is probably one of the reasons for creating a new version of the plugin
- Can you confirm this on your devices?
This affects all routers with plugin version 0.0
- How to go about debugging this?
Since this has been fixed upstream, I don't see the need to focus any effort on it.
The OLSR Status app for Luci seems to be able to read in the JSON data just fine. The code which works with plugin 0.0 is here https://github.com/openwrt/luci/tree/lede-17.01/applications/luci-app-olsr/luasrc/view/status-olsr
The OLSR Status app has been updated to work with plugin 1.1 https://github.com/openwrt/luci/tree/master/applications/luci-app-olsr/luasrc/view/status-olsr
If you write your planned map code in lua, it should be relatively easy to borrow from the existing code to scrape out the information you need.
Thanks for replying. That gave me new ideas!
Found the solution here:
https://github.com/OLSR/olsrd/blob/v0.9.0.3/lib/jsoninfo/src/olsrd_jsoninfo.c#L1377
if (http_headers) {
https://github.com/OLSR/olsrd/blob/v0.9.0.3/lib/jsoninfo/src/olsrd_plugin.c#L137
{ .name = "httpheaders", .set_plugin_parameter = &store_boolean, .data = &http_headers }, //
To enable http headers for the JSON Plugin of OLSR,
ssh root@frei.funk
vi /etc/config/olsrd
i
) the line option httpheaders 'yes'
in this file at the configuration of the JSONPlugin. My part of the file looks like this:
config LoadPlugin
option accept '0.0.0.0'
option library 'olsrd_jsoninfo.so.0.0'
option ignore '0'
option httpheaders 'yes'
reboot
Now, you should be able to enjoy HTTP headers! http://frei.funk:9090/config
HTTP/1.1 200 OK
Date: Wed, 03 Apr 2019 12:32:57 GMT
Server: OLSRD JSONInfo plugin
Connection: closed
Content-type: application/json
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, OPTIONS
Access-Control-Allow-Headers: Accept, Origin, X-Requested-With
Access-Control-Max-Age: 1728000
Content-length: 3126
Cache-Control: no-cache
Anleitung auf Deutsch: http://freifunkkarte.quelltext.eu/enable-headers.html Dank, das das entstanden ist: https://github.com/niccokunzmann/freifunk-berlin-offline-status-website
When I access http://10.22.254.111:9090/version then I would like to see the CORS headers - or at least any header.
Source code of olsrd jsoninfo plugin at 0.9.0.3.
However, there are NO headers present, not event Content-Length!
Even Firefox does not show any headers.