| iMatix home page | << | < | > | >> |
SFL Version 2.11 |
#include "sflhttp.h" char * http_unescape ( char *string, char *result)
Removes HTTP escaping from a string. See http escape() for details of the escaping algorithm. If the result string is NULL, modifies the source string in place, else fills-in the result string. Returns the resulting string. End-of-line sequences (%0A%0D) are stored as a single new-line character, i.e. carriage-returns (%0D) are not stored.
{ char *target; /* Where we store the result */ ASSERT (string); if (!result) /* If result string is null, */ result = string; /* modify in place */ target = result; while (*string) { if (*string == '%' /* Unescape %xx sequence */ && string [1] && string [2]) { string++; *target = decode_hex ((const char **) &string, 2); if (*target != '\r') target++; /* We do not store CRs */ } else { if (*string == '+') /* Spaces are escaped as '+' */ *target++ = ' '; else *target++ = *string; /* Otherwise just copy */ string++; } } *target = '\0'; /* Terminate target string */ return (result); }
| << | < | > | >> | Copyright © 1996-2000 iMatix Corporation |