Commit Graph

39 Commits

Author SHA1 Message Date
Kevin P. Fleming 4a1a0993f2 Merged revisions 58351-58352 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r58351 | kpfleming | 2007-03-08 08:17:17 -0500 (Thu, 08 Mar 2007) | 2 lines

fix two cases where HTTP session file descriptors would not be closed

........
r58352 | kpfleming | 2007-03-08 08:17:42 -0500 (Thu, 08 Mar 2007) | 2 lines

fix a compiler warning, and overwriting 'res' value

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@58353 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-03-08 13:21:38 +00:00
Russell Bryant 4cbce3356e Merged revisions 55634 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r55634 | russell | 2007-02-20 14:26:06 -0600 (Tue, 20 Feb 2007) | 3 lines

Add the Asterisk version information to the Server header in HTTP
responses.  (requested by Pari)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@55635 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-02-20 20:32:13 +00:00
Russell Bryant b233892198 Merged revisions 53046 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r53046 | russell | 2007-01-31 15:32:08 -0600 (Wed, 31 Jan 2007) | 11 lines

Merged revisions 53045 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r53045 | russell | 2007-01-31 15:25:11 -0600 (Wed, 31 Jan 2007) | 3 lines

Fix a bunch of places where pthread_attr_init() was called, but
pthread_attr_destroy() was not.

........

................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@53047 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-01-31 21:35:15 +00:00
Olle Johansson a9849288de Doxygen updates
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@51932 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-01-24 09:31:26 +00:00
Joshua Colp b712e10a13 Convert uri_redirects list to read/write locks.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@49027 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-12-28 20:05:00 +00:00
Joshua Colp 6d9273d0d8 Merged revisions 49024 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r49024 | qwell | 2006-12-28 14:52:46 -0500 (Thu, 28 Dec 2006) | 2 lines

make the uris_lock a rwlock instead of a mutex lock - needs to be forward ported to trunk

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@49026 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-12-28 20:02:41 +00:00
Kevin P. Fleming adca0ff14b Merged revisions 49006 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r49006 | kpfleming | 2006-12-27 16:06:56 -0600 (Wed, 27 Dec 2006) | 2 lines

since these variables all have static duration, none of them need initializers (they default to zero anyway)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@49008 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-12-27 22:14:33 +00:00
Russell Bryant 850dd4ea61 Use spaces as a separator for the redirect option to improve readability
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@48947 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-12-24 21:01:02 +00:00
Russell Bryant 5d5cc243c6 Simplify the definition of http_uri_redirect such that only one allocation is
done for exactly how much memory is needed.  This was suggested by Luigi on
the asterisk-dev mailing list.  Thanks!


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@48933 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-12-24 03:29:42 +00:00
Russell Bryant 2c5071a006 - Convert the list of URI handlers to use the linked list macros. While doing
this, implementing locking of this list to make it thread-safe.

- Add a "redirect" option to http.conf that allows redirecting one URI to
  another.  I was inspired to do this while playing with the Asterisk GUI.  I
  got tired of typing this URL to get to the GUI:
     
     http://localhost:8088/asterisk/static/config/cfgadvanced.html

  So, now I have the following line in http.conf:

     redirect=/=/asterisk/static/config/cfgadvanced.html

  Now, I can type the following into my browser and go to the GUI:

     http://localhost:8088


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@48930 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-12-23 20:13:14 +00:00
Luigi Rizzo 20b382cfff replace ast_build_string() with ast_str_*() functions.
This makes the code easier to follow and saves some
copies to intermediate buffers.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@48515 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-12-16 09:33:31 +00:00
Luigi Rizzo 437f4288cd - Generalize the function ssl_setup() so that the certificate info
are passed as an argument.

- Update the code in main/http.c to use the new interface
  (the diff is large but mostly mechanical, due to the name change of
  several variables);

- And since now it is trivial, implement "AMI over TLS", and document
  the possible options in manager.conf

- And since the test client (openssl s_client -connect host:port )
  does not generate \r\n as a line terminator, make get_input()
  also accept just a \n as a line terminator (Mac users: do you
  also need the \r-only version ?)
 
