ReactOS  0.4.14-dev-337-gf981a68
RequestHandler Class Reference
Collaboration diagram for RequestHandler:

Public Member Functions

 RequestHandler (SOCKET s)
 
 ~RequestHandler ()
 
void RecvData (string input)
 
void OkToSend ()
 
SOCKET GetSocket () const
 
bool ShouldDie () const
 
bool WantPollout () const
 

Private Types

enum  _RHState { NO_REQUEST_YET, REQUEST_RECVD_SENDING_REPLY, SHOULD_DIE }
 
typedef enum RequestHandler::_RHState RHState
 

Private Member Functions

string urlenc (string in)
 
string urldec (string in)
 
string dump_one_line (const char *data, int llen, int len, int addr)
 
string bindump (const char *data, int len)
 
string present_value (DWORD type, const char *data, DWORD len)
 
void process_valid_request (HKEY open_reg_key, string key_name)
 
void process_invalid_request (string reg_key)
 
void process_root_request ()
 
void process_request (string reg_key)
 

Private Attributes

string full_input
 
string remaining_output
 
SOCKET socket
 
RHState state
 

Detailed Description

Definition at line 42 of file netreg.cpp.

Member Typedef Documentation

◆ RHState

Member Enumeration Documentation

◆ _RHState

Enumerator
NO_REQUEST_YET 
REQUEST_RECVD_SENDING_REPLY 
SHOULD_DIE 

Definition at line 398 of file netreg.cpp.

Constructor & Destructor Documentation

◆ RequestHandler()

RequestHandler::RequestHandler ( SOCKET  s)
inline

Definition at line 44 of file netreg.cpp.

44 : socket( s ), state( NO_REQUEST_YET ) {}
RHState state
Definition: netreg.cpp:407
SOCKET socket
Definition: netreg.cpp:406
GLdouble s
Definition: gl.h:2039

◆ ~RequestHandler()

RequestHandler::~RequestHandler ( )
inline

Definition at line 45 of file netreg.cpp.

45 { closesocket( socket ); }
#define closesocket
SOCKET socket
Definition: netreg.cpp:406

Member Function Documentation

◆ bindump()

string RequestHandler::bindump ( const char data,
int  len 
)
inlineprivate

Definition at line 166 of file netreg.cpp.

166  {
167  const char *end = data + len;
168  string out;
169  int addr = 0;
170 
171  out += "<pre>";
172 
173  while( data < end ) {
174  out += dump_one_line( data, 16, end - data, addr );
175  addr += 16;
176  data += 16;
177  }
178 
179  out += "</pre>";
180 
181  return out;
182  }
GLuint GLuint end
Definition: gl.h:1545
static FILE * out
Definition: regtests2xml.c:44
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLenum const GLvoid * addr
Definition: glext.h:9621
string dump_one_line(const char *data, int llen, int len, int addr)
Definition: netreg.cpp:142
GLenum GLsizei len
Definition: glext.h:6722

Referenced by present_value().

◆ dump_one_line()

string RequestHandler::dump_one_line ( const char data,
int  llen,
int  len,
int  addr 
)
inlineprivate

Definition at line 142 of file netreg.cpp.

142  {
144  int i;
145 
146  out << setw( 8 ) << setfill( '0' ) << hex << addr << ": ";
147 
148  for( i = 0; i < llen; i++ ) {
149  if( i < len ) out << setw( 2 ) << setfill( '0' ) << hex <<
150  (data[i] & 0xff) << " ";
151  else out << " ";
152  }
153 
154  out << " : ";
155 
156  for( i = 0; i < llen; i++ ) {
157  if( i < len && i < llen &&
158  data[i] >= ' ' && data[i] < 0x7f ) out << data[i]; else out << '.';
159  }
160 
161  out << "\n";
162 
163  return out.str();
164  }
_STLP_PRIV _Setfill_Manip< _CharT > _STLP_CALL setfill(_CharT __c)
Definition: _iomanip.h:160
static const char hex[16]
Definition: profile.c:123
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static FILE * out
Definition: regtests2xml.c:44
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLenum const GLvoid * addr
Definition: glext.h:9621
GLenum GLsizei len
Definition: glext.h:6722
_STLP_PRIV _Ios_Manip_1< streamsize > _STLP_CALL setw(int __n)
Definition: _iomanip.h:125

