Пример #1
0
	void handleRequest(HTTPServerRequest& request, HTTPServerResponse& response)
	{
		Application& app = Application::instance();
		app.logger().information("Request from " + request.clientAddress().toString());

		SecureStreamSocket socket = static_cast<HTTPServerRequestImpl&>(request).socket();
		if (socket.havePeerCertificate())
		{
			X509Certificate cert = socket.peerCertificate();
			app.logger().information("Client certificate: " + cert.subjectName());
		}
		else
		{
			app.logger().information("No client certificate available.");
		}
		
		Timestamp now;
		std::string dt(DateTimeFormatter::format(now, _format));

		response.setChunkedTransferEncoding(true);
		response.setContentType("text/html");

		std::ostream& ostr = response.send();
		ostr << "<html><head><title>HTTPTimeServer powered by POCO C++ Libraries</title>";
		ostr << "<meta http-equiv=\"refresh\" content=\"1\"></head>";
		ostr << "<body><p style=\"text-align: center; font-size: 48px;\">";
		ostr << dt;
		ostr << "</p></body></html>";
	}
Пример #2
0
	void handleRequest(HTTPServerRequest& request, HTTPServerResponse& response)
	{
		response.setChunkedTransferEncoding(true);
		response.setContentType(request.getContentType());
		std::ostream& ostr = response.send();
		Poco::StreamCopier::copyStream(request.stream(), ostr);
	}
Пример #3
0
void PageRequestHandler::handleRequest
(HTTPServerRequest& request, HTTPServerResponse& response)
{
    response.setChunkedTransferEncoding(true);
    response.setContentType("text/html");
    const char *message = "The quick brown fox jumps over the lazy dog.\n";
    for(int i {0}; i < 100; ++i)
    {
        response.sendBuffer(message, 44);
    }
}
Пример #4
0
void PageRequestHandler::handleRequest( HTTPServerRequest& request, 
                                        HTTPServerResponse& response ) 
{
    response.setChunkedTransferEncoding(true);
    response.setContentType("text/html");
    std::ostream& ostr = response.send();
    ostr<<"<html>";
    ostr<<"<body>";
    ostr<<"Stub (HTML) output - insert JavaScript HERE";
    ostr<<"</body>";
    ostr<<"</html>";
}
Пример #5
0
	void handleRequest(HTTPServerRequest& request, HTTPServerResponse& response)
	{
		Timestamp now;
		std::string dt(DateTimeFormatter::format(now, DateTimeFormat::SORTABLE_FORMAT));

		response.setChunkedTransferEncoding(true);
		response.setContentType("text/html");

		std::ostream& ostr = response.send();
		ostr << "<html><head><title>TimeServer powered by POCO ApacheConnector</title>";
		ostr << "<meta http-equiv=\"refresh\" content=\"1\"></head>";
		ostr << "<body><p style=\"text-align: center; font-size: 48px;\">";
		ostr << dt;
		ostr << "</p></body></html>";
	}
void ofxWebServerBaseRouteHandler::sendErrorResponse(HTTPServerResponse& response) {
    // we will assume that the sender has set the status and
    // reason appropriately before calling the sendErrorResponse()
    
    HTTPResponse::HTTPStatus status = response.getStatus();
    string reason = response.getReason();
    response.setChunkedTransferEncoding(true);
    response.setContentType("text/html");
    std::ostream& ostr = response.send(); // get output stream
    ostr << "<html>";
    ostr << "<head><title>" << status << "-" << reason << "</title></head>";
    ostr << "<body>";
    ostr << "<h1>" << status << "-" << reason << "</h1>";
    ostr << "</body>";
    ostr << "<html>";
}
Пример #7
0
	void handleRequest(HTTPServerRequest& request, HTTPServerResponse& response)
	{
		Application& app = Application::instance();
		app.logger().information("Request from " + request.clientAddress().toString());

		Timestamp now;
		std::string dt(DateTimeFormatter::format(now, _format));

		response.setChunkedTransferEncoding(true);
		response.setContentType("text/html");

		std::ostream& ostr = response.send();
		ostr << "<html><head><title>HTTPTimeServer powered by POCO C++ Libraries</title>";
		ostr << "<meta http-equiv=\"refresh\" content=\"1\"></head>";
		ostr << "<body><p style=\"text-align: center; font-size: 48px;\">";
		ostr << dt;
		ostr << "</p></body></html>";
	}
