Initial import
这个提交包含在:
父节点
316c558692
当前提交
b0c2270f15
|
@ -0,0 +1,339 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
|
@ -0,0 +1,45 @@
|
|||
CC = gcc
|
||||
CFLAGS = -O2 -s -D_GNU_SOURCE
|
||||
LDLIBS = -lcrypt -lcyassl -lm
|
||||
PREFIX =
|
||||
BINDIR = $(PREFIX)/usr/sbin
|
||||
|
||||
ifeq ($(CROSS_BUILD), 1)
|
||||
DEFS:=-DCROSS_BUILD
|
||||
else
|
||||
DEFS:=
|
||||
endif
|
||||
|
||||
all: kuhttpd cert
|
||||
@echo "All done!"
|
||||
|
||||
kuhttpd: kuhttpd.o match.o dateparse.o
|
||||
$(CC) $(CFLAGS) $(LDLIBS) kuhttpd.o match.o dateparse.o -o kuhttpd
|
||||
|
||||
kuhttpd.o: kuhttpd.c
|
||||
$(CC) $(CFLAGS) $(DEFS) -c kuhttpd.c
|
||||
|
||||
match.o: match.c
|
||||
$(CC) $(CFLAGS) $(DEFS) -c match.c
|
||||
|
||||
dateparse.o: dateparse.c
|
||||
$(CC) $(CFLAGS) $(DEFS) -c dateparse.c
|
||||
|
||||
cert: kuhttpd.pem
|
||||
kuhttpd.pem: kuhttpd.cnf
|
||||
openssl req -batch -new -x509 -days 7500 -nodes -config kuhttpd.cnf -out kuhttpd.pem -keyout kuhttpd.pem
|
||||
openssl x509 -subject -dates -fingerprint -noout -in kuhttpd.pem
|
||||
chmod 600 kuhttpd.pem
|
||||
|
||||
install:
|
||||
mkdir -p $(BINDIR)
|
||||
cp kuhttpd $(BINDIR)
|
||||
@echo "All done!"
|
||||
|
||||
uninstall:
|
||||
@rm -f $(BINDIR)/kuhttpd
|
||||
@echo "All done!"
|
||||
|
||||
clean:
|
||||
rm -f kuhttpd kuhttpd.pem kuhttpd.rnd *.o
|
||||
@echo "All done!"
|
|
@ -0,0 +1,21 @@
|
|||
Kagera Micro HTTP Daemon
|
||||
========================
|
||||
|
||||
KUHTTP Daemon is a micro HTTP server optimised for size and low and medium
|
||||
traffic sites. It is dedicated to serve configuration sites on Linux-based
|
||||
routers as well as some additional pages like Captive Portals. It implements
|
||||
all the basic features of an HTTP server, including:
|
||||
|
||||
* GET, HEAD, and POST methods
|
||||
* CGI process communication
|
||||
* Multilanguage CGI
|
||||
* Basic authentication
|
||||
* IPv6 and SSL/HTTPS communication
|
||||
* Directory listings
|
||||
* The common MIME types
|
||||
* Trailing-slash redirection
|
||||
* Security against ".." filename snooping
|
||||
* Standard logging
|
||||
|
||||
|
||||
KUHTTP Daemon is based on mini_httpd: <http://acme.com/software/mini_httpd/>.
|
|
@ -0,0 +1,187 @@
|
|||
/**
|
||||
* @PROJECT Kagera uHTTP Daemon
|
||||
* @COPYRIGHT See COPYING in the top level directory
|
||||
* @FILE dateparse.c
|
||||
* @PURPOSE Parses string dates into internal form
|
||||
* @DEVELOPERS Rafal Kupiec <belliash@asiotec.eu.org>
|
||||
* Jef Poskanzer <jef@acme.com>
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "dateparse.h"
|
||||
|
||||
time_t dateparse(char* str) {
|
||||
struct tm tm;
|
||||
char* cp;
|
||||
char str_mon[500], str_wday[500];
|
||||
int tm_sec, tm_min, tm_hour, tm_mday, tm_year;
|
||||
long tm_mon, tm_wday;
|
||||
|
||||
(void) memset((char*) &tm, 0, sizeof(struct tm));
|
||||
for(cp = str; *cp == ' ' || *cp == '\t'; ++cp) {
|
||||
continue;
|
||||
}
|
||||
if(sscanf(cp, "%d-%400[a-zA-Z]-%d %d:%d:%d GMT", &tm_mday, str_mon, &tm_year, &tm_hour, &tm_min, &tm_sec) == 6 && scan_mon(str_mon, &tm_mon)) {
|
||||
tm.tm_mday = tm_mday;
|
||||
tm.tm_mon = tm_mon;
|
||||
tm.tm_year = tm_year;
|
||||
tm.tm_hour = tm_hour;
|
||||
tm.tm_min = tm_min;
|
||||
tm.tm_sec = tm_sec;
|
||||
} else if(sscanf(cp, "%d %400[a-zA-Z] %d %d:%d:%d GMT", &tm_mday, str_mon, &tm_year, &tm_hour, &tm_min, &tm_sec) == 6 && scan_mon(str_mon, &tm_mon)) {
|
||||
tm.tm_mday = tm_mday;
|
||||
tm.tm_mon = tm_mon;
|
||||
tm.tm_year = tm_year;
|
||||
tm.tm_hour = tm_hour;
|
||||
tm.tm_min = tm_min;
|
||||
tm.tm_sec = tm_sec;
|
||||
} else if(sscanf(cp, "%d:%d:%d GMT %d-%400[a-zA-Z]-%d", &tm_hour, &tm_min, &tm_sec, &tm_mday, str_mon, &tm_year) == 6 && scan_mon(str_mon, &tm_mon)) {
|
||||
tm.tm_hour = tm_hour;
|
||||
tm.tm_min = tm_min;
|
||||
tm.tm_sec = tm_sec;
|
||||
tm.tm_mday = tm_mday;
|
||||
tm.tm_mon = tm_mon;
|
||||
tm.tm_year = tm_year;
|
||||
} else if(sscanf(cp, "%d:%d:%d GMT %d %400[a-zA-Z] %d", &tm_hour, &tm_min, &tm_sec, &tm_mday, str_mon, &tm_year) == 6 && scan_mon(str_mon, &tm_mon)) {
|
||||
tm.tm_hour = tm_hour;
|
||||
tm.tm_min = tm_min;
|
||||
tm.tm_sec = tm_sec;
|
||||
tm.tm_mday = tm_mday;
|
||||
tm.tm_mon = tm_mon;
|
||||
tm.tm_year = tm_year;
|
||||
} else if(sscanf(cp, "%400[a-zA-Z], %d-%400[a-zA-Z]-%d %d:%d:%d GMT", str_wday, &tm_mday, str_mon, &tm_year, &tm_hour, &tm_min, &tm_sec) == 7 && scan_wday(str_wday, &tm_wday) && scan_mon(str_mon, &tm_mon)) {
|
||||
tm.tm_wday = tm_wday;
|
||||
tm.tm_mday = tm_mday;
|
||||
tm.tm_mon = tm_mon;
|
||||
tm.tm_year = tm_year;
|
||||
tm.tm_hour = tm_hour;
|
||||
tm.tm_min = tm_min;
|
||||
tm.tm_sec = tm_sec;
|
||||
} else if(sscanf(cp, "%400[a-zA-Z], %d %400[a-zA-Z] %d %d:%d:%d GMT", str_wday, &tm_mday, str_mon, &tm_year, &tm_hour, &tm_min, &tm_sec) == 7 && scan_wday(str_wday, &tm_wday) && scan_mon(str_mon, &tm_mon)) {
|
||||
tm.tm_wday = tm_wday;
|
||||
tm.tm_mday = tm_mday;
|
||||
tm.tm_mon = tm_mon;
|
||||
tm.tm_year = tm_year;
|
||||
tm.tm_hour = tm_hour;
|
||||
tm.tm_min = tm_min;
|
||||
tm.tm_sec = tm_sec;
|
||||
} else if(sscanf(cp, "%400[a-zA-Z] %400[a-zA-Z] %d %d:%d:%d GMT %d", str_wday, str_mon, &tm_mday, &tm_hour, &tm_min, &tm_sec, &tm_year) == 7 && scan_wday(str_wday, &tm_wday) && scan_mon(str_mon, &tm_mon)) {
|
||||
tm.tm_wday = tm_wday;
|
||||
tm.tm_mon = tm_mon;
|
||||
tm.tm_mday = tm_mday;
|
||||
tm.tm_hour = tm_hour;
|
||||
tm.tm_min = tm_min;
|
||||
tm.tm_sec = tm_sec;
|
||||
tm.tm_year = tm_year;
|
||||
} else {
|
||||
return (time_t) -1;
|
||||
}
|
||||
if(tm.tm_year > 1900) {
|
||||
tm.tm_year -= 1900;
|
||||
} else if(tm.tm_year < 70) {
|
||||
tm.tm_year += 100;
|
||||
}
|
||||
return tm_to_time(&tm);
|
||||
}
|
||||
|
||||
static int is_leap(int year) {
|
||||
return year % 400? (year % 100 ? (year % 4 ? 0 : 1) : 0) : 1;
|
||||
}
|
||||
|
||||
static void pound_case(char* str) {
|
||||
for(; *str != '\0'; ++str) {
|
||||
if(isupper((int) *str)) {
|
||||
*str = tolower((int) *str);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int scan_mon(char* str_mon, long* tm_monP) {
|
||||
static struct strlong mon_tab[] = {
|
||||
{ "jan", 0 }, { "january", 0 },
|
||||
{ "feb", 1 }, { "february", 1 },
|
||||
{ "mar", 2 }, { "march", 2 },
|
||||
{ "apr", 3 }, { "april", 3 },
|
||||
{ "may", 4 },
|
||||
{ "jun", 5 }, { "june", 5 },
|
||||
{ "jul", 6 }, { "july", 6 },
|
||||
{ "aug", 7 }, { "august", 7 },
|
||||
{ "sep", 8 }, { "september", 8 },
|
||||
{ "oct", 9 }, { "october", 9 },
|
||||
{ "nov", 10 }, { "november", 10 },
|
||||
{ "dec", 11 }, { "december", 11 },
|
||||
};
|
||||
static int sorted = 0;
|
||||
if(!sorted) {
|
||||
(void) qsort(mon_tab, sizeof(mon_tab) / sizeof(struct strlong), sizeof(struct strlong), (int(*)(const void*, const void*)) strlong_compare);
|
||||
sorted = 1;
|
||||
}
|
||||
pound_case(str_mon);
|
||||
return strlong_search(str_mon, mon_tab, sizeof(mon_tab) / sizeof(struct strlong), tm_monP);
|
||||
}
|
||||
|
||||
static int scan_wday(char* str_wday, long* tm_wdayP) {
|
||||
static struct strlong wday_tab[] = {
|
||||
{ "sun", 0 }, { "sunday", 0 },
|
||||
{ "mon", 1 }, { "monday", 1 },
|
||||
{ "tue", 2 }, { "tuesday", 2 },
|
||||
{ "wed", 3 }, { "wednesday", 3 },
|
||||
{ "thu", 4 }, { "thursday", 4 },
|
||||
{ "fri", 5 }, { "friday", 5 },
|
||||
{ "sat", 6 }, { "saturday", 6 },
|
||||
};
|
||||
static int sorted = 0;
|
||||
if(!sorted) {
|
||||
(void) qsort(wday_tab, sizeof(wday_tab) / sizeof(struct strlong), sizeof(struct strlong), (int(*)(const void*, const void*)) strlong_compare);
|
||||
sorted = 1;
|
||||
}
|
||||
pound_case(str_wday);
|
||||
return strlong_search(str_wday, wday_tab, sizeof(wday_tab) / sizeof(struct strlong), tm_wdayP);
|
||||
}
|
||||
|
||||
static int strlong_compare(char *v1, char *v2) {
|
||||
return strcmp(((struct strlong*) v1)->s, ((struct strlong*) v2)->s);
|
||||
}
|
||||
|
||||
static int strlong_search(char* str, struct strlong* tab, int n, long* lP) {
|
||||
int i, h, l, r;
|
||||
l = 0;
|
||||
h = n - 1;
|
||||
for(;;) {
|
||||
i = (h + l) / 2;
|
||||
r = strcmp(str, tab[i].s);
|
||||
if(r < 0) {
|
||||
h = i - 1;
|
||||
} else if(r > 0) {
|
||||
l = i + 1;
|
||||
} else {
|
||||
*lP = tab[i].l;
|
||||
return 1;
|
||||
}
|
||||
if(h < l) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static time_t tm_to_time(struct tm* tmP) {
|
||||
time_t t;
|
||||
static int monthtab[12] = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 };
|
||||
t = (tmP->tm_year - 70) * 365;
|
||||
t += (tmP->tm_year - 69) / 4;
|
||||
t += monthtab[tmP->tm_mon];
|
||||
if(tmP->tm_mon >= 2 && is_leap(tmP->tm_year + 1900)) {
|
||||
++t;
|
||||
}
|
||||
t += tmP->tm_mday - 1;
|
||||
t = t * 24 + tmP->tm_hour;
|
||||
t = t * 60 + tmP->tm_min;
|
||||
t = t * 60 + tmP->tm_sec;
|
||||
return t;
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
/**
|
||||
* @PROJECT Kagera uHTTP Daemon
|
||||
* @COPYRIGHT See COPYING in the top level directory
|
||||
* @FILE dateparse.h
|
||||
* @PURPOSE Parses string dates into internal form
|
||||
* @DEVELOPERS Rafal Kupiec <belliash@asiotec.eu.org>
|
||||
* Jef Poskanzer <jef@acme.com>
|
||||
*/
|
||||
|
||||
#ifndef __DATEPARSE_H
|
||||
#define __DATEPARSE_H
|
||||
|
||||
struct strlong {
|
||||
char* s;
|
||||
long l;
|
||||
};
|
||||
|
||||
extern time_t dateparse(char* str);
|
||||
static int is_leap(int year);
|
||||
static void pound_case(char* str);
|
||||
static int scan_mon(char* str_mon, long* tm_monP);
|
||||
static int scan_wday(char* str_wday, long* tm_wdayP);
|
||||
static int strlong_compare(char *v1, char *v2);
|
||||
static int strlong_search(char* str, struct strlong* tab, int n, long* lP);
|
||||
static time_t tm_to_time(struct tm* tmP);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,23 @@
|
|||
RANDFILE = kuhttpd.rnd
|
||||
|
||||
[req]
|
||||
default_bits = 1024
|
||||
encrypt_key = yes
|
||||
distinguished_name = req_dn
|
||||
x509_extensions = cert_type
|
||||
|
||||
[req_dn]
|
||||
countryName = Country Name (2 letter code)
|
||||
countryName_default = EU
|
||||
countryName_min = 2
|
||||
countryName_max = 2
|
||||
stateOrProvinceName = State or Province Name (full name)
|
||||
stateOrProvinceName_default = European Union
|
||||
localityName = European Union
|
||||
organizationName = Organization Name (eg, company)
|
||||
organizationName_default = Asio Software Technologies
|
||||
commonName = Common Name (FQDN of your server)
|
||||
commonName_default = Kagera Router Management Utility
|
||||
|
||||
[cert_type]
|
||||
nsCertType = server
|
|
@ -0,0 +1,198 @@
|
|||
/**
|
||||
* @PROJECT Kagera uHTTP Daemon
|
||||
* @COPYRIGHT See COPYING in the top level directory
|
||||
* @FILE kuhttpd.h
|
||||
* @PURPOSE HTTP Server
|
||||
* @DEVELOPERS Rafal Kupiec <belliash@asiotec.eu.org>
|
||||
* Jef Poskanzer <jef@acme.com>
|
||||
*/
|
||||
|
||||
#ifndef __KUHTTPD_H
|
||||
#define __KUHTTPD_H
|
||||
|
||||
#define STDIN_FILENO 0
|
||||
#define STDOUT_FILENO 1
|
||||
#define STDERR_FILENO 2
|
||||
#define SIZE_T_MAX 2147483647L
|
||||
|
||||
#define ERR_DIR "errors"
|
||||
#define DEFAULT_HTTP_PORT 80
|
||||
#define DEFAULT_HTTPS_PORT 443
|
||||
#define DEFAULT_CERTFILE "kuhttpd.pem"
|
||||
#define DEFAULT_CHARSET "UTF-8"
|
||||
#define DEFAULT_LANGUAGE "english"
|
||||
#define DEFAULT_CGI_PATTERN "cgi-bin/**|**.cgi|**.sh"
|
||||
#define DEFAULT_USER "nobody"
|
||||
#define CGI_NICE 10
|
||||
#define CGI_PATH "/usr/local/bin:/usr/ucb:/bin:/usr/bin:/usr/local/sbin:/sbin:/usr/sbin"
|
||||
#define CGI_LD_LIBRARY_PATH "/usr/local/lib:/usr/lib:/lib"
|
||||
#define AUTH_FILE ".htpasswd"
|
||||
#define READ_TIMEOUT 60
|
||||
#define WRITE_TIMEOUT 300
|
||||
|
||||
#define METHOD_UNKNOWN 0
|
||||
#define METHOD_GET 1
|
||||
#define METHOD_HEAD 2
|
||||
#define METHOD_POST 3
|
||||
|
||||
#define SERVER_SOFTWARE "Kagera uHTTP Daemon 1.4"
|
||||
|
||||
struct mime_entry {
|
||||
char* ext;
|
||||
size_t ext_len;
|
||||
char* val;
|
||||
size_t val_len;
|
||||
};
|
||||
|
||||
typedef union {
|
||||
struct sockaddr sa;
|
||||
struct sockaddr_in sa_in;
|
||||
struct sockaddr_in6 sa_in6;
|
||||
struct sockaddr_storage sa_stor;
|
||||
} usockaddr;
|
||||
|
||||
static int b64_decode_table[256] = {
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63,
|
||||
52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-1,-1,-1,
|
||||
-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,
|
||||
15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,
|
||||
-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,
|
||||
41,42,43,44,45,46,47,48,49,50,51,-1,-1,-1,-1,-1,
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
|
||||
};
|
||||
|
||||
static unsigned char allowDirectoryListing;
|
||||
static char* argv0;
|
||||
static char* data_dir;
|
||||
static char* certfile;
|
||||
static char* cgi_pattern;
|
||||
static char* charset;
|
||||
static char* language;
|
||||
static char* cipher;
|
||||
static char cwd[MAXPATHLEN];
|
||||
static int debug;
|
||||
static char* defaultPageFile;
|
||||
static char* defaultRealmName;
|
||||
static char* defaultRealmPasswordFile;
|
||||
static char* dir;
|
||||
static int do_ssl;
|
||||
static int got_hup;
|
||||
static char* hostname;
|
||||
static char hostname_buf[500];
|
||||
static int listen4_fd, listen6_fd;
|
||||
static int listen4s_fd, listen6s_fd;
|
||||
static char* local_pattern;
|
||||
static char* logfile;
|
||||
static FILE* logfp;
|
||||
static int max_age;
|
||||
static int no_empty_referers;
|
||||
static char* p3p;
|
||||
static char* pageNotFoundFile;
|
||||
static char* pidfile;
|
||||
static unsigned short port;
|
||||
static SSL_CTX* ssl_ctx;
|
||||
static unsigned short sslPort;
|
||||
static char* url_pattern;
|
||||
static char* user;
|
||||
|
||||
static off_t bytes;
|
||||
static usockaddr client_addr;
|
||||
static int conn_fd;
|
||||
static char* file;
|
||||
static int method;
|
||||
static char* path;
|
||||
static char* pathinfo;
|
||||
static char* protocol;
|
||||
static char* query;
|
||||
static char* request;
|
||||
static size_t request_size, request_len, request_idx;
|
||||
struct stat sb;
|
||||
static SSL* ssl;
|
||||
static int status;
|
||||
|
||||
static char* authorization;
|
||||
static size_t content_length;
|
||||
static char* content_type;
|
||||
static char* cookie;
|
||||
static char* host;
|
||||
static time_t if_modified_since;
|
||||
static char* referer;
|
||||
static char* remoteuser;
|
||||
static char* response;
|
||||
static size_t response_size, response_len;
|
||||
static char* useragent;
|
||||
|
||||
static void add_headers(int s, char* title, char* extra_header, char* me, char* mt, off_t b, time_t mod);
|
||||
static void add_to_buf(char** bufP, size_t* bufsizeP, size_t* buflenP, char* str, size_t len);
|
||||
static void add_to_request(char* str, size_t len);
|
||||
static void add_to_response(char* str, size_t len);
|
||||
static void auth_check(char* dirname, int is_ssl);
|
||||
static int b64_decode(const char* str, unsigned char* space, int size);
|
||||
static char* build_env(char* fmt, char* arg);
|
||||
static void cgi_interpose_input(int wfd, int is_ssl);
|
||||
static void cgi_interpose_output(int rfd, int parse_headers, int is_ssl);
|
||||
static void check_referer(int is_ssl);
|
||||
static void clear_ndelay(int fd);
|
||||
extern char* crypt(const char* key, const char* setting);
|
||||
static void de_dotdot(char* file);
|
||||
static void do_cgi(int is_ssl, unsigned short port);
|
||||
static void do_dir(int is_ssl);
|
||||
static void do_file(int is_ssl, unsigned short conn_port);
|
||||
static void* e_malloc(size_t size);
|
||||
static void* e_realloc(void* optr, size_t size);
|
||||
static char* e_strdup(char* ostr);
|
||||
static const char* figure_mime(char* name, char* me, size_t me_size);
|
||||
static char* file_details(const char* dir, const char* name);
|
||||
static char* get_method_str(int m);
|
||||
static int get_pathinfo(void);
|
||||
static char* get_request_line(void);
|
||||
static void handle_read_timeout(int sig, int is_ssl);
|
||||
static void handle_read_timeout_sig(int sig);
|
||||
static void handle_request(int is_ssl, unsigned short conn_port);
|
||||
static void handle_sigchld(int sig);
|
||||
static void handle_sighup(int sig);
|
||||
static void handle_sigterm(int sig);
|
||||
static void handle_write_timeout(int sig);
|
||||
static int hexit(char c);
|
||||
static void init_mime(void);
|
||||
static int initialize_listen_socket(usockaddr* usaP);
|
||||
static void lookup_hostname(usockaddr* usa4P, usockaddr* usa4sP, size_t sa4_len, int* gotv4P, int* gotv4sP, usockaddr* usa6P, usockaddr* usa6sP, size_t sa6_len, int* gotv6P, int* gotv6sP);
|
||||
static char** make_argp(void);
|
||||
static char** make_envp(int is_sl, unsigned short port);
|
||||
static void make_log_entry(void);
|
||||
static char* ntoa(usockaddr* usaP);
|
||||
static ssize_t my_read(char* buf, size_t size, int is_ssl);
|
||||
static ssize_t my_write(char* buf, size_t size, int is_ssl);
|
||||
static void no_value_required(char* name, char* value);
|
||||
static void post_post_garbage_hack(int is_ssl);
|
||||
static void read_config(char* filename);
|
||||
static int really_check_referer(void);
|
||||
static void reopen_logfile(void);
|
||||
static void send_authenticate(char* realm, int is_ssl);
|
||||
static void send_error(int s, char* title, char* extra_header, char* text, int is_ssl);
|
||||
static void send_error_body(int s, char* title, char* text);
|
||||
static int send_error_file(char* filename);
|
||||
static void send_error_tail(void);
|
||||
static void send_redirect(char* extra_header, char* hostname, char* new_location, int is_ssl);
|
||||
static void send_response(int is_ssl);
|
||||
static void send_via_write(int fd, off_t size, int is_ssl);
|
||||
static void set_ndelay(int fd);
|
||||
static int sockaddr_check(usockaddr* usaP);
|
||||
static size_t sockaddr_len(usockaddr* usaP);
|
||||
static void start_request(void);
|
||||
static void start_response(void);
|
||||
static void strdecode(char* to, char* from);
|
||||
static void strencode(char* to, size_t tosize, const char* from);
|
||||
static void usage(void);
|
||||
static void value_required(char* name, char* value);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,60 @@
|
|||
/**
|
||||
* @PROJECT Kagera uHTTP Daemon
|
||||
* @COPYRIGHT See COPYING in the top level directory
|
||||
* @FILE match.c
|
||||
* @PURPOSE Simple shell-style filename matcher
|
||||
* @DEVELOPERS Rafal Kupiec <belliash@asiotec.eu.org>
|
||||
* Jef Poskanzer <jef@acme.com>
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "match.h"
|
||||
|
||||
int match(const char* pattern, const char* string) {
|
||||
const char* or;
|
||||
|
||||
for(;;) {
|
||||
or = strchr( pattern, '|' );
|
||||
if(or == (char*) 0) {
|
||||
return match_one(pattern, strlen(pattern), string);
|
||||
}
|
||||
if(match_one( pattern, or - pattern, string)) {
|
||||
return 1;
|
||||
}
|
||||
pattern = or + 1;
|
||||
}
|
||||
}
|
||||
|
||||
static int match_one(const char* pattern, int patternlen, const char* string) {
|
||||
const char* p;
|
||||
for(p = pattern; p - pattern < patternlen; ++p, ++string) {
|
||||
if(*p == '?' && *string != '\0') {
|
||||
continue;
|
||||
}
|
||||
if(*p == '*') {
|
||||
int i, pl;
|
||||
++p;
|
||||
if(*p == '*') {
|
||||
++p;
|
||||
i = strlen(string);
|
||||
} else {
|
||||
i = strcspn(string, "/");
|
||||
}
|
||||
pl = patternlen - (p - pattern);
|
||||
for(; i >= 0; --i) {
|
||||
if(match_one(p, pl, &(string[i]))) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
if(*p != *string) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if(*string == '\0') {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
/**
|
||||
* @PROJECT Kagera uHTTP Daemon
|
||||
* @COPYRIGHT See COPYING in the top level directory
|
||||
* @FILE match.h
|
||||
* @PURPOSE Simple shell-style filename matcher
|
||||
* @DEVELOPERS Rafal Kupiec <belliash@asiotec.eu.org>
|
||||
* Jef Poskanzer <jef@acme.com>
|
||||
*/
|
||||
|
||||
#ifndef __MATCH_H
|
||||
#define __MATCH_H
|
||||
|
||||
extern int match(const char* pattern, const char* string);
|
||||
static int match_one(const char* pattern, int patternlen, const char* string);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,20 @@
|
|||
/**
|
||||
* @PROJECT Kagera uHTTP Daemon
|
||||
* @COPYRIGHT See COPYING in the top level directory
|
||||
* @FILE mime_enc.h
|
||||
* @PURPOSE MIME encodings list
|
||||
* @DEVELOPERS Rafal Kupiec <belliash@asiotec.eu.org>
|
||||
*/
|
||||
|
||||
#ifndef __MIME_ENC_H
|
||||
#define __MIME_ENC_H
|
||||
|
||||
static struct mime_entry enc_tab[] = {
|
||||
{ "Z", 0, "compress", 0 },
|
||||
{ "gz", 0, "gzip", 0 },
|
||||
{ "uu", 0, "x-uuencode", 0 },
|
||||
};
|
||||
|
||||
static const int n_enc_tab = sizeof(enc_tab) / sizeof(*enc_tab);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,207 @@
|
|||
/**
|
||||
* @PROJECT Kagera uHTTP Daemon
|
||||
* @COPYRIGHT See COPYING in the top level directory
|
||||
* @FILE mime_typ.h
|
||||
* @PURPOSE MIME types list
|
||||
* @DEVELOPERS Rafal Kupiec <belliash@asiotec.eu.org>
|
||||
*/
|
||||
|
||||
#ifndef __MIME_TYP_H
|
||||
#define __MIME_TYP_H
|
||||
|
||||
static struct mime_entry typ_tab[] = {
|
||||
{ "a", 0, "application/octet-stream", 0 },
|
||||
{ "aab", 0, "application/x-authorware-bin", 0 },
|
||||
{ "aam", 0, "application/x-authorware-map", 0 },
|
||||
{ "aas", 0, "application/x-authorware-seg", 0 },
|
||||
{ "ai", 0, "application/postscript", 0 },
|
||||
{ "aif", 0, "audio/x-aiff", 0 },
|
||||
{ "aifc", 0, "audio/x-aiff", 0 },
|
||||
{ "aiff", 0, "audio/x-aiff", 0 },
|
||||
{ "asc", 0, "text/plain", 0 },
|
||||
{ "asf", 0, "video/x-ms-asf", 0 },
|
||||
{ "asx", 0, "video/x-ms-asf", 0 },
|
||||
{ "au", 0, "audio/basic", 0 },
|
||||
{ "avi", 0, "video/x-msvideo", 0 },
|
||||
{ "bcpio", 0, "application/x-bcpio", 0 },
|
||||
{ "bin", 0, "application/octet-stream", 0 },
|
||||
{ "bmp", 0, "image/bmp", 0 },
|
||||
{ "cdf", 0, "application/x-netcdf", 0 },
|
||||
{ "class", 0, "application/x-java-vm", 0 },
|
||||
{ "cpio", 0, "application/x-cpio", 0 },
|
||||
{ "cpt", 0, "application/mac-compactpro", 0 },
|
||||
{ "crl", 0, "application/x-pkcs7-crl", 0 },
|
||||
{ "crt", 0, "application/x-x509-ca-cert", 0 },
|
||||
{ "csh", 0, "application/x-csh", 0 },
|
||||
{ "css", 0, "text/css", 0 },
|
||||
{ "dcr", 0, "application/x-director", 0 },
|
||||
{ "dir", 0, "application/x-director", 0 },
|
||||
{ "djv", 0, "image/vnd.djvu", 0 },
|
||||
{ "djvu", 0, "image/vnd.djvu", 0 },
|
||||
{ "dll", 0, "application/octet-stream", 0 },
|
||||
{ "dms", 0, "application/octet-stream", 0 },
|
||||
{ "doc", 0, "application/msword", 0 },
|
||||
{ "dtd", 0, "text/xml", 0 },
|
||||
{ "dump", 0, "application/octet-stream", 0 },
|
||||
{ "dvi", 0, "application/x-dvi", 0 },
|
||||
{ "dxr", 0, "application/x-director", 0 },
|
||||
{ "eps", 0, "application/postscript", 0 },
|
||||
{ "etx", 0, "text/x-setext", 0 },
|
||||
{ "exe", 0, "application/octet-stream", 0 },
|
||||
{ "ez", 0, "application/andrew-inset", 0 },
|
||||
{ "fgd", 0, "application/x-director", 0 },
|
||||
{ "fh", 0, "image/x-freehand", 0 },
|
||||
{ "fh4", 0, "image/x-freehand", 0 },
|
||||
{ "fh5", 0, "image/x-freehand", 0 },
|
||||
{ "fh7", 0, "image/x-freehand", 0 },
|
||||
{ "fhc", 0, "image/x-freehand", 0 },
|
||||
{ "gif", 0, "image/gif", 0 },
|
||||
{ "gtar", 0, "application/x-gtar", 0 },
|
||||
{ "hdf", 0, "application/x-hdf", 0 },
|
||||
{ "hqx", 0, "application/mac-binhex40", 0 },
|
||||
{ "htm", 0, "text/html; charset=%s", 0 },
|
||||
{ "html", 0, "text/html; charset=%s", 0 },
|
||||
{ "ice", 0, "x-conference/x-cooltalk", 0 },
|
||||
{ "ief", 0, "image/ief", 0 },
|
||||
{ "iges", 0, "model/iges", 0 },
|
||||
{ "igs", 0, "model/iges", 0 },
|
||||
{ "iv", 0, "application/x-inventor", 0 },
|
||||
{ "jar", 0, "application/x-java-archive", 0 },
|
||||
{ "jfif", 0, "image/jpeg", 0 },
|
||||
{ "jpe", 0, "image/jpeg", 0 },
|
||||
{ "jpeg", 0, "image/jpeg", 0 },
|
||||
{ "jpg", 0, "image/jpeg", 0 },
|
||||
{ "js", 0, "application/x-javascript", 0 },
|
||||
{ "kar", 0, "audio/midi", 0 },
|
||||
{ "latex", 0, "application/x-latex", 0 },
|
||||
{ "lha", 0, "application/octet-stream", 0 },
|
||||
{ "lzh", 0, "application/octet-stream", 0 },
|
||||
{ "m3u", 0, "audio/x-mpegurl", 0 },
|
||||
{ "man", 0, "application/x-troff-man", 0 },
|
||||
{ "mathml", 0, "application/mathml+xml", 0 },
|
||||
{ "me", 0, "application/x-troff-me", 0 },
|
||||
{ "mesh", 0, "model/mesh", 0 },
|
||||
{ "mid", 0, "audio/midi", 0 },
|
||||
{ "midi", 0, "audio/midi", 0 },
|
||||
{ "mif", 0, "application/vnd.mif", 0 },
|
||||
{ "mime", 0, "message/rfc822", 0 },
|
||||
{ "mml", 0, "application/mathml+xml", 0 },
|
||||
{ "mov", 0, "video/quicktime", 0 },
|
||||
{ "movie", 0, "video/x-sgi-movie", 0 },
|
||||
{ "mp2", 0, "audio/mpeg", 0 },
|
||||
{ "mp3", 0, "audio/mpeg", 0 },
|
||||
{ "mp4", 0, "video/mp4", 0 },
|
||||
{ "mpe", 0, "video/mpeg", 0 },
|
||||
{ "mpeg", 0, "video/mpeg", 0 },
|
||||
{ "mpg", 0, "video/mpeg", 0 },
|
||||
{ "mpga", 0, "audio/mpeg", 0 },
|
||||
{ "ms", 0, "application/x-troff-ms", 0 },
|
||||
{ "msh", 0, "model/mesh", 0 },
|
||||
{ "mv", 0, "video/x-sgi-movie", 0 },
|
||||
{ "mxu", 0, "video/vnd.mpegurl", 0 },
|
||||
{ "nc", 0, "application/x-netcdf", 0 },
|
||||
{ "o", 0, "application/octet-stream", 0 },
|
||||
{ "oda", 0, "application/oda", 0 },
|
||||
{ "ogg", 0, "application/x-ogg", 0 },
|
||||
{ "pac", 0, "application/x-ns-proxy-autoconfig", 0 },
|
||||
{ "pbm", 0, "image/x-portable-bitmap", 0 },
|
||||
{ "pdb", 0, "chemical/x-pdb", 0 },
|
||||
{ "pdf", 0, "application/pdf", 0 },
|
||||
{ "pgm", 0, "image/x-portable-graymap", 0 },
|
||||
{ "pgn", 0, "application/x-chess-pgn", 0 },
|
||||
{ "png", 0, "image/png", 0 },
|
||||
{ "pnm", 0, "image/x-portable-anymap", 0 },
|
||||
{ "ppm", 0, "image/x-portable-pixmap", 0 },
|
||||
{ "ppt", 0, "application/vnd.ms-powerpoint", 0 },
|
||||
{ "ps", 0, "application/postscript", 0 },
|
||||
{ "qt", 0, "video/quicktime", 0 },
|
||||
{ "ra", 0, "audio/x-realaudio", 0 },
|
||||
{ "ram", 0, "audio/x-pn-realaudio", 0 },
|
||||
{ "ras", 0, "image/x-cmu-raster", 0 },
|
||||
{ "rdf", 0, "application/rdf+xml", 0 },
|
||||
{ "rgb", 0, "image/x-rgb", 0 },
|
||||
{ "rm", 0, "audio/x-pn-realaudio", 0 },
|
||||
{ "roff", 0, "application/x-troff", 0 },
|
||||
{ "rpm", 0, "audio/x-pn-realaudio-plugin", 0 },
|
||||
{ "rss", 0, "application/rss+xml", 0 },
|
||||
{ "rtf", 0, "text/rtf", 0 },
|
||||
{ "rtx", 0, "text/richtext", 0 },
|
||||
{ "sgm", 0, "text/sgml", 0 },
|
||||
{ "sgml", 0, "text/sgml", 0 },
|
||||
{ "sh", 0, "application/x-sh", 0 },
|
||||
{ "shar", 0, "application/x-shar", 0 },
|
||||
{ "silo", 0, "model/mesh", 0 },
|
||||
{ "sit", 0, "application/x-stuffit", 0 },
|
||||
{ "skd", 0, "application/x-koan", 0 },
|
||||
{ "skm", 0, "application/x-koan", 0 },
|
||||
{ "skp", 0, "application/x-koan", 0 },
|
||||
{ "skt", 0, "application/x-koan", 0 },
|
||||
{ "smi", 0, "application/smil", 0 },
|
||||
{ "smil", 0, "application/smil", 0 },
|
||||
{ "snd", 0, "audio/basic", 0 },
|
||||
{ "so", 0, "application/octet-stream", 0 },
|
||||
{ "spl", 0, "application/x-futuresplash", 0 },
|
||||
{ "src", 0, "application/x-wais-source", 0 },
|
||||
{ "stc", 0, "application/vnd.sun.xml.calc.template", 0 },
|
||||
{ "std", 0, "application/vnd.sun.xml.draw.template", 0 },
|
||||
{ "sti", 0, "application/vnd.sun.xml.impress.template", 0 },
|
||||
{ "stw", 0, "application/vnd.sun.xml.writer.template", 0 },
|
||||
{ "sv4cpio", 0, "application/x-sv4cpio", 0 },
|
||||
{ "sv4crc", 0, "application/x-sv4crc", 0 },
|
||||
{ "svg", 0, "image/svg+xml", 0 },
|
||||
{ "svgz", 0, "image/svg+xml", 0 },
|
||||
{ "swf", 0, "application/x-shockwave-flash", 0 },
|
||||
{ "sxc", 0, "application/vnd.sun.xml.calc", 0 },
|
||||
{ "sxd", 0, "application/vnd.sun.xml.draw", 0 },
|
||||
{ "sxg", 0, "application/vnd.sun.xml.writer.global", 0 },
|
||||
{ "sxi", 0, "application/vnd.sun.xml.impress", 0 },
|
||||
{ "sxm", 0, "application/vnd.sun.xml.math", 0 },
|
||||
{ "sxw", 0, "application/vnd.sun.xml.writer", 0 },
|
||||
{ "t", 0, "application/x-troff", 0 },
|
||||
{ "tar", 0, "application/x-tar", 0 },
|
||||
{ "tcl", 0, "application/x-tcl", 0 },
|
||||
{ "tex", 0, "application/x-tex", 0 },
|
||||
{ "texi", 0, "application/x-texinfo", 0 },
|
||||
{ "texinfo", 0, "application/x-texinfo", 0 },
|
||||
{ "tif", 0, "image/tiff", 0 },
|
||||
{ "tiff", 0, "image/tiff", 0 },
|
||||
{ "tr", 0, "application/x-troff", 0 },
|
||||
{ "tsp", 0, "application/dsptype", 0 },
|
||||
{ "tsv", 0, "text/tab-separated-values", 0 },
|
||||
{ "txt", 0, "text/plain; charset=%s", 0 },
|
||||
{ "ustar", 0, "application/x-ustar", 0 },
|
||||
{ "vcd", 0, "application/x-cdlink", 0 },
|
||||
{ "vrml", 0, "model/vrml", 0 },
|
||||
{ "vx", 0, "video/x-rad-screenplay", 0 },
|
||||
{ "wav", 0, "audio/x-wav", 0 },
|
||||
{ "wax", 0, "audio/x-ms-wax", 0 },
|
||||
{ "wbmp", 0, "image/vnd.wap.wbmp", 0 },
|
||||
{ "wbxml", 0, "application/vnd.wap.wbxml", 0 },
|
||||
{ "wm", 0, "video/x-ms-wm", 0 },
|
||||
{ "wma", 0, "audio/x-ms-wma", 0 },
|
||||
{ "wmd", 0, "application/x-ms-wmd", 0 },
|
||||
{ "wml", 0, "text/vnd.wap.wml", 0 },
|
||||
{ "wmlc", 0, "application/vnd.wap.wmlc", 0 },
|
||||
{ "wmls", 0, "text/vnd.wap.wmlscript", 0 },
|
||||
{ "wmlsc", 0, "application/vnd.wap.wmlscriptc", 0 },
|
||||
{ "wmv", 0, "video/x-ms-wmv", 0 },
|
||||
{ "wmx", 0, "video/x-ms-wmx", 0 },
|
||||
{ "wmz", 0, "application/x-ms-wmz", 0 },
|
||||
{ "wrl", 0, "model/vrml", 0 },
|
||||
{ "wsrc", 0, "application/x-wais-source", 0 },
|
||||
{ "wvx", 0, "video/x-ms-wvx", 0 },
|
||||
{ "xbm", 0, "image/x-xbitmap", 0 },
|
||||
{ "xht", 0, "application/xhtml+xml", 0 },
|
||||
{ "xhtml", 0, "application/xhtml+xml", 0 },
|
||||
{ "xls", 0, "application/vnd.ms-excel", 0 },
|
||||
{ "xml", 0, "text/xml", 0 },
|
||||
{ "xpm", 0, "image/x-xpixmap", 0 },
|
||||
{ "xsl", 0, "text/xml", 0 },
|
||||
{ "xwd", 0, "image/x-xwindowdump", 0 },
|
||||
{ "xyz", 0, "chemical/x-xyz", 0 },
|
||||
{ "zip", 0, "application/zip", 0 },
|
||||
};
|
||||
|
||||
static const int n_typ_tab = sizeof(typ_tab) / sizeof(*typ_tab);
|
||||
|
||||
#endif
|
正在加载...
在新工单中引用