Referenced by bindump().

◆ GetSocket()

SOCKET RequestHandler::GetSocket ( ) const
inline

Definition at line 82 of file netreg.cpp.

82 { return socket; }
SOCKET socket
Definition: netreg.cpp:406

◆ OkToSend()

void RequestHandler::OkToSend ( )
inline

Definition at line 66 of file netreg.cpp.

66  {
67  int rv = send( socket,
68  remaining_output.c_str(),
69  remaining_output.size(), 0 );
70  if( rv < 0 ) {
71  state = SHOULD_DIE;
72  return;
73  } else {
75  remaining_output.substr( rv, remaining_output.size() - rv );
76  if( remaining_output.size() == 0 ) {
77  state = SHOULD_DIE;
78  }
79  }
80  }
RHState state
Definition: netreg.cpp:407
string remaining_output
Definition: netreg.cpp:405
SOCKET socket
Definition: netreg.cpp:406
INT WSAAPI send(IN SOCKET s, IN CONST CHAR FAR *buf, IN INT len, IN INT flags)
Definition: send.c:23

◆ present_value()

string RequestHandler::present_value ( DWORD  type,
const char data,
DWORD  len 
)
inlineprivate

Definition at line 184 of file netreg.cpp.

184  {
185  switch( type ) {
186  default:
187  return bindump( data, len );
188  }
189  }
string bindump(const char *data, int len)
Definition: netreg.cpp:166
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLenum GLsizei len
Definition: glext.h:6722

Referenced by process_valid_request().

◆ process_invalid_request()

void RequestHandler::process_invalid_request ( string  reg_key)
inlineprivate

Definition at line 294 of file netreg.cpp.

294  {
295  ostringstream text_out;
296  text_out << "HTTP/1.0 404 Not Found\r\n"
297  << "Content-Type: text/html\r\n"
298  << "\r\n"
299  << "<html><head><title>Can't find registry key `"
300  << reg_key
301  << "'</title></head><body>\r\n"
302  << "<H1>Can't find registry key `"
303  << reg_key
304  << "'</H1>\r\n"
305  << "The registry key doesn't exist in the local registry.\r\n"
306  << "</body></html>\r\n";
307 
308  remaining_output = text_out.str();
309  }
string remaining_output
Definition: netreg.cpp:405
_String str() const
Definition: _sstream.h:184

Referenced by process_request(), and process_valid_request().

◆ process_request()

void RequestHandler::process_request ( string  reg_key)
inlineprivate

Definition at line 338 of file netreg.cpp.

