parallaxinc / Simple-Libraries

Contents of the SimpleIDE workspace folder and its Parallax Learn Simple Libraries subfolder.
http://learn.parallax.com/propeller-c-set-simpleide/update-your-learn-folder
21 stars 21 forks source link

wifi_print(TCP...,string) only works with string allocated to wifi_buffer #173

Open AndyLindsay opened 6 years ago

AndyLindsay commented 6 years ago

If you try to pass a different string, it is not populated with the response.

AndyLindsay commented 6 years ago

Partially addressed with documentation and example code updates in v1.4.88 Update wifi_scan(TCP... docs

AndyLindsay commented 6 years ago

Check how common content-length is in headers. If common, then add function to deliver only content.

AndyLindsay commented 6 years ago

Hmmm, this actually looks pretty doable...

zfi commented 6 years ago

A word of caution regarding character sets as it relates to the content-length header. If the character set is multi-byte, such as UTF-8, the value in the content-length will be under reported.

Details can be found here and here.

AndyLindsay commented 6 years ago

Got it. Thank you!

On Fri, Jul 6, 2018 at 1:15 PM, Jim Ewald notifications@github.com wrote:

A word of caution regarding character sets as it relates to the content-length header. If the character set is multi-byte, such as UTF-8, the value in the content-length will be under reported.

Details can be found here https://sankhs.com/2016/03/17/content-length-http-headers/ and here https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Length .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/parallaxinc/Simple-Libraries/issues/173#issuecomment-403135646, or mute the thread https://github.com/notifications/unsubscribe-auth/ALCgd1aX0QWfZB54Sd5Vg6qcxNlAR-aOks5uD8VIgaJpZM4VE0bB .

AndyLindsay commented 6 years ago

This should help: int wifi_getNamedValue(char strSource, char strName, char *fmt, ...);

Usage example on line 102 in Dev branch's Temperature from OpenWeatherMap.

    float temp = 0;
    wifi_getNamedValue(str, "temp", "%f", &temp);
    print("temp = %6.2f deg K\r", temp);