mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-01-12 12:45:35 +00:00
httpd makefsdata: make http response server string configurable via command line, tiny fixes to usage and command interpretation
This commit is contained in:
parent
076f1ee89e
commit
5d9f59daa4
@ -60,7 +60,7 @@ tdefl_compressor g_deflator;
|
||||
tinfl_decompressor g_inflator;
|
||||
|
||||
int deflate_level = 10; /* default compression level, can be changed via command line */
|
||||
#define USAGE_ARG_DEFLATE " [-defl]"
|
||||
#define USAGE_ARG_DEFLATE " [-defl<:compr_level>]"
|
||||
#else /* MAKEFS_SUPPORT_DEFLATE */
|
||||
#define USAGE_ARG_DEFLATE ""
|
||||
#endif /* MAKEFS_SUPPORT_DEFLATE */
|
||||
@ -117,6 +117,7 @@ int deflate_level = 10; /* default compression level, can be changed via command
|
||||
|
||||
/** (Your server name here) */
|
||||
const char *serverID = "Server: "HTTPD_SERVER_AGENT"\r\n";
|
||||
char serverIDBuffer[1024];
|
||||
|
||||
/* change this to suit your MEM_ALIGNMENT */
|
||||
#define PAYLOAD_ALIGNMENT 4
|
||||
@ -169,7 +170,7 @@ struct file_entry* last_file = NULL;
|
||||
|
||||
static void print_usage(void)
|
||||
{
|
||||
printf(" Usage: htmlgen [targetdir] [-s] [-i] [-f:<filename>] [-m]" USAGE_ARG_DEFLATE NEWLINE NEWLINE);
|
||||
printf(" Usage: htmlgen [targetdir] [-s] [-e] [-i] [-11] [-nossi] [-c] [-f:<filename>] [-m] [-svr:<name>]" USAGE_ARG_DEFLATE NEWLINE NEWLINE);
|
||||
printf(" targetdir: relative or absolute path to files to convert" NEWLINE);
|
||||
printf(" switch -s: toggle processing of subdirectories (default is on)" NEWLINE);
|
||||
printf(" switch -e: exclude HTTP header from file (header is created at runtime, default is off)" NEWLINE);
|
||||
@ -178,8 +179,9 @@ static void print_usage(void)
|
||||
printf(" switch -c: precalculate checksums for all pages (default is off)" NEWLINE);
|
||||
printf(" switch -f: target filename (default is \"fsdata.c\")" NEWLINE);
|
||||
printf(" switch -m: include \"Last-Modified\" header based on file time" NEWLINE);
|
||||
printf(" switch -svr: server identifier sent in HTTP response header ('Server' field)" NEWLINE);
|
||||
#if MAKEFS_SUPPORT_DEFLATE
|
||||
printf(" switch -defl: deflate-compress all non-SSI files" NEWLINE);
|
||||
printf(" switch -defl: deflate-compress all non-SSI files (with opt. compr.-level, default=10)" NEWLINE);
|
||||
printf(" ATTENTION: browser has to support \"Content-Encoding: deflate\"!" NEWLINE);
|
||||
#endif
|
||||
printf(" if targetdir not specified, htmlgen will attempt to" NEWLINE);
|
||||
@ -210,23 +212,27 @@ int main(int argc, char *argv[])
|
||||
continue;
|
||||
}
|
||||
if (argv[i][0] == '-') {
|
||||
if (strstr(argv[i], "-s")) {
|
||||
if (strstr(argv[i], "-svr:") == argv[i]) {
|
||||
snprintf(serverIDBuffer, sizeof(serverIDBuffer), "Server: %s\r\n", &argv[i][5]);
|
||||
serverID = serverIDBuffer;
|
||||
printf("Using Server-ID: \"%s\"\n", serverID);
|
||||
} else if (strstr(argv[i], "-s") == argv[i]) {
|
||||
processSubs = 0;
|
||||
} else if (strstr(argv[i], "-e")) {
|
||||
} else if (strstr(argv[i], "-e") == argv[i]) {
|
||||
includeHttpHeader = 0;
|
||||
} else if (strstr(argv[i], "-11")) {
|
||||
} else if (strstr(argv[i], "-11") == argv[i]) {
|
||||
useHttp11 = 1;
|
||||
} else if (strstr(argv[i], "-nossi")) {
|
||||
} else if (strstr(argv[i], "-nossi") == argv[i]) {
|
||||
supportSsi = 0;
|
||||
} else if (strstr(argv[i], "-c")) {
|
||||
} else if (strstr(argv[i], "-c") == argv[i]) {
|
||||
precalcChksum = 1;
|
||||
} else if((argv[i][1] == 'f') && (argv[i][2] == ':')) {
|
||||
} else if (strstr(argv[i], "-f:") == argv[i]) {
|
||||
strncpy(targetfile, &argv[i][3], sizeof(targetfile) - 1);
|
||||
targetfile[sizeof(targetfile) - 1] = 0;
|
||||
printf("Writing to file \"%s\"\n", targetfile);
|
||||
} else if (strstr(argv[i], "-m")) {
|
||||
} else if (strstr(argv[i], "-m") == argv[i]) {
|
||||
includeLastModified = 1;
|
||||
} else if (strstr(argv[i], "-defl")) {
|
||||
} else if (strstr(argv[i], "-defl") == argv[i]) {
|
||||
#if MAKEFS_SUPPORT_DEFLATE
|
||||
char* colon = strstr(argv[i], ":");
|
||||
if (colon) {
|
||||
|
Loading…
Reference in New Issue
Block a user