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 77 of file logrecord.C.

Referenced by www_decode().

00077                  { // assert(isxdigit(c))
00078 if (isdigit(c)) 
00079   return c - '0';
00080 else if (isupper(c))
00081   return c - 'A' + 10;
00082 else // must be lower case letter
00083   return c - 'a' +10;
00084 }

void www_decode ( string & s )
 

Definition at line 88 of file logrecord.C.

Referenced by LogRecord::parse_path().

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


httpstats-stage01 [ 7 April, 2001]