|
|
@ -584,6 +584,16 @@ char *get_proxy(char *url, struct pool *pool) |
|
|
|
return url; |
|
|
|
return url; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Adequate size s==len*2 + 1 must be alloced to use this variant */ |
|
|
|
|
|
|
|
void __bin2hex(char *s, const unsigned char *p, size_t len) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
int i; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < (int)len; i++) |
|
|
|
|
|
|
|
sprintf(s + (i * 2), "%02x", (unsigned int)p[i]); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* Returns a malloced array string of a binary value of arbitrary length. The
|
|
|
|
/* Returns a malloced array string of a binary value of arbitrary length. The
|
|
|
|
* array is rounded up to a 4 byte size to appease architectures that need |
|
|
|
* array is rounded up to a 4 byte size to appease architectures that need |
|
|
|
* aligned array sizes */ |
|
|
|
* aligned array sizes */ |
|
|
@ -591,7 +601,6 @@ char *bin2hex(const unsigned char *p, size_t len) |
|
|
|
{ |
|
|
|
{ |
|
|
|
ssize_t slen; |
|
|
|
ssize_t slen; |
|
|
|
char *s; |
|
|
|
char *s; |
|
|
|
int i; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
slen = len * 2 + 1; |
|
|
|
slen = len * 2 + 1; |
|
|
|
if (slen % 4) |
|
|
|
if (slen % 4) |
|
|
@ -600,8 +609,7 @@ char *bin2hex(const unsigned char *p, size_t len) |
|
|
|
if (unlikely(!s)) |
|
|
|
if (unlikely(!s)) |
|
|
|
quithere(1, "Failed to calloc"); |
|
|
|
quithere(1, "Failed to calloc"); |
|
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < (int)len; i++) |
|
|
|
__bin2hex(s, p, len); |
|
|
|
sprintf(s + (i * 2), "%02x", (unsigned int)p[i]); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return s; |
|
|
|
return s; |
|
|
|
} |
|
|
|
} |
|
|
|