add header verify

This commit is contained in:
lxsang 2020-01-09 12:18:59 +01:00
parent 1af2945af0
commit 75df72e10a
4 changed files with 20 additions and 2 deletions

View File

@ -805,7 +805,10 @@ void *decode_request_header(void *data)
trim(token, ' '); trim(token, ' ');
trim(line, ' '); trim(line, ' ');
if (token && line && strlen(line) > 0) if (token && line && strlen(line) > 0)
{
verify_header(token);
dput(xheader, token, strdup(line)); dput(xheader, token, strdup(line));
}
if (token != NULL && strcasecmp(token, "Cookie") == 0) if (token != NULL && strcasecmp(token, "Cookie") == 0)
{ {
if(!cookie) if(!cookie)

View File

@ -310,7 +310,6 @@ int antd_send(void *src, const void* data_in, int len_in)
} }
} while(zstream->avail_out == 0); } while(zstream->avail_out == 0);
source->z_level = current_zlevel; source->z_level = current_zlevel;
//printf("data length %d\n", len);
return len; return len;
} }
#endif #endif

View File

@ -149,6 +149,21 @@ mime_t mime_from_ext(const char* ex)
} }
return ret; return ret;
} }
void verify_header(char* k)
{
k[0] = toupper(k[0]);
int len = strlen(k);
for (int i = 0; i < len; i++)
{
if(k[i] == '-' && i < len-1)
{
k[i+1] = toupper(k[i+1]);
}
}
}
dictionary_t mimes_list() dictionary_t mimes_list()
{ {
return NULL; return NULL;

View File

@ -105,4 +105,5 @@ int _exist(const char* f);
void md5(uint8_t *, size_t , char*); void md5(uint8_t *, size_t , char*);
void sha1(const char*, char*); void sha1(const char*, char*);
void digest_to_hex(const uint8_t *, char *); void digest_to_hex(const uint8_t *, char *);
void verify_header(char* k);
#endif #endif