Пример #8
0
	void handleRequest(HTTPServerRequest& request, HTTPServerResponse& response)
	{
		response.setChunkedTransferEncoding(true);
		response.setContentType("text/html");
		std::ostream& ostr = response.send();
		ostr << "<html>";
		ostr << "<head>";
		ostr << "<title>WebSocketServer</title>";
		ostr << "<script type=\"text/javascript\">";
		ostr << "function WebSocketTest()";
		ostr << "{";
		ostr << "  if (\"WebSocket\" in window)";
		ostr << "  {";
		ostr << "    var ws = new WebSocket(\"ws://" << request.serverAddress().toString() << "/ws\");";
		ostr << "    ws.onopen = function()";
		ostr << "      {";
		ostr << "        ws.send(\"Hello, world!\");";
		ostr << "      };";
		ostr << "    ws.onmessage = function(evt)";
		ostr << "      { ";
		ostr << "        var msg = evt.data;";
		ostr << "        alert(\"Message received: \" + msg);";
		ostr << "        ws.close();";
		ostr << "      };";
		ostr << "    ws.onclose = function()";
		ostr << "      { ";
		ostr << "        alert(\"WebSocket closed.\");";
		ostr << "      };";
		ostr << "  }";
		ostr << "  else";
		ostr << "  {";
		ostr << "     alert(\"This browser does not support WebSockets.\");";
		ostr << "  }";
		ostr << "}";
		ostr << "</script>";
		ostr << "</head>";
		ostr << "<body>";
		ostr << "  <h1>WebSocket Server</h1>";
		ostr << "  <p><a href=\"javascript:WebSocketTest()\">Run WebSocket Script</a></p>";
		ostr << "</body>";
		ostr << "</html>";
	}
Пример #9
0
    void handleRequest(HTTPServerRequest& request,
                       HTTPServerResponse& response)
    {
        StringTokenizer tok("/");
        StringVector tized;
        tok.tokenize(request.getURI(), tized);            
        if ( tized.size() == 4 )
        {
            int z = as<int>(tized[1], 0);
            int x = as<int>(tized[2], 0);
            unsigned int y = as<int>(osgDB::getNameLessExtension(tized[3]),0);
            std::string ext = osgDB::getFileExtension(tized[3]);

            OE_DEBUG << "z=" << z << std::endl;
            OE_DEBUG << "x=" << x << std::endl;
            OE_DEBUG << "y=" << y << std::endl;              
            OE_DEBUG << "ext=" << ext << std::endl;

            response.setChunkedTransferEncoding(true);

            osg::ref_ptr< osg::Image > image = _server->getTile(z, x, y);
            
            if (image)
            {
                osgDB::ReaderWriter* rw = osgDB::Registry::instance()->getReaderWriterForExtension(ext);
                if (rw)
                {
                    std::string mime = "image/png";
                    if (ext == "jpeg" || ext == "jpg")
                    {
                        mime = "image/jpeg";
                    }                    
                    response.setContentType(mime);
                    std::ostream& ostr = response.send();                 
                    rw->writeImage(*image.get(), ostr);                    
                }             

            }
        }
 
        response.setStatus(Poco::Net::HTTPResponse::HTTP_NOT_FOUND);                
    }
Пример #10
0
	void handleRequest(HTTPServerRequest& request, HTTPServerResponse& response)
	{
		response.setChunkedTransferEncoding(true);
		
		URI uri(request.getURI());
		std::string path = uri.getPath();
		std::string sql = getSQL();
		std:: cout << "Executing;[" << sql << ']' << std::endl;
		Session session("SQLite", ROOT_DIR"simpsons.db");
		if (path == "/html")
		{
			response.setContentType("text/html");
			response.send() << RecordSet(session, sql, HTMLTableFormatter());
		}
		else if (path == "/xml")
		{
			response.setContentType("text/xml");
			response.send() << RecordSet(session, sql, XMLFormatter());
		}
	}
