build times - tested, there is no measureable difference before and
after this commit.
In this change:
use asterisk/compat.h to include a small set of system headers:
inttypes.h, unistd.h, stddef.h, stddint.h, sys/types.h, stdarg.h,
stdlib.h, alloca.h, stdio.h
Where available, the inclusion is conditional on HAVE_FOO_H as determined
by autoconf.
Normally, source files should not include any of the above system headers,
and instead use either "asterisk.h" or "asterisk/compat.h" which does it
better.
For the time being I have left alone second-level directories
(main/db1-ast, etc.).
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89333 65c4cc65-6c06-0410-ace0-fbb531ad65f3
*must* write the file to the FILE *, and not the raw fd. Otherwise, it breaks
TLS support.
Thanks to rizzo for catching this!
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@72738 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Handle transferring large files from the built-in http server. Previously, the
code attempted to malloc a block as large as the file itself. Now it uses the
sendfile() system call so that the file isn't copied into userspace at all if
it is available. Otherwise, it just uses a read/write of small chunks at a time.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@72701 65c4cc65-6c06-0410-ace0-fbb531ad65f3
places in the code where the same block of code for creating detached threads
was replicated. (patch from bbryant)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@65968 65c4cc65-6c06-0410-ace0-fbb531ad65f3
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r60603 | russell | 2007-04-06 15:58:43 -0500 (Fri, 06 Apr 2007) | 13 lines
To be able to achieve the things that we would like to achieve with the
Asterisk GUI project, we need a fully functional HTTP interface with access
to the Asterisk manager interface. One of the things that was intended to be
a part of this system, but was never actually implemented, was the ability for
the GUI to be able to upload files to Asterisk. So, this commit adds this in
the most minimally invasive way that we could come up with.
A lot of work on minimime was done by Steve Murphy. He fixed a lot of bugs in
the parser, and updated it to be thread-safe. The ability to check
permissions of active manager sessions was added by Dwayne Hubbard. Then,
hacking this all together and do doing the modifications necessary to the HTTP
interface was done by me.
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@60604 65c4cc65-6c06-0410-ace0-fbb531ad65f3
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
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
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
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
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
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
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
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
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
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
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