@@ -41,6 +41,11 @@ namespace http
4141 class arg_comparator ;
4242};
4343
44+ namespace details
45+ {
46+ struct http_response_ptr ;
47+ };
48+
4449using namespace http ;
4550
4651/* *
@@ -317,11 +322,12 @@ class http_response
317322 std::string send_topic;
318323 struct MHD_Connection * underlying_connection;
319324
320- virtual void get_raw_response (MHD_Response** res, bool * found, webserver* ws = 0x0 );
325+ virtual void get_raw_response (MHD_Response** res, webserver* ws = 0x0 );
321326 virtual void decorate_response (MHD_Response* res);
322327 virtual int enqueue_response (MHD_Connection* connection, MHD_Response* res);
323328
324329 friend class webserver ;
330+ friend struct details ::http_response_ptr;
325331 friend void clone_response (const http_response& hr, http_response** dhr);
326332 friend class cache_response ;
327333};
@@ -338,6 +344,8 @@ class http_string_response : public http_response
338344 ): http_response(http_response::STRING_CONTENT, content, response_code, content_type, autodelete) { }
339345
340346 http_string_response (const http_response& b) : http_response(b) { }
347+ private:
348+ friend class webserver ;
341349};
342350
343351class http_byte_response : public http_response
@@ -351,6 +359,8 @@ class http_byte_response : public http_response
351359 const std::string& content_type = " text/plain" ,
352360 bool autodelete = true
353361 ): http_response(http_response::STRING_CONTENT, std::string(content, content_length), response_code, content_type, autodelete) { }
362+ private:
363+ friend class webserver ;
354364};
355365
356366class http_file_response : public http_response
@@ -368,7 +378,9 @@ class http_file_response : public http_response
368378
369379 http_file_response (const http_response& b) : http_response(b) { }
370380 protected:
371- virtual void get_raw_response (MHD_Response** res, bool * found, webserver* ws = 0x0 );
381+ virtual void get_raw_response (MHD_Response** res, webserver* ws = 0x0 );
382+ private:
383+ friend class webserver ;
372384};
373385
374386class http_basic_auth_fail_response : public http_response
@@ -387,6 +399,8 @@ class http_basic_auth_fail_response : public http_response
387399 http_basic_auth_fail_response (const http_response& b) : http_response(b) { }
388400 protected:
389401 virtual int enqueue_response (MHD_Connection* connection, MHD_Response* res);
402+ private:
403+ friend class webserver ;
390404};
391405
392406class http_digest_auth_fail_response : public http_response
@@ -408,6 +422,8 @@ class http_digest_auth_fail_response : public http_response
408422 http_digest_auth_fail_response (const http_response& b) : http_response(b) { }
409423 protected:
410424 virtual int enqueue_response (MHD_Connection* connection, MHD_Response* res);
425+ private:
426+ friend class webserver ;
411427};
412428
413429class shoutCAST_response : public http_response
@@ -422,6 +438,8 @@ class shoutCAST_response : public http_response
422438 );
423439
424440 shoutCAST_response (const http_response& b) : http_response(b) { }
441+ private:
442+ friend class webserver ;
425443};
426444
427445class switch_protocol_response : public http_response
@@ -437,7 +455,9 @@ class switch_protocol_response : public http_response
437455 {
438456 }
439457 protected:
440- virtual void get_raw_response (MHD_Response** res, bool * found, webserver* ws = 0x0 ) {}
458+ virtual void get_raw_response (MHD_Response** res, webserver* ws = 0x0 ) {}
459+ private:
460+ friend class webserver ;
441461};
442462
443463class long_polling_receive_response : public http_response
@@ -458,11 +478,12 @@ class long_polling_receive_response : public http_response
458478
459479 long_polling_receive_response (const http_response& b) : http_response(b) { }
460480 protected:
461- virtual void get_raw_response (MHD_Response** res, bool * found, webserver* ws = 0x0 );
481+ virtual void get_raw_response (MHD_Response** res, webserver* ws = 0x0 );
462482 private:
463483 static ssize_t data_generator (void * cls, uint64_t pos, char * buf, size_t max);
464484 int connection_id;
465485 httpserver::webserver* ws;
486+ friend class webserver ;
466487};
467488
468489class long_polling_send_response : public http_response
@@ -479,7 +500,9 @@ class long_polling_send_response : public http_response
479500
480501 long_polling_send_response (const http_response& b) : http_response(b) { }
481502 protected:
482- virtual void get_raw_response (MHD_Response** res, bool * found, webserver* ws = 0x0 );
503+ virtual void get_raw_response (MHD_Response** res, webserver* ws = 0x0 );
504+ private:
505+ friend class webserver ;
483506};
484507
485508class cache_response : public http_response
@@ -488,7 +511,9 @@ class cache_response : public http_response
488511 cache_response
489512 (
490513 const std::string& key
491- ) : http_response(http_response::CACHED_CONTENT, key)
514+ ) : http_response(http_response::CACHED_CONTENT, key),
515+ ws (0x0 ),
516+ locked_element(false )
492517 {
493518 }
494519
@@ -497,9 +522,12 @@ class cache_response : public http_response
497522 ~cache_response ();
498523
499524 protected:
500- virtual void get_raw_response (MHD_Response** res, bool * found, webserver* ws = 0x0 );
525+ virtual void get_raw_response (MHD_Response** res, webserver* ws = 0x0 );
526+ virtual void decorate_response (MHD_Response* res);
501527 private:
502528 webserver* ws;
529+ bool locked_element;
530+ friend class webserver ;
503531};
504532
505533void clone_response (http_response* hr, http_response** dhr);
0 commit comments