/[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 677 by torben, Tue Apr 27 21:03:37 2010 UTC revision 678 by torben, Tue Apr 27 21:06:53 2010 UTC
# Line 32  void show_secret(struct mg_connection *c Line 32  void show_secret(struct mg_connection *c
32          mg_printf(conn, "%s", "HTTP/1.1 200 OK\r\n");          mg_printf(conn, "%s", "HTTP/1.1 200 OK\r\n");
33          mg_printf(conn, "%s", "Content-Type: text/plain\r\n\r\n");          mg_printf(conn, "%s", "Content-Type: text/plain\r\n\r\n");
34    
35          mg_printf(conn, "%s", os.str().c_str() );                mg_printf(conn, "%s", os.str().c_str() );
 }  
36    
 void show_index(struct mg_connection *conn, const struct mg_request_info *request_info, void *user_data) {  
         mg_printf(conn, "%s", "HTTP/1.1 200 OK\r\n");  
         mg_printf(conn, "%s", "Content-Type: text/plain\r\n\r\n");  
37                    
         mg_printf(conn, "%s", "<html><body><h2>smsdaemon</h2>\n");  
         mg_printf(conn, "%s", "<a href='/status'>smsdaemon status</a>\n");  
         mg_printf(conn, "%s", "</body></html>");  
38  }  }
39    
40  void EmbeddedHttp::startServer() {  void EmbeddedHttp::startServer() {
# Line 49  void EmbeddedHttp::startServer() { Line 42  void EmbeddedHttp::startServer() {
42    
43          m_context = mg_start();          m_context = mg_start();
44          mg_set_option(m_context, "ports", "8080");          mg_set_option(m_context, "ports", "8080");
         mg_set_uri_callback(m_context, "/", &show_index, 0);  
45          mg_set_uri_callback(m_context, "/status", &show_secret, 0);          mg_set_uri_callback(m_context, "/status", &show_secret, 0);
46    
47  }  }

Legend:
Removed from v.677  
changed lines
  Added in v.678

  ViewVC Help
Powered by ViewVC 1.1.20