|
| iMatix home page | << | < | > | >> |
SFLVersion 2.11 |
#include "sflhttp.h"
size_t
http_escape_size (
const char *string)
Returns the size of a string after HTTP escaping. See the http escape() function for details of the escaping algorithm. Includes the null terminator in the returned size.
{
size_t
result_size = 1; /* Allow for null terminator */
ASSERT (string);
while (*string)
{
if (isalnum (*string)) /* Don't escape letters or digits */
result_size++;
else
if (*string == '\n' || *string == '\r')
{
if ((string [1] == '\n' || string [1] == '\r')
&& (string [1] != *string))
string++;
result_size += 6; /* Line ending becomes %0D%0A */
}
else
result_size += 3; /* Some other escaped character */
string++;
}
return (result_size);
}
| | << | < | > | >> |
|