Пример #11
0
	void handleRequest(HTTPServerRequest& request, HTTPServerResponse& response)
	{
		response.setContentType("text/html");
		response.setChunkedTransferEncoding(true);
		std::ostream& ostr = response.send();

		const std::string& softwareVersion = request.serverParams().getSoftwareVersion();
		LocalDateTime now;

		std::string osName = Environment::osName();
		std::string osDisplayName = Environment::osDisplayName();
		if (osDisplayName != osName)
		{
			osName += " (";
			osName += osDisplayName;
			osName += ")";
		}

		ostr << "<HTML><HEAD><TITLE>Server Information</TITLE>"
		        "<LINK REL=\"stylesheet\" HREF=\"css/styles.css\" TYPE=\"text/css\"/></HEAD><BODY>"
		        "<DIV CLASS=\"header\">"
				"<H1 CLASS=\"category\">Open Service Platform</h1>"
				"<H1 CLASS=\"title\">Server Information</H1>"
				"</DIV>"
		        "<DIV CLASS=\"body\">"
		        "<UL>";
		    
		ostr << "<LI><B>Host:</B> " << Environment::nodeName() << "</LI>"
		     << "<LI><B>Node ID:</B> " << Environment::nodeId() << "</LI>"
		     << "<LI><B>IP Addresses:</B> " << getHostAddresses() << "</LI>"
		     << "<LI><B>OS Name:</B> " << osName << "</LI>"
		     << "<LI><B>OS Version:</B> " << Environment::osVersion() << "</LI>"
		     << "<LI><B>OS Architecture:</B> " << Environment::osArchitecture() << "</LI>"
		     << "<LI><B>Processor Cores:</B> " << Environment::processorCount() << "</LI>"
		     << "<LI><B>Local Server Time:</B> " << DateTimeFormatter::format(now, DateTimeFormat::HTTP_FORMAT) << "</LI>"
		     << "<LI><B>Server Process ID:</B> " << Process::id() << "</LI>";
		   
		ostr << "</UL><HR><P>";
		ostr << htmlize(softwareVersion) << " at " << request.serverAddress().toString();
		ostr << "</P></DIV></BODY></HTML>";
	}
Пример #12
0
	void handleRequest(HTTPServerRequest& request, HTTPServerResponse& response)
	{
		response.setChunkedTransferEncoding(true);
		//response.setContentType("text/html");

		Path path(_file);
		if (File(path).exists())
		{
			std::string mime = "application/binary";
			std::string ext = path.getExtension();
			if (ext == "html" || ext == "htm" || ext == "js" || ext == "css" || ext == "xml")
				mime = "text/" + ext;
			
			response.sendFile(_file, mime);
		}
		else
		{
			response.setStatusAndReason(HTTPResponse::HTTP_NOT_FOUND);
			response.send();
		}
	}
