[PATCH] http server bind to interface
Nisan Bloch <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi All
a small patch to the http code to allow the http server to bin to a
specified interface.
Nisan
--- cvs/gateway/gwlib/http.c Sun Nov 17 11:46:30 2002
+++ gateway-work/gwlib/http.c Sun Nov 17 11:45:51 2002
@@ -1922,7 +1922,7 @@
}
-int http_open_port(int port, int ssl)
+int http_open_port_if(int port, int ssl, Octstr *interface)
{
struct server *p;
@@ -1931,8 +1931,7 @@
p = gw_malloc(sizeof(*p));
p->port = port;
p->ssl = ssl;
- p->fd = make_server_socket(port, NULL);
- /* XXX add interface_name if required */
+ p->fd = make_server_socket(port,
interface==NULL?NULL:octstr_get_cstr(interface));
if (p->fd == -1) {
gw_free(p);
return -1;
@@ -1945,6 +1944,11 @@
gwthread_wakeup(server_thread_id);
return 0;
+}
+
+int http_open_port(int port, int ssl)
+{
+ return http_open_port_if(port,ssl,NULL);
}
--- cvs/gateway/gwlib/http.h Sun Nov 17 11:46:31 2002
+++ gateway-work/gwlib/http.h Sun Nov 17 11:45:51 2002
@@ -272,6 +272,14 @@
* for SSL-enabled connections.
*/
int http_open_port(int port, int ssl);
+
+/*
+ * Same as http_open_port with the addition of specifing the interace
+ * to bind to
+ */
+int http_open_port_if(int port, int ssl, Octstr *interface);
+
+