/[projects]/smsdaemon/embedded-http/embeddedhttp.cpp
ViewVC logotype

Diff of /smsdaemon/embedded-http/embeddedhttp.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 683 by torben, Wed Apr 28 08:51:24 2010 UTC revision 684 by torben, Wed Apr 28 09:01:09 2010 UTC
# Line 49  void show_index(struct mg_connection *co Line 49  void show_index(struct mg_connection *co
49          mg_printf(conn, "%s", "</body></html>");          mg_printf(conn, "%s", "</body></html>");
50  }  }
51    
52    static void show_404(struct mg_connection *conn, const struct mg_request_info *request_info, void *user_data)
53    {
54            mg_printf(conn, "%s", "HTTP/1.1 200 OK\r\n");
55            mg_printf(conn, "%s", "Content-Type: text/plain\r\n\r\n");
56            mg_printf(conn, "%s", "Oops. File not found! ");
57    }
58    
59    
60  void EmbeddedHttp::startServer() {  void EmbeddedHttp::startServer() {
61          std::string portStr = Common::instance()->GetConfigfile()->GetValue("smsdaemon", "httpport");          std::string portStr = Common::instance()->GetConfigfile()->GetValue("smsdaemon", "httpport");
62          int port = atoi( portStr.c_str() );          int port = atoi( portStr.c_str() );
# Line 65  void EmbeddedHttp::startServer() { Line 73  void EmbeddedHttp::startServer() {
73                  mg_set_option(m_context, "ports", oss.str().c_str() );                  mg_set_option(m_context, "ports", oss.str().c_str() );
74                  mg_set_uri_callback(m_context, "/", &show_index, 0);                  mg_set_uri_callback(m_context, "/", &show_index, 0);
75                  mg_set_uri_callback(m_context, "/status", &show_secret, 0);                  mg_set_uri_callback(m_context, "/status", &show_secret, 0);
76                    mg_set_error_callback(m_context, 404, show_404, NULL);
77    
78    
79          } else {          } else {
80                  Logger::logMessage( "Mongoose http disabled" );                  Logger::logMessage( "Mongoose http disabled" );
81                  m_context = 0;                  m_context = 0;

Legend:
Removed from v.683  
changed lines
  Added in v.684

  ViewVC Help
Powered by ViewVC 1.1.20