338  {
339  int i;
340  bool is_predefined_key = true;
341 
342  if( reg_key == "" ) { process_root_request(); return; }
343  HKEY hRegKey = 0;
344 
345  // Parse the key name...
346  size_t slash = reg_key.find( '/' );
347  string reg_initial = "";
348 
349  if( slash == string::npos ) // A root key...
350  reg_initial = reg_key;
351  else // Any other key
352  reg_initial = reg_key.substr( 0, slash );
353 
354  fprintf( stderr, "reg_init = %s, reg_key = %s\n",
355  reg_initial.c_str(),
356  reg_key.c_str() );
357 
358  for( i = 0; root_entries[i]; i++ )
359  if( reg_initial == root_entries[i] ) hRegKey = root_handles[i];
360 
361  if( hRegKey != 0 && reg_initial != reg_key ) {
362  size_t start_of_reg_path = reg_initial.size() + 1;
363  string reg_path = reg_key.substr( start_of_reg_path,
364  reg_key.size() - start_of_reg_path );
365 
366  string reg_open_path = reg_path;
367  do {
368  slash = reg_open_path.find( '/' );
369  string reg_single_key = reg_open_path;
370 
371  if( slash != string::npos ) {
372  reg_single_key = reg_open_path.substr( 0, slash );
373  reg_open_path = reg_open_path.substr( slash+1,
374  reg_open_path.size() );
375  }
376 
377  HKEY oldKey = hRegKey;
378 
379  fprintf( stderr, "Opening %s\n", reg_single_key.c_str() );
380 
381  if( RegOpenKey( hRegKey, reg_single_key.c_str(), &hRegKey ) !=
382  ERROR_SUCCESS ) {
383  hRegKey = 0;
384  break;
385  } else RegCloseKey( oldKey );
386 
387  is_predefined_key = false;
388  } while( slash != string::npos );
389  }
390 
391  if( hRegKey == 0 ) process_invalid_request( reg_key );
392  else {
393  process_valid_request( hRegKey, reg_key );
394  if( !is_predefined_key ) RegCloseKey( hRegKey );
395  }
396  }
#define ERROR_SUCCESS
Definition: deptool.c:10
void process_valid_request(HKEY open_reg_key, string key_name)
Definition: netreg.cpp:191
static const size_t npos
Definition: _string_npos.h:26
void process_invalid_request(string reg_key)
Definition: netreg.cpp:294
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
const char * root_entries[]
Definition: netreg.cpp:25
const HKEY root_handles[]
Definition: netreg.cpp:34
FILE * stderr
#define RegOpenKey
Definition: winreg.h:519
void process_root_request()
Definition: netreg.cpp:311

Referenced by RecvData().

◆ process_root_request()

void RequestHandler::process_root_request ( )
inlineprivate

Definition at line 311 of file netreg.cpp.

311  {
312  ostringstream text_out;
313  int i;
314 
315  text_out << "HTTP/1.0 200 OK\r\n"
316  << "Content-Type: text/html\r\n"
317  << "\r\n"
318  << "<html><head><title>Registry Browser</title></head>\r\n"
319  << "<body>\r\n"
320  << "<H1>Registry Browser</H1>"
321  << "You can use this interface to browse the registry."
322  << "You will be presented with one registry key at a time and "
323  << "the decendents.\r\n"
324  << "<h2>Root Level</h2>\r\n"
325  << "Subkeys:<ul>\r\n";
326 
327  for( i = 0; root_entries[i]; i++ )
328  text_out << "<li>"
329  << "<a href='/" << urlenc(root_entries[i])
330  << "'>" << root_entries[i]
331  << "</a></li>\r\n";
332 
333  text_out << "</ul></body></html>\r\n";
334 
335  remaining_output = text_out.str();
336  }
string remaining_output
Definition: netreg.cpp:405
string urlenc(string in)
Definition: netreg.cpp:94
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
_String str() const
Definition: _sstream.h:184
const char * root_entries[]
Definition: netreg.cpp:25

Referenced by process_request().

◆ process_valid_request()

void RequestHandler::process_valid_request ( HKEY  open_reg_key,
string  key_name 
)
inlineprivate

Definition at line 191 of file netreg.cpp.

