u32 prealloc_fifos;
u32 private_segment_size;
u32 fifo_size;
+ u8 *uri;
vlib_main_t *vlib_main;
} http_server_main_t;
vec_add1 (hsm->free_http_cli_process_node_indices, node_index);
}
-static const char
- *http_response = "HTTP/1.1 200 OK\r\n"
- "Content-Type: text/html\r\n"
- "Expires: Mon, 11 Jan 1970 10:10:10 GMT\r\n"
- "Connection: close\r\n"
- "Pragma: no-cache\r\n" "Content-Length: %d\r\n\r\n%s";
-
-static const char
- *http_error_template = "HTTP/1.1 %s\r\n"
- "Content-Type: text/html\r\n"
- "Expires: Mon, 11 Jan 1970 10:10:10 GMT\r\n"
- "Connection: close\r\n" "Pragma: no-cache\r\n" "Content-Length: 0\r\n\r\n";
+/* *INDENT-OFF* */
+static const char *http_response =
+ "HTTP/1.1 200 OK\r\n"
+ "Content-Type: text/html\r\n"
+ "Expires: Mon, 11 Jan 1970 10:10:10 GMT\r\n"
+ "Connection: keep-alive \r\n"
+ "Pragma: no-cache\r\n"
+ "Content-Length: %d\r\n\r\n%s";
+
+static const char *http_error_template =
+ "HTTP/1.1 %s\r\n"
+ "Content-Type: text/html\r\n"
+ "Expires: Mon, 11 Jan 1970 10:10:10 GMT\r\n"
+ "Connection: close\r\n"
+ "Pragma: no-cache\r\n"
+ "Content-Length: 0\r\n\r\n";
/* Header, including incantation to suppress favicon.ico requests */
-static const char
- *html_header_template = "<html><head><title>%v</title>"
- "</head><link rel=\"icon\" href=\"data:,\"><body><pre>";
-
-static const char *html_footer = "</pre></body></html>\r\n";
-
-static const char
- *html_header_static = "<html><head><title>static reply</title></head>"
- "<link rel=\"icon\" href=\"data:,\"><body><pre>hello</pre></body>"
- "</html>\r\n";
+static const char *html_header_template =
+ "<html><head><title>%v</title></head>"
+ "<link rel=\"icon\" href=\"data:,\">"
+ "<body><pre>";
+
+static const char *html_footer =
+ "</pre></body></html>\r\n";
+
+static const char *html_header_static =
+ "<html><head><title>static reply</title></head>"
+ "<link rel=\"icon\" href=\"data:,\">"
+ "<body><pre>hello</pre></body></html>\r\n";
+/* *INDENT-ON* */
static u8 *static_http;
.session_disconnect_callback = http_server_session_disconnect_callback,
.session_connected_callback = http_server_session_connected_callback,
.add_segment_callback = http_server_add_segment_callback,
- .builtin_server_rx_callback = http_server_rx_callback,
+ .builtin_app_rx_callback = http_server_rx_callback,
.session_reset_callback = http_server_session_reset_callback
};
static int
server_attach ()
{
+ vnet_app_add_tls_cert_args_t _a_cert, *a_cert = &_a_cert;
+ vnet_app_add_tls_key_args_t _a_key, *a_key = &_a_key;
http_server_main_t *hsm = &http_server_main;
u64 options[APP_OPTIONS_N_OPTIONS];
vnet_app_attach_args_t _a, *a = &_a;
return -1;
}
hsm->app_index = a->app_index;
+
+ memset (a_cert, 0, sizeof (*a_cert));
+ a_cert->app_index = a->app_index;
+ vec_validate (a_cert->cert, test_srv_crt_rsa_len);
+ clib_memcpy (a_cert->cert, test_srv_crt_rsa, test_srv_crt_rsa_len);
+ vnet_app_add_tls_cert (a_cert);
+
+ memset (a_key, 0, sizeof (*a_key));
+ a_key->app_index = a->app_index;
+ vec_validate (a_key->key, test_srv_key_rsa_len);
+ clib_memcpy (a_key->key, test_srv_key_rsa, test_srv_key_rsa_len);
+ vnet_app_add_tls_key (a_key);
+
return 0;
}
memset (a, 0, sizeof (*a));
a->app_index = hsm->app_index;
a->uri = "tcp://0.0.0.0/80";
+ if (hsm->uri)
+ a->uri = (char *) hsm->uri;
return vnet_bind_uri (a);
}
}
else if (unformat (input, "fifo-size %d", &hsm->fifo_size))
hsm->fifo_size <<= 10;
+ else if (unformat (input, "uri %s", &hsm->uri))
+ ;
else
return clib_error_return (0, "unknown input `%U'",
format_unformat_error, input);
if (is_static)
{
- http_server_session_cb_vft.builtin_server_rx_callback =
+ http_server_session_cb_vft.builtin_app_rx_callback =
http_server_rx_callback_static;
html = format (0, html_header_static);
static_http = format (0, http_response, vec_len (html), html);