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

Referenced by www_decode().

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

void www_decode ( string & s )
 

Definition at line 85 of file logrecord.C.

Referenced by LogRecord::parse_path().

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


httpstats-stage03 [ 7 April, 2001]