HTTP client with RTEMS

Christian Mauderer list at c-mauderer.de
Thu Oct 5 18:47:41 UTC 2017


Am 05.10.2017 um 17:52 schrieb Hui Yie Teh:
> Hi,
> 
> I am trying to build a HTTP client using RTEMS. Is there any tutorials
> that I can follow? I already have a server running, and I just need to
> send some GET and POST requests.
> 
> I am new to RTEMS and embedded programming in general. Any help is much
> appreciated.
> 
> Cheers,
> Yie
> 

Hello Yie,

it depends a little on your application.

If you just want to learn a little about the HTTP protocol and only want
to try some requests, you can just use a raw socket. The HTTP basics are
really quite simple if you don't want to use things like compression or
different MIME types. Writing a simple request for some simple html
document is quite easy. Something like that is done in the test for the
mghttpd in RTEMS:

    https://git.rtems.org/rtems/tree/testsuites/libtests/mghttpd01

Note that there are most likely a lot of error cases that are not caught
in that test (like unexpected HTTP responses).

If you need your client for some more professional application or
something that should be more robust, I would suggest to use some
library that does most of the low level handling. I'm not aware of one
integrated into RTEMS but it shouldn't be hard to find one that works.

I think that I have seen some client functions in civetweb (still
MIT-licensed fork of mongoose httpd which has been forked off before the
license change in mongoose). From my experience, civetweb needs only
very few modifications to work with RTEMS.

Most likely you can also (with some more effort) compile some bigger C
or C++ libraries like libcurl. But I haven't tried that yet. By the way:
there is also a large list of http client libraries on the libcurl
Homepage: https://curl.haxx.se/libcurl/competitors.html

Regards

Christian



More information about the users mailing list