Okir
Okir

Reputation: 1

Pico W HTTP webserver lwip ssi tags not being recognized by make fsdata script

In the last few days, I've been programming on a Raspberry Pi Pico W project in which I'm trying to use a lwip web server to display the brightness of an led and the speed of a fan with an SSI tag. But when I'm using the makefsdata script provided by lwip, it does not seem to recognize these said SSI tags.

Here is the index.shtml code

<!DOCTYPE html>
<html>
    <head> 
        <title>PicoW Webserver</title> 
    </head>
    <body> 
    <h1>PicoW Webserver</h1>
        <br>
        <h2>This bit is SSI:</h2>
        <p>Led brightness: <!-- #led_brightness --> %</p>
        <p>Fan speed: <!-- #fan_speed --> %</p>
        <br>
        <h2>This bit is CGI:</h2>
        <a href="/led.cgi?led=1"><button>LED ON</button></a>
        <a href="/led.cgi?led=0"><button>LED OFF</button></a>
        <br>
        <br>
        <a href="/index.shtml">Refresh</a>
   </body>
</html>

Here are my lwiopts.h

#pragma once

// apparently needed...
// from: https://github.com/raspberrypi/pico-examples/blob/01e8128953a9766608be0a9254afb7900107e222/pico_w/lwipopts_examples_common.h
// allow override in some examples
#ifndef NO_SYS
#define NO_SYS                      1
#endif
// allow override in some examples
#ifndef LWIP_SOCKET
#define LWIP_SOCKET                 0
#endif
#if PICO_CYW43_ARCH_POLL
#define MEM_LIBC_MALLOC             1
#else
// MEM_LIBC_MALLOC is incompatible with non polling versions
#define MEM_LIBC_MALLOC             0
#endif
#define MEM_ALIGNMENT               4
#define MEM_SIZE                    4000
#define MEMP_NUM_TCP_SEG            32
#define MEMP_NUM_ARP_QUEUE          10
#define PBUF_POOL_SIZE              24
#define LWIP_ARP                    1
#define LWIP_ETHERNET               1
#define LWIP_ICMP                   1
#define LWIP_RAW                    1
#define TCP_WND                     (8 * TCP_MSS)
#define TCP_MSS                     1460
#define TCP_SND_BUF                 (8 * TCP_MSS)
#define TCP_SND_QUEUELEN            ((4 * (TCP_SND_BUF) + (TCP_MSS - 1)) / (TCP_MSS))
#define LWIP_NETIF_STATUS_CALLBACK  1
#define LWIP_NETIF_LINK_CALLBACK    1
#define LWIP_NETIF_HOSTNAME         1
#define LWIP_NETCONN                0
#define MEM_STATS                   0
#define SYS_STATS                   0
#define MEMP_STATS                  0
#define LINK_STATS                  0
// #define ETH_PAD_SIZE                2
#define LWIP_CHKSUM_ALGORITHM       3
#define LWIP_DHCP                   1
#define LWIP_IPV4                   1
#define LWIP_TCP                    1
#define LWIP_UDP                    1
#define LWIP_DNS                    1
#define LWIP_TCP_KEEPALIVE          1
#define LWIP_NETIF_TX_SINGLE_PBUF   1
#define DHCP_DOES_ARP_CHECK         0
#define LWIP_DHCP_DOES_ACD_CHECK    0

#ifndef NDEBUG
#define LWIP_DEBUG                  1
#define LWIP_STATS                  1
#define LWIP_STATS_DISPLAY          1
#endif

#define LWIP_HTTPD 1
#define LWIP_HTTPD_SSI 1
#define LWIP_HTTPD_CGI 1
// don't include the tag comment - less work for the CPU, but may be harder to debug
#define LWIP_HTTPD_SSI_INCLUDE_TAG 0
// use generated fsdata
#define HTTPD_FSDATA_FILE "my_fsdata.c"

And here is the output I'm seeing on the website output on the website

  1. I tried renaming the ssi tags expecting some letters I was using weren't allowed
  2. I tried another fsdata script written in Python thinking, that maybe the makefsdata script couldn't handle SSI tags

Upvotes: 0

Views: 276

Answers (1)

Tom
Tom

Reputation: 1

lwip limits the ssi labels to 8 characters by default. I am not certain that limit can be changed. So try cutting down #led_brightness to #led_brt for example.

Upvotes: 0

Related Questions