Re: [Owfs-developers] owhttpd / JSONP / Cross-Origin Resource Sharing (CORS)

2014-03-24 Thread Michael Markstaller
On 21.03.2014 19:49, Paul Alfille wrote: Applied. Thanks. Thanks Paul! While doing further tests (and writing a demo-page as promised with jQuery and jQGrid which is pretty cool ;)) I found another problem which creates invalid JSON (jsonlint.com, jQuery also bails out..): owhttpd_read.c:

Re: [Owfs-developers] owhttpd / JSONP / Cross-Origin Resource Sharing (CORS)

2014-03-24 Thread Michael Markstaller
Addition: I cannot imagine anyone is able to use the JSON-API with 9.2p2, we could also break it I think, comments welcome ;) Another workaround I found afterwards without CORS would be to include load a JS with a static callback-function from owhttpd withing the calling site/page; implemented

Re: [Owfs-developers] owhttpd / JSONP / Cross-Origin Resource Sharing (CORS)

2014-03-24 Thread Paul Alfille
The 404 html output was simply a bug -- now fixed in the CVS version (free-ing the bad commend-line string before searching for json to decide which error output to produce). The trailing comma shouldn't be hard to fix either. Paul On Mon, Mar 24, 2014 at 11:13 AM, Michael Markstaller

Re: [Owfs-developers] owhttpd / JSONP / Cross-Origin Resource Sharing (CORS)

2014-03-21 Thread Michael Markstaller
On 21.03.2014 02:05, Paul Alfille wrote: What's the error page that's being discussed? Can you outline a command sequence that triggers it so I can investigate? Thanks, Paul Whenever a non-existing path is selected, it looks like in owhttpd_handler.c ct_json / ct_text is disregarded and

Re: [Owfs-developers] owhttpd / JSONP / Cross-Origin Resource Sharing (CORS)

2014-03-21 Thread Paul Alfille
Applied. Thanks. On Fri, Mar 21, 2014 at 10:11 AM, Michael Markstaller m...@elabnet.de wrote: On 21.03.2014 02:05, Paul Alfille wrote: What's the error page that's being discussed? Can you outline a command sequence that triggers it so I can investigate? Thanks, Paul Whenever a

Re: [Owfs-developers] owhttpd / JSONP / Cross-Origin Resource Sharing (CORS)

2014-03-20 Thread Michael Markstaller
- Now first of all, I'd submit a patch to fix /json outputting valid JSON-Data. This would change the current behavior i.e.: single elements: { value : 11.5 } instead of 11.5 I'd opt for [ 11.5 ] (unnamed array) for single values.. The change is really trivial, just add [] -

Re: [Owfs-developers] owhttpd / JSONP / Cross-Origin Resource Sharing (CORS)

2014-03-20 Thread Roberto Spadim
2014-03-20 13:45 GMT-03:00 Michael Markstaller m...@elabnet.de: - Now first of all, I'd submit a patch to fix /json outputting valid JSON-Data. This would change the current behavior i.e.: single elements: { value : 11.5 } instead of 11.5 I'd opt for [ 11.5 ]

Re: [Owfs-developers] owhttpd / JSONP / Cross-Origin Resource Sharing (CORS)

2014-03-20 Thread Michael Markstaller
On 20.03.2014 18:11, Roberto Spadim wrote: 2014-03-20 13:45 GMT-03:00 Michael Markstaller m...@elabnet.de mailto:m...@elabnet.de: - Now first of all, I'd submit a patch to fix /json outputting valid JSON-Data. This would change the current behavior i.e.: single elements:

Re: [Owfs-developers] owhttpd / JSONP / Cross-Origin Resource Sharing (CORS)

2014-03-20 Thread Roberto Spadim
nice :) the error page i don't remember what i done and how it work, must check with paul :/ 2014-03-20 16:00 GMT-03:00 Michael Markstaller m...@elabnet.de: On 20.03.2014 18:11, Roberto Spadim wrote: 2014-03-20 13:45 GMT-03:00 Michael Markstaller m...@elabnet.de mailto:m...@elabnet.de:

Re: [Owfs-developers] owhttpd / JSONP / Cross-Origin Resource Sharing (CORS)

2014-03-20 Thread Paul Alfille
What's the error page that's being discussed? Can you outline a command sequence that triggers it so I can investigate? Thanks, Paul On Thu, Mar 20, 2014 at 6:35 PM, Roberto Spadim robe...@spadim.com.brwrote: nice :) the error page i don't remember what i done and how it work, must check

