dect
/
asterisk
Archived
13
0
Fork 0
Commit Graph

27 Commits

Author SHA1 Message Date
rizzo dcd0e21c1b Make externally visible some generic code useful to create
and implement services over tcp and/or tcp-tls.
 
This commit is nothing more than moving structure definitions
(and documentation) from main/http.c to include/asterisk/http.h
(temporary location until we find a better place), and removing the
'static' qualifier from server_root() and server_start().
 
The name change (adding the ast_ prefix as a minimum, and then
possibly a more meaningful name) is postponed to future commits.

Does not apply to other versions of asterisk.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@48324 f38db490-d61c-443f-a65b-d21fe96a405b
2006-12-06 16:17:57 +00:00
rizzo 9718f1cb7d In the previous commit i forgot to set the poll_timeout to -1,
causing the http threads to do busy waiting around the socket...

Fix the mistake, sorry for the inconvenience!



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@48074 f38db490-d61c-443f-a65b-d21fe96a405b
2006-11-28 00:02:42 +00:00
rizzo 4975453032 document the support for running a server on TCP/TLS and
opening an SSL socket.

We are almost ready to make this code available to other modules.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@48073 f38db490-d61c-443f-a65b-d21fe96a405b
2006-11-27 21:25:55 +00:00
rizzo ac91407f47 add a new http.conf option, sslbindaddr.
Because https is more secure than http, it usually
makes sense to keep this service more open than the
one on the unencrypted port.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@48071 f38db490-d61c-443f-a65b-d21fe96a405b
2006-11-27 20:21:40 +00:00
rizzo 3a0d25f9f8 in the helper thread, separate the FILE * creation from the actual
function doing work on the socket. This is another generalization
to provide a generic mechanism to open TCP/TLS socket with a thread
managing the accpet and children threads managing the individual
sessions.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@48067 f38db490-d61c-443f-a65b-d21fe96a405b
2006-11-27 19:19:48 +00:00
rizzo b728b58d5a staticize a global variable and remove an unused field structure.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@48062 f38db490-d61c-443f-a65b-d21fe96a405b
2006-11-27 18:51:10 +00:00
rizzo 461f2afa7c generalize a bit the functions used to create an tcp socket
and then run a service on it.
The code in manager.c does essentially the same things,
so we will be able to reuse the code in here (probably
moving it to netsock.c or another appropriate library file).



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@48008 f38db490-d61c-443f-a65b-d21fe96a405b
2006-11-25 17:37:04 +00:00
tilghman 278341b071 Merged revisions 47051 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r47051 | tilghman | 2006-11-02 17:00:20 -0600 (Thu, 02 Nov 2006) | 2 lines

Reverse change of "show" to "list" and make several other commands more consistent with "category verb arguments"

........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@47052 f38db490-d61c-443f-a65b-d21fe96a405b
2006-11-02 23:16:09 +00:00
rizzo bf08d70185 Fix a few issues in the previous (disabled) HTTPS code,
and support linux as well (using fopencookie(), which should
be available in glibc).

Update configure.ac to check for funopen (BSD) and fopencookie(glibc),
and while we are at it also for gethostbyname_r
(the generated files need to be updated, or you need
to run bootstrap.sh yourself).

Document the new options in http.conf.sample
(names are only tentative, better ones are welcome).

At this point we can safely enable the option.
Anyone willing to try this on Sun and Apple platforms ?



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45892 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-22 19:09:25 +00:00
rizzo 52f130cd55 Implement https support.
The changes are not large. Most of the diff comes from putting the
global variables describing an accept session into a structure, so
we can reuse the existing code for running multiple accept threads
on different ports.

Once this is done, and if your system has the funopen() library
function (and ssl, of course), it is just a matter of calling
the appropriate functions to set up the ssl connection on the
existing socket, and everything works on the secure channel now.

At the moment, the code is disabled because i have not implemented yet
the autoconf code to detect the presence of funopen(), and add -lssl
to main/Makefile if ssl libraries are present. And a bit of documentation
on the http.conf arguments, too.


If you want to manually enable https support, that is very simple
(step 0 1 2 will be eventually detected by ./configure, the
rest is something you will have to do anyways).

0. make sure your system has funopen(3). FreeBSD does, linux probably
   does too, not sure about other systems.

1. uncomment the following line in main/http.c
   // #define      DO_SSL  /* comment in/out if you want to support ssl */