191  {
192  size_t ending_slash;
193  string up_level;
194  ostringstream text_out;
195 
196  DWORD num_sub_keys;
197  DWORD max_subkey_len;
198  DWORD num_values;
199  DWORD max_value_name_len;
200  DWORD max_value_len;
201 
202  char *value_name_buf;
203  char *value_buf;
204  char *key_name_buf;
205 
206  if( RegQueryInfoKey( open_reg_key,
207  NULL,
208  NULL,
209  NULL,
210  &num_sub_keys,
211  &max_subkey_len,
212  NULL,
213  &num_values,
214  &max_value_name_len,
215  &max_value_len,
216  NULL,
217  NULL ) != ERROR_SUCCESS ) {
219  return;
220  }
221 
222  value_name_buf = new char [max_value_name_len+1];
223  value_buf = new char [max_value_len+1];
224  key_name_buf = new char [max_subkey_len+1];
225 
226  ending_slash = key_name.rfind( '/' );
227  if( ending_slash != string::npos )
228  up_level = key_name.substr( 0, ending_slash );
229 
230  text_out << "HTTP/1.0 200 OK\r\n"
231  << "Content-Type: text/html\r\n"
232  << "\r\n"
233  << "<html><head><title>Registry Key `"
234  << key_name
235  << "'</title></head><body>\r\n"
236  << "<h1>Registry Key `" << key_name << "'</h1>\r\n"
237  << "<a href='/" << urlenc(up_level)
238  << "'>(Up one level)</a><p>\r\n"
239  << "<h2>Subkeys:</h2><table border='1'>\r\n";
240 
241  DWORD which_index;
242  DWORD key_name_size;
243 
244  for( which_index = 0; which_index < num_sub_keys; which_index++ ) {
245  key_name_size = max_subkey_len+1;
246  RegEnumKeyEx( open_reg_key,
247  which_index,
248  key_name_buf,
249  &key_name_size,
250  NULL,
251  NULL,
252  NULL,
253  NULL );
254  text_out << "<tr><td><a href='/" << urlenc(key_name) << "/"
255  << urlenc(string(key_name_buf,key_name_size)) << "'>"
256  << string(key_name_buf,key_name_size)
257  << "</a></td></tr>\r\n";
258  }
259 
260  text_out << "</table><h2>Values:</h2><table border='1'>\r\n";
261 
262  DWORD value_name_size;
263  DWORD value_data_size;
264  DWORD value_type;
265 
266  for( which_index = 0; which_index < num_values; which_index++ ) {
267  value_name_size = max_value_name_len+1;
268  value_data_size = max_value_len+1;
269 
270  RegEnumValue( open_reg_key,
271  which_index,
272  value_name_buf,
273  &value_name_size,
274  NULL,
275  &value_type,
276  (BYTE *)value_buf,
277  &value_data_size );
278 
279  text_out << "<tr><td><b>" << string(value_name_buf,value_name_size)
280  << "</b></td><td>"
281  << present_value( value_type, value_buf, value_data_size )
282  << "</td></tr>";
283  }
284 
285  text_out << "</ul></body></html>\r\n";
286 
287  delete [] key_name_buf;
288  delete [] value_name_buf;
289  delete [] value_buf;
290 
291  remaining_output = text_out.str();
292  }
#define RegQueryInfoKey
Definition: winreg.h:521
#define ERROR_SUCCESS
Definition: deptool.c:10
string remaining_output
Definition: netreg.cpp:405
string present_value(DWORD type, const char *data, DWORD len)
Definition: netreg.cpp:184
static const size_t npos
Definition: _string_npos.h:26
void process_invalid_request(string reg_key)
Definition: netreg.cpp:294
string urlenc(string in)
Definition: netreg.cpp:94
_String str() const
Definition: _sstream.h:184
smooth NULL
Definition: ftsmooth.c:416
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned char BYTE
Definition: mem.h:68
#define RegEnumKeyEx
Definition: winreg.h:510
char string[160]
Definition: util.h:11
#define RegEnumValue
Definition: winreg.h:511

Referenced by process_request().

◆ RecvData()

void RequestHandler::RecvData ( string  input)
inline

Definition at line 46 of file netreg.cpp.