Re: [Owfs-developers] owhttpd / JSONP / Cross-Origin Resource Sharing (CORS)

2014-03-20 Thread Roberto Spadim
for example when you request a /asdfasdf/wj234ksdsfsdf at owhttp, the html error page is returned (i don't remember i'm not with source here, but i htink that's the error page) 2014-03-20 22:05 GMT-03:00 Paul Alfille paul.alfi...@gmail.com: What's the error page that's being discussed? Can you

Re: [Owfs-developers] owhttpd / JSONP / Cross-Origin Resource Sharing (CORS)

2014-03-19 Thread Michael Markstaller
Thanks Colin, but you missed the topic a little ;) There simply is no Apache ;) I already do it a similar way and record stuff in RRDs and want to speed it up without changing the Webserver.. Michael On 19.03.2014 00:45, Colin Reese wrote: Databases are NOT useless! Besides all the data

Re: [Owfs-developers] owhttpd / JSONP / Cross-Origin Resource Sharing (CORS)

2014-03-19 Thread Michael Markstaller
On 19.03.2014 00:44, Roberto Spadim wrote: something like this? |//JSON - instead of: {name:stackoverflow,id:5} //JSONP - return : func({name:stackoverflow,id:5});| Yes, exactly. I think a static callback-function like owhttp_callback({data ..}); would do the job.. While playing around

Re: [Owfs-developers] owhttpd / JSONP / Cross-Origin Resource Sharing (CORS)

2014-03-19 Thread Roberto Spadim
Hummm well all you need is owhttp.c file all json things are there add a new jsonp directory and start a nde patch :) Em quarta-feira, 19 de março de 2014, Michael Markstaller m...@elabnet.de escreveu: On 19.03.2014 00:44, Roberto Spadim wrote: something like this? |//JSON - instead of:

Re: [Owfs-developers] owhttpd / JSONP / Cross-Origin Resource Sharing (CORS)

2014-03-19 Thread Roberto Spadim
i don't know if we have the patch of json, maybe that's a nice start point for you owhttp is very easy to understand :) 2014-03-19 12:44 GMT-03:00 Paul Alfille paul.alfi...@gmail.com: Send a patch. We'll include it. On Wed, Mar 19, 2014 at 9:44 AM, Roberto Spadim robe...@spadim.com.brwrote:

Re: [Owfs-developers] owhttpd / JSONP / Cross-Origin Resource Sharing (CORS)

2014-03-19 Thread Paul Alfille
Send a patch. We'll include it. On Wed, Mar 19, 2014 at 9:44 AM, Roberto Spadim robe...@spadim.com.brwrote: Hummm well all you need is owhttp.c file all json things are there add a new jsonp directory and start a nde patch :) Em quarta-feira, 19 de março de 2014, Michael Markstaller

Re: [Owfs-developers] owhttpd / JSONP / Cross-Origin Resource Sharing (CORS)

2014-03-19 Thread Michael Markstaller
Ok, I'm struggling mainly with the JSONP/Client-side, owhttpd is easy to understand all fine.. (although adding commandline-parameters - see below might require some help) - Now first of all, I'd submit a patch to fix /json outputting valid JSON-Data. This would change the current behavior

[Owfs-developers] owhttpd / JSONP / Cross-Origin Resource Sharing (CORS)

2014-03-18 Thread Michael Markstaller
Hi, did anybody already do something asking owhttp (JSON) from within another Site (same host, another port - which Same-Origin-Policy disallows)? The Basics are clear, CORS or JSONP, just don't want to re-invent the wheel ;) Michael P.S.: I'm just changing some old stuff and want to avoid

Re: [Owfs-developers] owhttpd / JSONP / Cross-Origin Resource Sharing (CORS)

2014-03-18 Thread Roberto Spadim
i use text/ and parse everything with javascript that's a single text but you can use json/ too 2014-03-18 13:37 GMT-03:00 Michael Markstaller m...@elabnet.de: Hi, did anybody already do something asking owhttp (JSON) from within another Site (same host, another port - which

Re: [Owfs-developers] owhttpd / JSONP / Cross-Origin Resource Sharing (CORS)

2014-03-18 Thread Colin Reese
I puts it in a sqlite database using python and then grab it from there using jQuery/js On Tue, Mar 18, 2014 at 9:51 AM, Roberto Spadim robe...@spadim.com.brwrote: i use text/ and parse everything with javascript that's a single text but you can use json/ too 2014-03-18 13:37 GMT-03:00