Пример #13
0
	void handleRequest(HTTPServerRequest& request, HTTPServerResponse& response)
	{
		HTMLForm form(request, request.stream());

		response.setContentType("text/html");
		response.setChunkedTransferEncoding(true);
        
		std::ostream& ostr = response.send();
        
        URI requestURI(request.getURI());
        
		ostr << "<html><head><title>Echo HTTP Headers and HTML Form Information</title>"
		        "<link rel=\"stylesheet\" href=\"css/styles.css\" type=\"text/css\"/></head><body>"
		        "<div class=\"header\">"
				"<h1 class=\"category\">Open Service Platform</h1>"
				"<h1 class=\"title\">Echo HTTP Headers and HTML Form Information</H1>"
				"</div>"
		        "<div class=\"body\">";
        
		// echo the items available by method
		ostr << "<h2>Request</h2>"
		     << "<ul>"
		     << "<li><b>Method:</b> " << request.getMethod() << "</li>"
             << "<li><b>URI Path:</b> " << requestURI.getPath() << "</li>"
             << "<li><b>URI Query:</b> " << requestURI.getQuery() << "</li>"
             << "<li><b>HTTP Version:</b> " << request.getVersion() << "</li>"
             << "<li><b>Host:</b> " << request.getHost() << "</li>"
             << "<li><b>Content Type:</b> " << request.getContentType() << "</li>"
             << "<li><b>Chunked:</b> " << (request.getChunkedTransferEncoding() ? "true" : "false") << "</li>"
             << "<li><b>Keep Alive:</b> " << (request.getKeepAlive() ? "true" : "false") << "</li>"
             << "<li><b>Transfer Encoding:</b> " << request.getTransferEncoding() << "</li>"
             << "<li><b>Client Address:</b> " << request.clientAddress().toString() << "</li>";

        if (request.hasContentLength())
        {
            ostr << "<li><b>Content Length:</b> " << request.getContentLength64() << "</li>";
        }

		ostr << "</ul>";

        // echo the request headers
        {
            ostr << "<hr>"
                    "<h2>Request Headers</h2><ul>\n";

            NameValueCollection headers;
            NameValueCollection::ConstIterator itr(request.begin());
            NameValueCollection::ConstIterator itrEnd(request.end());
            
            for (; itr != itrEnd; ++itr)
            {
                ostr << "<li><b>" << htmlize(itr->first) << "</b>: " <<  htmlize(itr->second) << "</li>";
            }
            ostr << "</ul>";
        }

        // echo any cookies
        {
            NameValueCollection cookies;
            request.getCookies(cookies);

            if (!cookies.empty())
            {
                ostr << "<hr>";
                ostr << "<h2>Cookies</h2><ul>\n";

                NameValueCollection::ConstIterator itr(cookies.begin());
                NameValueCollection::ConstIterator itrEnd(cookies.end());
                
                for (; itr != itrEnd; ++itr)
                {
                    ostr << "<li><b>" << htmlize(itr->first) << "</b>: " <<  htmlize(itr->second) << "</li>";
                }
                ostr << "</ul>";
            }
        }
        
        // echo any form data (GETs or POSTs)
		if (!form.empty())
		{
            ostr << "<hr>"
			        "<h2>Form Data</h2><ul>\n";

			NameValueCollection::ConstIterator itr(form.begin());
			NameValueCollection::ConstIterator itrEnd(form.end());
			for (; itr != itrEnd; ++itr)
			{
				ostr << "<li><b>" << htmlize(itr->first) << "</b>: " << htmlize(itr->second) << "</li>\n";
			}
			ostr << "</ul>";
		}
        
        ostr << "<hr>"
             << "<h2>Response</h2>"
             << "<ul>"
		     << "<li><b>Status:</b> "  << response.getStatus()  << "</li>"
             << "<li><b>Reason:</b> "  << response.getReason()  << "</li>"
            << "</ul>";
        
        // echo the response headers
        {
            ostr << "<hr>"
                    "<h2>Response Headers</h2><ul>\n";
            
            NameValueCollection headers;
            NameValueCollection::ConstIterator itr(response.begin());
            NameValueCollection::ConstIterator itrEnd(response.end());
            
            for (; itr != itrEnd; ++itr)
            {
                ostr << "<li><b>" << htmlize(itr->first) << "</b>: " <<  htmlize(itr->second) << "</li>";
            }
            ostr << "</ul>";
        }
        
		ostr << "</div></body></html>";
	}
