lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] socket-based HTTP server


From: address@hidden
Subject: Re: [lwip-users] socket-based HTTP server
Date: Thu, 2 Apr 2020 20:26:20 +0200
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0

Am 01.04.2020 um 09:40 schrieb Marco Lazzaroni:
> Hi all,
> sorry for such a basic question. I've developed an application based on
> the raw API, then I had to integrate an RTOS and I had to switch to a
> socket based API.

You can continue using the callback API when using an OS, you just have
to make sure you only call into lwIP core functions from tcpip_thread or
surrounded by LOCK_TCPIP_CORE()/UNLOCK_TCPIP_CORE().

> To my understanding, the raw API based http server is run by code in
> lwip/src/apps/http/httpd.c.
> For the socket API, I started from
> lwip/contrib/apps/httpserver/httpserver-netconn.c and I wrote
> httpserver-socket.c making some obvious changes.

httpserver-netconn.c has *nothing* to do with the callback version
(httpd.c).

> Well, it works and it's quite stable, but now I need to implement CGI /
> SSI functionality in order to show the value of some variables.  I also
> need to import HTTP POST functionality that already worked with the raw API.
> I suppose that the code in httpd.c is not directly usable because it is
> for the raw API (correct?).
> I'm starting porting it to socket version by hand; i.e. I'm taking some
> pieces of http_parse_request() in order to parse the HTTP request, to
> get the URI, the HTTP/1.1 (or 0.9) string and so on.
> Anyway I'm asking myself if I have searched enough: is there something I
> can reuse for my purposes in the lwip tree? Or even outside it, being
> the socket API a standard, is there something reusable for an embedded
> web server?

There should be enough socket-based http servers in the net. That's why
we didn't invent yet another one.

Regards,
Simon



reply via email to

[Prev in Thread] Current Thread [Next in Thread]