mirror of
https://github.com/lxsang/ant-http
synced 2024-12-25 00:08:21 +01:00
add header verify
This commit is contained in:
parent
1af2945af0
commit
75df72e10a
@ -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)
|
||||
|
@ -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
|
||||
|
15
lib/utils.c
15
lib/utils.c
@ -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;
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user