The option parsing in manager.conf is not very efficient, and needs
to be cleaned up and made similar to what we have in http.conf



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@48351 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-12-07 16:42:29 +00:00
Luigi Rizzo 6a147ed134 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: https://origsvn.digium.com/svn/asterisk/trunk@48324 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-12-06 16:17:57 +00:00
Luigi Rizzo da80478d94 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: https://origsvn.digium.com/svn/asterisk/trunk@48074 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-28 00:02:42 +00:00
Luigi Rizzo 7a6914a126 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: https://origsvn.digium.com/svn/asterisk/trunk@48073 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-27 21:25:55 +00:00
Luigi Rizzo 2e7fd7cbdb 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: https://origsvn.digium.com/svn/asterisk/trunk@48071 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-27 20:21:40 +00:00
Luigi Rizzo 3637b60b19 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: https://origsvn.digium.com/svn/asterisk/trunk@48067 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-27 19:19:48 +00:00
Luigi Rizzo a381d3552e staticize a global variable and remove an unused field structure.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@48062 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-27 18:51:10 +00:00
Luigi Rizzo 2657279cb5 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: https://origsvn.digium.com/svn/asterisk/trunk@48008 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-25 17:37:04 +00:00
Tilghman Lesher 10875731ec 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: https://origsvn.digium.com/svn/asterisk/trunk@47052 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-02 23:16:09 +00:00
Luigi Rizzo c15f7953c8 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: https://origsvn.digium.com/svn/asterisk/trunk@45892 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-22 19:09:25 +00:00
Luigi Rizzo e8a65b7155 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: https://origsvn.digium.com/svn/asterisk/trunk@45869 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-22 12:02:35 +00:00
Luigi Rizzo 5aa25a8d33 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: https://origsvn.digium.com/svn/asterisk/trunk@45858 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-22 08:28:16 +00:00
Luigi Rizzo a0ae6ebd8e 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: https://origsvn.digium.com/svn/asterisk/trunk@45836 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-21 20:24:04 +00:00
Luigi Rizzo fbe6c86b0b introduce uri_decode() so that '+' are translated into ' '
(e.g. browsers do this when they encode input strings from a form).



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@45474 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-18 05:27:22 +00:00
Luigi Rizzo d1058df18f 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: https://origsvn.digium.com/svn/asterisk/trunk@45463 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-18 04:05:56 +00:00
Luigi Rizzo 97fc34d450 comment some functions, and more small code simplifications
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@45169 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-16 08:38:35 +00:00
Luigi Rizzo 250ad2ad7e fix indentation of a large block after changes in previous commit
(basically whitespace only).



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@45161 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-16 06:55:14 +00:00
Luigi Rizzo 9146e44403 simplify string parsing routines using ast_skip_*() functions.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@45160 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-16 06:30:51 +00:00
Luigi Rizzo 895eb4fd73 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: https://origsvn.digium.com/svn/asterisk/trunk@45152 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-15 20:54:15 +00:00
Luigi Rizzo 9a3cef21ac typo: serer -> server
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@45151 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-15 20:37:42 +00:00
Luigi Rizzo 3f641c6048 make sure sockets are blocking when they should be blocking.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@44568 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-06 15:59:57 +00:00
Kevin P. Fleming 3c876af5cf 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: https://origsvn.digium.com/svn/asterisk/trunk@44379 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-04 19:51:38 +00:00
Matt O'Gorman ae8cc3e18b bug #8076 check option_debug before printing to debug channel.
patch provided in bugnote, with minor changes.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@44253 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-03 15:53:07 +00:00
Tilghman Lesher 2b55678e1f Remove deprecated CLI apps from the core
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@43449 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-09-21 21:17:39 +00:00
Jason Parker fc60c151d3 After discussing this with other people, we decided we'd like to try to do this a little differently.
Stay tuned.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@43290 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-09-19 19:58:09 +00:00
Anthony LaMantia 3f3402d69e 5240 update
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@43289 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-09-19 19:28:57 +00:00
Kevin P. Fleming fcb999c01c merge qwell's CLI verbification work
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@43212 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-09-18 19:54:18 +00:00
Kevin P. Fleming 0a27d8bfe5 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: https://origsvn.digium.com/svn/asterisk/trunk@40722 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-08-21 02:11:39 +00:00