1
0
mirror of https://github.com/lxsang/ant-http synced 2024-07-01 12:59:47 +02:00

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(line, ' ');
if (token && line && strlen(line) > 0)
{
verify_header(token);
dput(xheader, token, strdup(line));
}
if (token != NULL && strcasecmp(token, "Cookie") == 0)
{
if(!cookie)

View File

@ -187,7 +187,7 @@ void antd_send_header(void* cl, antd_response_header_t* res)
antd_compress_t current_zlevel = client->z_level;
char* str = dvalue(res->header,"Content-Encoding");
if(!str)
{
{
// check for compress
str = dvalue(res->header,"Content-Type");
if(str)
@ -310,7 +310,6 @@ int antd_send(void *src, const void* data_in, int len_in)
}
} while(zstream->avail_out == 0);
source->z_level = current_zlevel;
//printf("data length %d\n", len);
return len;
}
#endif

View File

@ -149,6 +149,21 @@ mime_t mime_from_ext(const char* ex)
}
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()
{
return NULL;

View File

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