2. add -lssl to AST_LIBS in main/Makefile

3. add the following options to http.conf

	sslenable=yes
	sslbindport=4433	; pick one you like
	sslcert=/tmp/foo.pem		; path to your certificate file.

4. generate a suitable certificate e.g. (example from mini_httpd's Makefile:

	openssl req -new -x509 -days 365 -nodes -out /tmp/foo.pem -keyout /tmp/foo.pem

and here you go:

	https://localhost:4433/asterisk/manager

now works.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45869 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-22 12:02:35 +00:00
rizzo 33d14223de it is useless and possibly wrong to use ast_cli() to send the
reply back to http clients.
Use fprintf/fwrite instead, since we are already using a FILE *
to read the input.

If you wonder why, this is because it makes it trivial to
implement https support (as long as your system has funopen()).

And this is what i am going to put in with the next few commits...



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45858 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-22 08:28:16 +00:00
rizzo 98620b2aef the default port number was erroneously stored in host order,
and reading from the config file used ntohs instead of htons.

this ought to be merged to 1.4 as well.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45836 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-21 20:24:04 +00:00
rizzo 196862402f introduce uri_decode() so that '+' are translated into ' '
(e.g. browsers do this when they encode input strings from a form).



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45474 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-18 05:27:22 +00:00
rizzo 0678982f62 various code simplifications to reduce nesting depth,
minor optimizations to avoid extra calls of strlen(),
and some variable localization.

One feature worth backporting is the move of ast_variables_destroy()
to a different place in handle_uri() to avoid leaking memory
in case a uri is not found.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45463 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-18 04:05:56 +00:00
rizzo 031898f74c comment some functions, and more small code simplifications
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45169 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-16 08:38:35 +00:00
rizzo 8ec107ece6 fix indentation of a large block after changes in previous commit
(basically whitespace only).



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45161 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-16 06:55:14 +00:00
rizzo f326543d3c simplify string parsing routines using ast_skip_*() functions.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45160 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-16 06:30:51 +00:00
rizzo 8b4ea66556 don't forget to close a descriptor on a malloc failure.
On passing, small rearrangement of the code to reduce indentation.

There is a bit more cleanup planned for this file, so a merge to 1.4
will be done when it is all done.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45152 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-15 20:54:15 +00:00
rizzo 454cf4267d typo: serer -> server
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45151 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-15 20:37:42 +00:00
rizzo d70733010d make sure sockets are blocking when they should be blocking.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@44568 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-06 15:59:57 +00:00
kpfleming 1a08d9e31b Merged revisions 44378 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r44378 | kpfleming | 2006-10-04 14:47:22 -0500 (Wed, 04 Oct 2006) | 4 lines

update thread creation code a bit
reduce standard thread stack size slightly to allow the pthreads library to allocate the stack+data and not overflow a power-of-2 allocation in the kernel and waste memory/address space
add a new stack size for 'background' threads (those that don't handle PBX calls) when LOW_MEMORY is defined

........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@44379 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-04 19:51:38 +00:00
mogorman 4a1aaf52ae bug #8076 check option_debug before printing to debug channel.
patch provided in bugnote, with minor changes.


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@44253 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-03 15:53:07 +00:00
tilghman 33d8fe4c3e Remove deprecated CLI apps from the core
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@43449 f38db490-d61c-443f-a65b-d21fe96a405b
2006-09-21 21:17:39 +00:00
qwell 46e384f88c After discussing this with other people, we decided we'd like to try to do this a little differently.
Stay tuned.


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@43290 f38db490-d61c-443f-a65b-d21fe96a405b
2006-09-19 19:58:09 +00:00
anthonyl ff5e99c7e0 5240 update
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@43289 f38db490-d61c-443f-a65b-d21fe96a405b
2006-09-19 19:28:57 +00:00
kpfleming 5aacb6a82d merge qwell's CLI verbification work
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@43212 f38db490-d61c-443f-a65b-d21fe96a405b
2006-09-18 19:54:18 +00:00
kpfleming 8b0c007ad9 merge new_loader_completion branch, including (at least):
- restructured build tree and makefiles to eliminate recursion problems
  - support for embedded modules
  - support for static builds
  - simpler cross-compilation support
  - simpler module/loader interface (no exported symbols)



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@40722 f38db490-d61c-443f-a65b-d21fe96a405b
2006-08-21 02:11:39 +00:00