46  {
47  full_input += input;
48  if( full_input.find( "\r\n\r\n" ) != string::npos ) {
49  // Full request received...
50  size_t space_pos = full_input.find( ' ' );
51  if( space_pos == string::npos ) { state = SHOULD_DIE; return; }
52  string method = full_input.substr( 0, space_pos );
53  if( method != "GET" ) { state = SHOULD_DIE; return; }
54  space_pos++;
55  if( full_input[space_pos] != '/' ) { state = SHOULD_DIE; return; }
56  space_pos++;
57  string reg_key_and_remainder =
58  full_input.substr( space_pos, full_input.size() - space_pos );
59  space_pos = reg_key_and_remainder.find( ' ' );
60  if( space_pos == string::npos ) { state = SHOULD_DIE; return; }
61  string reg_key_name = reg_key_and_remainder.substr( 0, space_pos );
62  process_request( urldec( reg_key_name ) );
64  }
65  }
RHState state
Definition: netreg.cpp:407
string urldec(string in)
Definition: netreg.cpp:112
static const size_t npos
Definition: _string_npos.h:26
string full_input
Definition: netreg.cpp:404
void process_request(string reg_key)
Definition: netreg.cpp:338
method
Definition: dragdrop.c:53
GLenum GLenum GLenum input
Definition: glext.h:9031

◆ ShouldDie()

bool RequestHandler::ShouldDie ( ) const
inline

Definition at line 84 of file netreg.cpp.

84  {
85  return state == SHOULD_DIE;
86  }
RHState state
Definition: netreg.cpp:407

◆ urldec()

string RequestHandler::urldec ( string  in)
inlineprivate

Definition at line 112 of file netreg.cpp.

112  {
113  string out;
114 
115  for( string::iterator i = in.begin();
116  i != in.end();
117  i++ ) {
118  if( *i == '%' ) {
119  char buf[3];
120  int res = ' ';
121 
122  i++;
123  if( i != in.end() ) {
124  buf[0] = *i;
125  i++;
126  if( i != in.end() ) {
127  buf[1] = *i;
128  buf[2] = 0;
129  sscanf( buf, "%x", &res );
130  fprintf( stderr, "Interpreting %c%c as %02x\n",
131  buf[0], buf[1],
132  res );
133  out += (char)res;
134  }
135  }
136  } else out += *i;
137  }
138 
139  return out;
140  }
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
unsigned char
Definition: typeof.h:29
_Check_return_ _CRTIMP int __cdecl sscanf(_In_z_ const char *_Src, _In_z_ _Scanf_format_string_ const char *_Format,...)
static FILE * out
Definition: regtests2xml.c:44
GLuint in
Definition: glext.h:9616
GLuint res
Definition: glext.h:9613
FILE * stderr

Referenced by RecvData().

◆ urlenc()

string RequestHandler::urlenc ( string  in)
inlineprivate

Definition at line 94 of file netreg.cpp.

94  {
96 
97  for( string::iterator i = in.begin();
98  i != in.end();
99  i++ ) {
100  if( isalnum( *i ) || *i == '/' )
101  out << *i;
102  else {
103  char minibuf[10];
104  sprintf( minibuf, "%02x", *i );
105  out << "%" << minibuf;
106  }
107  }
108 
109  return out.str();
110  }
_Check_return_ _CRTIMP int __cdecl isalnum(_In_ int _C)
#define sprintf(buf, format,...)
Definition: sprintf.c:55
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static FILE * out
Definition: regtests2xml.c:44
GLuint in
Definition: glext.h:9616

Referenced by process_root_request(), and process_valid_request().

◆ WantPollout()

bool RequestHandler::WantPollout ( ) const
inline

Definition at line 88 of file netreg.cpp.

Member Data Documentation

◆ full_input

string RequestHandler::full_input
private

Definition at line 404 of file netreg.cpp.

Referenced by RecvData().

◆ remaining_output

string RequestHandler::remaining_output
private

◆ socket

SOCKET RequestHandler::socket
private

Definition at line 406 of file netreg.cpp.

Referenced by GetSocket(), OkToSend(), and ~RequestHandler().

◆ state

RHState RequestHandler::state
private

Definition at line 407 of file netreg.cpp.

Referenced by OkToSend(), RecvData(), ShouldDie(), and WantPollout().


The documentation for this class was generated from the following file: