These are chat archives for SmingHub/Sming

4th
Mar 2016
Patrick Jahns
@patrickjahns
Mar 04 2016 02:29
@avr39-ripe
I am having trouble with the raw-body method. It seems that it only works if the first packet has headerdata and the body data. But if they are split (which quite often happens on my platform) it won`t save the body. I have a fix - but it will be related with my PR #622
Richard Antony Burton
@raburton
Mar 04 2016 07:49
@robotiko it's not duplication, i provided this to slaff to test before i released it
robotiko
@robotiko
Mar 04 2016 07:55
@raburton Thxs. Really cool stuff
alon24
@alon24
Mar 04 2016 09:35
I need to "help" my cousin build a car like mine, but they need it to be run with bt, which bt module works with sming?
Alexander V. Ribchansky
@avr39-ripe
Mar 04 2016 11:23

@patrickjahns
thanks to trigger the problem!! meanwhile just one remark:

  • if (request.getContentLength() > 0 && contType.indexOf(ContentType::FormUrlEncoded) != -1)
    • if (request.getContentLength() > 0 && request.getRequestMethod() == RequestMethod::POST)

As I understand this "if" purpose is for distinguish POST requests with FormUrlEncoded payload with other content-type, so in one case we process post data in other - just store raw request body.. May be I misunderstood your fix, but dosen't you just skip Formurlencoded content type chek?? instead you chek for method POST... how we decide do we need process post data as formurlencoded or just get it raw??

Patrick Jahns
@patrickjahns
Mar 04 2016 12:50

@avr39-ripe

in HttpRequest::parsePostData I check if the content-type is form encoded or not - if encoded parse it, otherwise save it - see HttpRequest.cpp Line185 onward...
I think the check can be nicer there - just needed a fix last night since it was driving me crazy while working on a angular application that posts data to my esp

I`d also would include a check if we received more data than content-length has specified. (in order to avoid buffer overflow in the end).
Any other suggestions/remarks?

Different question: how do you handle PRs that are based ontop of another PR? In this case the fix is based on #622. As will the post multipart mod of mine be
robotiko
@robotiko
Mar 04 2016 13:48
@alon24 there are bt links
that act like serial
example
Alexander V. Ribchansky
@avr39-ripe
Mar 04 2016 13:51
@patrickjahns ok, I understand you, no oter remarks by now.. I think you should submit PR and state, that PR #633 must be merged before new PR..
Patrick Jahns
@patrickjahns
Mar 04 2016 14:19
@avr39-ripe
Will do - if you don`t mind would you test it against your applications - it seemed that you used rawbody more
Alexander V. Ribchansky
@avr39-ripe
Mar 04 2016 14:20
@patrickjahns ok, I will for sure :) As soon as you make PR..
Patrick Jahns
@patrickjahns
Mar 04 2016 14:21
done :-) #631
Alexander V. Ribchansky
@avr39-ripe
Mar 04 2016 14:22
@patrickjahns yeah, I use rawbody in my apps, and think it is far better then Template + getPostParameter for esp - to - ui and ui -to -esp communication
alon24
@alon24
Mar 04 2016 14:23
@robotiko ok, ordering this now...
Thabks
Patrick Jahns
@patrickjahns
Mar 04 2016 14:26
@avr39-ripe
did you never experience the issue I mentioned?
Alexander V. Ribchansky
@avr39-ripe
Mar 04 2016 14:27
@patrickjahns no, so far.. but i think it is due to my jsons are small enough to fit into one packet.
Alexander V. Ribchansky
@avr39-ripe
Mar 04 2016 14:48
@patrickjahns seems like your fix do not hurt my app.. but have no test case with huge json, so post is split across packets
Patrick Jahns
@patrickjahns
Mar 04 2016 15:38
good to know that someone else can verify it works - I have one remark to myself - it would be better to return a pointer instead of the object right? (String* vs String) - that should save memory? - as far as I understand the tmpbufs lifetime ends after the delegate and before sending data right?
@avr39-ripe
I seem to experience this without large packets - it somehow always seems to me that chrome on windows split header and body into two seperate packets. Or at least it seems so on my sming implementation
(windows10, latest chrome)
Alexander V. Ribchansky
@avr39-ripe
Mar 04 2016 17:19
@patrickjahns I'm not a C/C++ guru either, but looks like @hreintke said String itself is char* inside..
Patrick Jahns
@patrickjahns
Mar 04 2016 18:21
Yes - I just wonder if returning creates a copy or not. Anyhow - got a different problem right now - working on porting the DNSServer from ESPARDUINO and wonder how to initialize the UDPCONNECTIOn onReceive with non-static
Alexander V. Ribchansky
@avr39-ripe
Mar 04 2016 18:44
@patrickjahns can you please tell purpose of DnsServer?
Patrick Jahns
@patrickjahns
Mar 04 2016 18:48
you can for example use it to create a captive portal
it`s a nice to have thing - nothing needed
But for a community project I like to make the setup easy - so why not include a captive portal
once your computer/smartphone connects - the user will be redirected to a certain page
Alexander V. Ribchansky
@avr39-ripe
Mar 04 2016 18:52
Aha.. I see.. yes, it's Very useful! No need to tell up etc..
no need to tell ip I mean..
Patrick Jahns
@patrickjahns
Mar 04 2016 22:05
New PR #633 with the DNS Captive feature ;-)
Now off to finalizing http multipart post - gives me headaches -_-
HappyCodingRobot
@HappyCodingRobot
Mar 04 2016 22:06
sounds great .. :)
not the headaches.. ;)