Пример #14
0
void CHTTPRequestHandler::handleRequest(HTTPServerRequest& request, HTTPServerResponse& response)
{
	response.setContentType("application/json");
	response.setChunkedTransferEncoding(true);
	if(m_buf == NULL)
		m_buf = new char[512];
	memset(m_buf, 0, 512);
	request.stream().getline(m_buf, 512, '\n');
	infof("%s, %d: Receive HTTP request[%s]", __FILE__, __LINE__, m_buf);
	JSON::Parser parser;
	Dynamic::Var var;
	try
	{
		var = parser.parse(m_buf);
	}
	catch(Exception& e)
	{
		JSON::Object::Ptr re = new JSON::Object;
		re->set(KEY_TYPE_STR, TYPE_RESPONSE_STR);
		re->set(KEY_RESULT_STR, RESULT_FAIL_STR);
		re->set(KEY_DETAIL_STR, "100");
		DynamicStruct ds_res = *re;
		response.sendBuffer(ds_res.toString().c_str(), ds_res.toString().length());
		infof("%s, %d: Send Http response[%s].", __FILE__, __LINE__, ds_res.toString().c_str());
		re = NULL;
		return;
	}
	JSON::Object::Ptr obj = var.extract<JSON::Object::Ptr>();
	JSON::Object::Ptr res = new JSON::Object(*obj);
	if(!checkRequestFormat(obj, res))
	{
		DynamicStruct ds_res = *res;
		response.sendBuffer(ds_res.toString().c_str(), ds_res.toString().length());
		infof("%s, %d: Send Http response[%s].", __FILE__, __LINE__, ds_res.toString().c_str());
		res = NULL;
		return;
	}
	DynamicStruct ds = *obj;
	std::string uuid = ds[KEY_PARAM_STR][REG_UUID_STR].toString();
	std::string action = ds[KEY_ACTION_STR].toString();
	std::string component = "";
	std::string method = "";
	bool ret = parseAction(action, component, method);
	if(!ret)
	{
		res->set(KEY_RESULT_STR, RESULT_FAIL_STR);
		res->set(KEY_DETAIL_STR, "105");
		DynamicStruct ds_res = *res;
		response.sendBuffer(ds_res.toString().c_str(), ds_res.toString().length());
		infof("%s, %d: Send Http response[%s].", __FILE__, __LINE__, ds_res.toString().c_str());
		res = NULL;
		return;
	}
	if(component == COMPONENT_SERVER_STR)
	{
		if(method == SERVER_METHOD_CHECK)
		{
			res->set(KEY_RESULT_STR, RESULT_GOOD_STR);
			CDeviceManager* dev_mgr = CDeviceManager::instance();
			DeviceInfo* dev_info = dev_mgr->getDevice(uuid);
			DynamicStruct param;
			param[REG_UUID_STR] = uuid;
			if(dev_info != NULL)
			{
				param[REG_STATE_STR] = "online";
				param[REG_DEV_TYPE_STR] = dev_info->devType;
			}
			else
			{
				param[REG_STATE_STR] = "offline";
			}
			res->remove(KEY_PARAM_STR);
			res->set(KEY_PARAM_STR, param);
		}
		else
		{
			res->set(KEY_RESULT_STR, RESULT_FAIL_STR);
			res->set(KEY_DETAIL_STR, "106");
		}
		DynamicStruct ds_res = *res;
		infof("%s, %d: Send Http response[%s].", __FILE__, __LINE__, ds_res.toString().c_str());
		response.sendBuffer(ds_res.toString().c_str(), ds_res.toString().length());
		res = NULL;
		return;
	}
	else if(component == COMPONENT_UPDATE_STR)
	{
		std::string detail = "";
		if(method == UPDATE_METHOD_CHECK)
		{
			CUpdateManager* update_manager = CUpdateManager::instance();
			JSON::Object::Ptr pParam = obj->getObject(KEY_PARAM_STR);
			if(update_manager->checkUpdate(pParam, detail))
			{
				res->set(KEY_RESULT_STR, RESULT_GOOD_STR);
				res->remove(KEY_PARAM_STR);
				res->set(KEY_PARAM_STR, pParam);
			}
			else
			{
				res->set(KEY_RESULT_STR, RESULT_FAIL_STR);
				res->set(KEY_DETAIL_STR, detail);
			}
		}
		else
		{
			res->set(KEY_RESULT_STR, RESULT_FAIL_STR);
			res->set(KEY_DETAIL_STR, "106");
		}
		DynamicStruct ds_res = *res;
		infof("%s, %d: Send Http response[%s].", __FILE__, __LINE__, ds_res.toString().c_str());
		response.sendBuffer(ds_res.toString().c_str(), ds_res.toString().length());
		res = NULL;
		return;
	}
	RequestInfo* req = new RequestInfo((UInt64)this, uuid, 5*1000*1000, obj);
	CRegServer* reg_server = CRegServer::instance();
	//it will hang until response send back, or timeout
	reg_server->sendRequest(req);
	res = req->response;
	if(res.isNull())
	{
		warnf("%s, %d: Request timeout.", __FILE__, __LINE__);
		DynamicStruct result = *obj;
		result[KEY_RESULT_STR] = RESULT_FAIL_STR;
		result[KEY_DETAIL_STR] = "timeout";
		infof("%s, %d: Send Http response[%s].", __FILE__, __LINE__, result.toString().c_str());
		response.sendBuffer(result.toString().c_str(), result.toString().length());
	}
	else
	{
		DynamicStruct result = *res;
		infof("%s, %d: Send Http response[%s].", __FILE__, __LINE__, result.toString().c_str());
		response.sendBuffer(result.toString().c_str(), result.toString().length());
	}
	res = NULL;
	delete req;
}
Пример #15
0
	void handleRequest (HTTPServerRequest &request, HTTPServerResponse &response)
	{
		Application& app = Application::instance();
		app.logger().information("Запрос от " + request.clientAddress().toString());
		
		
//		std::cout << request.getURI() << std::endl;
		
//		std::string filename(request.getURI().substr(0, request.getURI().find("?")));
//		app.logger().information("Файл: " + filename);
		
		/*
		if (opendir(std::string("www" + filename).c_str()) != NULL)
		{
			response.setStatus(Poco::Net::HTTPResponse::HTTP_NOT_FOUND);
			return;
		}
		
		if (filename != "balda.json")
		{
			ifstream fin(filename.c_str());
			
			if (fin.is_open())
			{
			
			}
			
			return;
		}
	*/	
		response.setChunkedTransferEncoding(true);
		std::ostream &ostr = response.send();

	//	try
	//	{
//			response.sendFile("/media/hdisk0/programming/project/anbal/2001/www" + filename, "text/plain");
//		}
	//	catch (...)
	//	{
//			ostr << "BAD" << std::endl;
	//	}
		
//		return;
	
		response.setContentType("text/javascript; charset=UTF-8");
		HTMLForm form(request, request.stream());
				
		if (!form.empty())
		{
			std::map < std::string , Glib::ustring > params;

			for (NameValueCollection::ConstIterator it = form.begin(); it != form.end(); ++it)
				params[it->first] = Glib::ustring(it->second);
			
			if (params["map"].length() != 25)
				return;
			
			std::vector < std::vector < SMyGUniChar > > char_map(5, std::vector < SMyGUniChar >(5));
			Glib::ustring u_map = params["map"];
			
			for (int i = 0, len = u_map.length(); i < len; ++i)
				char_map[i / 5][i % 5] = SMyGUniChar(u_map[i], i / 5, i % 5, u_map[i] == Glib::ustring(".")[0]);
			
			CBalda balda(*dictionary);
			std::vector < Glib::ustring > words = balda.calc(char_map);
			
			ostr << params["callback"] << "({\"word\": [\"" << cat(std::string("\", \""), words.begin(), words.end()) << "\"]})";
		}
	}