Re: [Owfs-developers] owhttpd / JSONP / Cross-Origin Resource Sharing (CORS)

2014-03-18 Thread Michael Markstaller
Thats exactly the overhead I want to avoid like owserver-owget/ownet-sql-CGI-Client Doing this with - let's say 50 sensors - every 10sec produces a bunch of useless load where the client only needs it once a week for 2h.. Michael On 18.03.2014 18:20, Colin Reese wrote: I puts it in a sqlite

Re: [Owfs-developers] owhttpd / JSONP / Cross-Origin Resource Sharing (CORS)

2014-03-18 Thread Roberto Spadim
50/10 = 5 sensors/second, that's near 0bytes/second hehe i don't see a big overhead in this scenario, maybe with 100 users, but with more than 1000+ users, i prefer a sql server, not a sqlite database, with cache, etc etc... 2014-03-18 14:42 GMT-03:00 Michael Markstaller m...@elabnet.de:

Re: [Owfs-developers] owhttpd / JSONP / Cross-Origin Resource Sharing (CORS)

2014-03-18 Thread Colin Reese
I'm not sure who this was directed to. Polling and data management: owserver--owpython--sqlite User interface: sqlite--wsgi/ajax--json--jQuery/js Wsgi is very fast. I have used cgi and it is quite slow in comparison. I'm not really sure the overhead you are speaking of, if you are comparing

Re: [Owfs-developers] owhttpd / JSONP / Cross-Origin Resource Sharing (CORS)

2014-03-18 Thread Michael Markstaller
It was directed at Roberto using owhttpd/text; I'll explain a little: I have a Webmin (Perl, Port :1) Interface which uses a Perl-CGI to get/refresh values via OWNet/Ajax. It works but it's dead slow and - depending on the refresh-interval and sensorcount - nearly kills the server. I cannot

Re: [Owfs-developers] owhttpd / JSONP / Cross-Origin Resource Sharing (CORS)

2014-03-18 Thread Michael Markstaller
After some hours of investigation, I think implementing JSONP (again, note the P!) in owhttpd looks like the best solution(?) This would IMHO also be useful for some other solutions maybe to avoid useless workarounds like writing DB's and then query the same.. I'm willing to try do it (though

Re: [Owfs-developers] owhttpd / JSONP / Cross-Origin Resource Sharing (CORS)

2014-03-18 Thread Roberto Spadim
could you explain it better, for example, write a directory with /text, /json and /jsonp to see what change, and what should be implemented, it's easier to understand, since i don't understand the P part 2014-03-18 20:17 GMT-03:00 Michael Markstaller m...@elabnet.de: After some hours of

Re: [Owfs-developers] owhttpd / JSONP / Cross-Origin Resource Sharing (CORS)

2014-03-18 Thread Roberto Spadim
something like this? //JSON - instead of:{name:stackoverflow,id:5}//JSONP - return : func({name:stackoverflow,id:5}); 2014-03-18 20:39 GMT-03:00 Roberto Spadim robe...@spadim.com.br: could you explain it better, for example, write a directory with /text, /json and /jsonp to see what change,

Re: [Owfs-developers] owhttpd / JSONP / Cross-Origin Resource Sharing (CORS)

2014-03-18 Thread Colin Reese
Databases are NOT useless! Besides all the data enforcement, I want to plot things and store logs and variables. This is a silly thing to say. If you are firmly against storing any data, for any reason, take the following boilerplate ajax call (in your web page): function showMeData(data) {

Re: [Owfs-developers] owhttpd / JSONP / Cross-Origin Resource Sharing (CORS)

2014-03-18 Thread Colin Reese
In order for jsonp to work, you'd have to get httpd on a port that would make it through whatever gateway devices you plan on routing it through. You could probably do this on 88, although jsonp must have provision for this, which I don't know for sure. Colin On Tue, Mar 18, 2014 at 4:39 PM,

Re: [Owfs-developers] owhttpd / JSONP / Cross-Origin Resource Sharing (CORS)

2014-03-18 Thread Colin Reese
I also have to imagine this would raise security red flags wherever it goes. Colin On Tue, Mar 18, 2014 at 4:48 PM, Colin Reese colin.re...@gmail.com wrote: In order for jsonp to work, you'd have to get httpd on a port that would make it through whatever gateway devices you plan on routing