Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

logrecord.C File Reference

#include <string>
#include <ctype.h>
#include "logrecord.h"
#include "date.h"

Go to the source code of this file.

Functions

int hexdigit (char c)
void www_decode (string &s)


Function Documentation

int hexdigit ( char c ) [inline, static]
 

Definition at line 69 of file logrecord.C.

Referenced by www_decode().

00069                  { // assert(isxdigit(c))
00070 if (isdigit(c)) 
00071   return c - '0';
00072 else if (isupper(c))
00073   return c - 'A' + 10;
00074 else // must be lower case letter
00075   return c - 'a' +10;
00076 }

void www_decode ( string & s )
 

Definition at line 80 of file logrecord.C.

Referenced by LogRecord::parse_path().

00080                       {
00081 unsigned int i(0); // input index
00082 unsigned int j(0); // output index
00083 unsigned int len(s.size());
00084 for (i=0; (i<len); ++i,++j)
00085   switch (s[i]) {
00086     // case '+': s[j] = ' '; break; // Apparently not used in the log file.
00087     case '%': // the following 2 characters must be hex digits: 0-9,a-f
00088       if ((i+2<len) && isxdigit(s[i+1]) && isxdigit(s[i+2])) {
00089         s[j] = hexdigit(s[i+1])* 16 + hexdigit(s[i+2]);
00090         i += 2;
00091         }
00092       else
00093         s[j] = s[i];
00094       break;
00095     default: s[j] = s[i]; break;
00096     }
00097 s.resize(j);
00098 }


httpstats-stage02a [ 7 April, 2001]