httpd: fix the names of some global variables

This commit is contained in:
goldsimon 2017-12-18 20:01:24 +01:00
parent db68c6df6a
commit 2505c6019e

View File

@ -151,7 +151,7 @@ typedef struct {
u8_t shtml;
} default_filename;
static const default_filename g_psDefaultFilenames[] = {
static const default_filename httpd_default_filenames[] = {
{"/index.shtml", 1 },
{"/index.ssi", 1 },
{"/index.shtm", 1 },
@ -159,7 +159,7 @@ static const default_filename g_psDefaultFilenames[] = {
{"/index.htm", 0 }
};
#define NUM_DEFAULT_FILENAMES LWIP_ARRAYSIZE(g_psDefaultFilenames)
#define NUM_DEFAULT_FILENAMES LWIP_ARRAYSIZE(httpd_default_filenames)
#if LWIP_HTTPD_SUPPORT_REQUESTLIST
/** HTTP request is copied here from pbufs for simple parsing */
@ -310,23 +310,23 @@ static void http_continue(void *connection);
#if LWIP_HTTPD_SSI
/* SSI insert handler function pointer. */
static tSSIHandler g_pfnSSIHandler;
static tSSIHandler httpd_ssi_handler;
#if !LWIP_HTTPD_SSI_RAW
static int g_iNumTags;
static const char **g_ppcTags;
static int httpd_num_tags;
static const char **httpd_tags;
#endif /* !LWIP_HTTPD_SSI_RAW */
#define LEN_TAG_LEAD_IN 5
static const char *const g_pcTagLeadIn = "<!--#";
static const char httpd_tag_lead_in[] = "<!--#";
#define LEN_TAG_LEAD_OUT 3
static const char *const g_pcTagLeadOut = "-->";
static const char httpd_tag_lead_out[] = "-->";
#endif /* LWIP_HTTPD_SSI */
#if LWIP_HTTPD_CGI
/* CGI handler information */
static const tCGI *g_pCGIs;
static int g_iNumCGIs;
static const tCGI *httpd_cgis;
static int httpd_num_cgis;
static int http_cgi_paramcount;
#define http_cgi_params hs->params
#define http_cgi_param_vals hs->param_vals
@ -770,9 +770,9 @@ get_tag_insert(struct http_state *hs)
tag = ssi->tag_name;
#endif
if (g_pfnSSIHandler
if (httpd_ssi_handler
#if !LWIP_HTTPD_SSI_RAW
&& g_ppcTags && g_iNumTags
&& httpd_tags && httpd_num_tags
#endif /* !LWIP_HTTPD_SSI_RAW */
) {
@ -780,11 +780,11 @@ get_tag_insert(struct http_state *hs)
#if LWIP_HTTPD_SSI_RAW
{
#else /* LWIP_HTTPD_SSI_RAW */
for (tag = 0; tag < g_iNumTags; tag++) {
if (strcmp(ssi->tag_name, g_ppcTags[tag]) == 0)
for (tag = 0; tag < httpd_num_tags; tag++) {
if (strcmp(ssi->tag_name, httpd_tags[tag]) == 0)
#endif /* LWIP_HTTPD_SSI_RAW */
{
ssi->tag_insert_len = g_pfnSSIHandler(tag, ssi->tag_insert,
ssi->tag_insert_len = httpd_ssi_handler(tag, ssi->tag_insert,
LWIP_HTTPD_MAX_TAG_INSERT_LEN
#if LWIP_HTTPD_SSI_MULTIPART
, current_tag_part, &ssi->tag_part
@ -1239,7 +1239,7 @@ http_send_data_ssi(struct altcp_pcb *pcb, struct http_state *hs)
case TAG_NONE:
/* We are not currently processing an SSI tag so scan for the
* start of the lead-in marker. */
if (*ssi->parsed == g_pcTagLeadIn[0]) {
if (*ssi->parsed == httpd_tag_lead_in[0]) {
/* We found what could be the lead-in for a new tag so change
* state appropriately. */
ssi->tag_state = TAG_LEADIN;
@ -1264,7 +1264,7 @@ http_send_data_ssi(struct altcp_pcb *pcb, struct http_state *hs)
ssi->tag_state = TAG_FOUND;
} else {
/* Have we found the next character we expect for the tag leadin? */
if (*ssi->parsed == g_pcTagLeadIn[ssi->tag_index]) {
if (*ssi->parsed == httpd_tag_lead_in[ssi->tag_index]) {
/* Yes - move to the next one unless we have found the complete
* leadin, in which case we start looking for the tag itself */
ssi->tag_index++;
@ -1297,7 +1297,7 @@ http_send_data_ssi(struct altcp_pcb *pcb, struct http_state *hs)
/* Have we found the end of the tag name? This is signalled by
* us finding the first leadout character or whitespace */
if ((*ssi->parsed == g_pcTagLeadOut[0]) ||
if ((*ssi->parsed == httpd_tag_lead_out[0]) ||
(*ssi->parsed == ' ') || (*ssi->parsed == '\t') ||
(*ssi->parsed == '\n') || (*ssi->parsed == '\r')) {
@ -1311,7 +1311,7 @@ http_send_data_ssi(struct altcp_pcb *pcb, struct http_state *hs)
LWIP_ASSERT("ssi->tag_index <= 0xff", ssi->tag_index <= 0xff);
ssi->tag_name_len = (u8_t)ssi->tag_index;
ssi->tag_name[ssi->tag_index] = '\0';
if (*ssi->parsed == g_pcTagLeadOut[0]) {
if (*ssi->parsed == httpd_tag_lead_out[0]) {
ssi->tag_index = 1;
} else {
ssi->tag_index = 0;
@ -1347,7 +1347,7 @@ http_send_data_ssi(struct altcp_pcb *pcb, struct http_state *hs)
}
/* Have we found the next character we expect for the tag leadout? */
if (*ssi->parsed == g_pcTagLeadOut[ssi->tag_index]) {
if (*ssi->parsed == httpd_tag_lead_out[ssi->tag_index]) {
/* Yes - move to the next one unless we have found the complete
* leadout, in which case we need to call the client to process
* the tag. */
@ -2178,15 +2178,15 @@ http_find_file(struct http_state *hs, const char *uri, int is_09)
if (copy_len > 0) {
size_t len_left = sizeof(http_uri_buf) - copy_len - 1;
if (len_left > 0) {
size_t name_len = strlen(g_psDefaultFilenames[loop].name);
size_t name_len = strlen(httpd_default_filenames[loop].name);
size_t name_copy_len = LWIP_MIN(len_left, name_len);
MEMCPY(&http_uri_buf[copy_len], g_psDefaultFilenames[loop].name, name_copy_len);
MEMCPY(&http_uri_buf[copy_len], httpd_default_filenames[loop].name, name_copy_len);
}
file_name = http_uri_buf;
} else
#endif /* LWIP_HTTPD_MAX_REQUEST_URI_LEN */
{
file_name = g_psDefaultFilenames[loop].name;
file_name = httpd_default_filenames[loop].name;
}
LWIP_DEBUGF(HTTPD_DEBUG | LWIP_DBG_TRACE, ("Looking for %s...\n", file_name));
err = fs_open(&hs->file_handle, file_name);
@ -2195,7 +2195,7 @@ http_find_file(struct http_state *hs, const char *uri, int is_09)
file = &hs->file_handle;
LWIP_DEBUGF(HTTPD_DEBUG | LWIP_DBG_TRACE, ("Opened.\n"));
#if LWIP_HTTPD_SSI
tag_check = g_psDefaultFilenames[loop].shtml;
tag_check = httpd_default_filenames[loop].shtml;
#endif /* LWIP_HTTPD_SSI */
break;
}
@ -2214,15 +2214,15 @@ http_find_file(struct http_state *hs, const char *uri, int is_09)
#if LWIP_HTTPD_CGI
http_cgi_paramcount = -1;
/* Does the base URI we have isolated correspond to a CGI handler? */
if (g_iNumCGIs && g_pCGIs) {
for (i = 0; i < g_iNumCGIs; i++) {
if (strcmp(uri, g_pCGIs[i].pcCGIName) == 0) {
if (httpd_num_cgis && httpd_cgis) {
for (i = 0; i < httpd_num_cgis; i++) {
if (strcmp(uri, httpd_cgis[i].pcCGIName) == 0) {
/*
* We found a CGI that handles this URI so extract the
* parameters and call the handler.
*/
http_cgi_paramcount = extract_uri_parameters(hs, params);
uri = g_pCGIs[i].pfnCGIHandler(i, http_cgi_paramcount, hs->params,
uri = httpd_cgis[i].pfnCGIHandler(i, http_cgi_paramcount, hs->params,
hs->param_vals);
break;
}
@ -2670,7 +2670,7 @@ http_set_ssi_handler(tSSIHandler ssi_handler, const char **tags, int num_tags)
LWIP_DEBUGF(HTTPD_DEBUG, ("http_set_ssi_handler\n"));
LWIP_ASSERT("no ssi_handler given", ssi_handler != NULL);
g_pfnSSIHandler = ssi_handler;
httpd_ssi_handler = ssi_handler;
#if LWIP_HTTPD_SSI_RAW
LWIP_UNUSED_ARG(tags);
@ -2679,8 +2679,8 @@ http_set_ssi_handler(tSSIHandler ssi_handler, const char **tags, int num_tags)
LWIP_ASSERT("no tags given", tags != NULL);
LWIP_ASSERT("invalid number of tags", num_tags > 0);
g_ppcTags = tags;
g_iNumTags = num_tags;
httpd_tags = tags;
httpd_num_tags = num_tags;
#endif /* !LWIP_HTTPD_SSI_RAW */
}
#endif /* LWIP_HTTPD_SSI */
@ -2699,8 +2699,8 @@ http_set_cgi_handlers(const tCGI *cgis, int num_handlers)
LWIP_ASSERT("no cgis given", cgis != NULL);
LWIP_ASSERT("invalid number of handlers", num_handlers > 0);
g_pCGIs = cgis;
g_iNumCGIs = num_handlers;
httpd_cgis = cgis;
httpd_num_cgis = num_handlers;
}
#endif /* LWIP_HTTPD_CGI */