Пример #16
0
	void handleRequest(HTTPServerRequest& request, HTTPServerResponse& response)
	{
		Application& app = Application::instance();
		app.logger().information("Request from " + request.clientAddress().toString());

		MyPartHandler partHandler;
		HTMLForm form(request, request.stream(), partHandler);

		response.setChunkedTransferEncoding(true);
		response.setContentType("text/html");

		std::ostream& ostr = response.send();
		
		ostr <<
			"<html>\n"
			"<head>\n"
			"<title>POCO Form Server Sample</title>\n"
			"</head>\n"
			"<body>\n"
			"<h1>POCO Form Server Sample</h1>\n"
			"<h2>GET Form</h2>\n"
			"<form method=\"GET\" action=\"/form\">\n"
			"<input type=\"text\" name=\"text\" size=\"31\">\n"
			"<input type=\"submit\" value=\"GET\">\n"
			"</form>\n"
			"<h2>POST Form</h2>\n"
			"<form method=\"POST\" action=\"/form\">\n"
			"<input type=\"text\" name=\"text\" size=\"31\">\n"
			"<input type=\"submit\" value=\"POST\">\n"
			"</form>\n"
			"<h2>File Upload</h2>\n"
			"<form method=\"POST\" action=\"/form\" enctype=\"multipart/form-data\">\n"
			"<input type=\"file\" name=\"file\" size=\"31\"> \n"
			"<input type=\"submit\" value=\"Upload\">\n"
			"</form>\n";
			
		ostr << "<h2>Request</h2><p>\n";
		ostr << "Method: " << request.getMethod() << "<br>\n";
		ostr << "URI: " << request.getURI() << "<br>\n";
		NameValueCollection::ConstIterator it = request.begin();
		NameValueCollection::ConstIterator end = request.end();
		for (; it != end; ++it)
		{
			ostr << it->first << ": " << it->second << "<br>\n";
		}
		ostr << "</p>";

		if (!form.empty())
		{
			ostr << "<h2>Form</h2><p>\n";
			it = form.begin();
			end = form.end();
			for (; it != end; ++it)
			{
				ostr << it->first << ": " << it->second << "<br>\n";
			}
			ostr << "</p>";
		}
		
		if (!partHandler.name().empty())
		{
			ostr << "<h2>Upload</h2><p>\n";
			ostr << "Name: " << partHandler.name() << "<br>\n";
			ostr << "File Name: " << partHandler.fileName() << "<br>\n";
			ostr << "Type: " << partHandler.contentType() << "<br>\n";
			ostr << "Size: " << partHandler.length() << "<br>\n";
			ostr << "</p>";
		}
		ostr << "</body>\n";
	}
Пример #17
0
	void handleRequest(HTTPServerRequest& request, HTTPServerResponse& response)
	{
		response.setChunkedTransferEncoding(true);
		response.sendFile("WebNotifier.html", "text/html");
	}