Commit f0cc4320 authored by Axel Beckert's avatar Axel Beckert

Imported Upstream version 2.8.7dev11

parent 7f78908e
......@@ -20,7 +20,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".;..\..\..;..\..\..\lib;..\..\..\WWW\Library\Implementation;..\..\..\src\chrtrans;..\..\..\src"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE,HAVE_CONFIG_H"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H;DONT_HAVE_TM_GMTOFF"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="5"
......@@ -71,7 +71,7 @@
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=".;..\..\..;..\..\..\lib;..\..\..\WWW\Library\Implementation;..\..\..\src\chrtrans;..\..\..\src"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE,HAVE_CONFIG_H"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H;DONT_HAVE_TM_GMTOFF"
RuntimeLibrary="4"
UsePrecompiledHeader="0"
WarningLevel="3"
......@@ -313,6 +313,9 @@
<File
RelativePath="..\..\..\src\LYMap.c">
</File>
<File
RelativePath="..\..\..\src\LYmktime.c">
</File>
<File
RelativePath="..\..\..\src\LYNews.c">
</File>
......@@ -358,6 +361,9 @@
<File
RelativePath="..\..\..\src\mktime.c">
</File>
<File
RelativePath="..\..\..\src\parsdate.c">
</File>
<File
RelativePath="..\..\..\Www\Library\Implementation\SGML.c">
</File>
......
......@@ -41,7 +41,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\lynx;&quot;$(SolutionDir)..\..\..&quot;;&quot;$(SolutionDir)..\..\..\lib&quot;;&quot;$(SolutionDir)..\..\..\WWW\Library\Implementation&quot;;&quot;$(SolutionDir)..\..\..\src&quot;;&quot;$(SolutionDir)..\..\..\src\chrtrans&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_MBCS;HAVE_CONFIG_H;$(NOINHERIT)"
PreprocessorDefinitions="WIN32;_CONSOLE;HAVE_CONFIG_H;DONT_HAVE_TM_GMTOFF"
GeneratePreprocessedFile="0"
MinimalRebuild="true"
BasicRuntimeChecks="3"
......@@ -121,7 +121,7 @@
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\lynx;&quot;$(SolutionDir)..\..\..&quot;;&quot;$(SolutionDir)..\..\..\lib&quot;;&quot;$(SolutionDir)..\..\..\WWW\Library\Implementation&quot;;&quot;$(SolutionDir)..\..\..\src&quot;;&quot;$(SolutionDir)..\..\..\src\chrtrans&quot;"
PreprocessorDefinitions="WIN32;_CONSOLE;_MBCS;HAVE_CONFIG_H;$(NOINHERIT)"
PreprocessorDefinitions="WIN32;_CONSOLE;_MBCS;HAVE_CONFIG_H;DONT_HAVE_TM_GMTOFF"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
......@@ -439,6 +439,10 @@
RelativePath="..\..\..\src\LYMap.c"
>
</File>
<File
RelativePath="..\..\..\src\LYmktime.c"
>
</File>
<File
RelativePath="..\..\..\src\LYNews.c"
>
......@@ -495,6 +499,10 @@
RelativePath="..\..\..\src\LYUtils.c"
>
</File>
<File
RelativePath="..\..\..\src\parsdate.c"
>
</File>
<File
RelativePath="..\..\..\WWW\Library\Implementation\SGML.c"
>
......
......@@ -41,7 +41,7 @@ RSC=rc.exe
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "..\..\..\..\src" /I "..\..\..\..\src\chrtrans" /I "..\..\..\..\WWW\Library\Implementation" /I "..\..\..\..\lib" /I "..\..\..\.." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D "DOSPATH" /D "NO_UNISTD_H" /D "__WIN32__" /D "WIN_EX" /D "NOUSERS" /D "DIRED_SUPPORT" /D "DISP_PARTIAL" /D "HAVE_KEYPAD" /D "NOSIGHUP" /D "NO_TTYTYPE" /D "NO_UTMP" /D "SH_EX" /D "USE_EXTERNALS" /D "USE_FILE_UPLOAD" /D "USE_MULTIBYTE_CURSES" /D "USE_PERSISTENT_COOKIES" /D "USE_PRETTYSRC" /D "USE_READPROGRESS" /D "USE_SCROLLBAR" /D "USE_SOURCE_CACHE" /D "USE_ZLIB" /D "PDCURSES" /D "COLOR_CURSES" /D "FANCY_CURSES" /D "USE_COLOR_STYLE" /D "USE_WINSOCK2_H" /D _WIN32_WINNT=0x0400 /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "..\..\..\..\src" /I "..\..\..\..\src\chrtrans" /I "..\..\..\..\WWW\Library\Implementation" /I "..\..\..\..\lib" /I "..\..\..\.." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D "DOSPATH" /D "NO_UNISTD_H" /D "__WIN32__" /D "WIN_EX" /D "NOUSERS" /D "DIRED_SUPPORT" /D "DISP_PARTIAL" /D "DONT_HAVE_TM_GMTOFF" /D "HAVE_KEYPAD" /D "NOSIGHUP" /D "NO_TTYTYPE" /D "NO_UTMP" /D "SH_EX" /D "USE_EXTERNALS" /D "USE_FILE_UPLOAD" /D "USE_MULTIBYTE_CURSES" /D "USE_PERSISTENT_COOKIES" /D "USE_PRETTYSRC" /D "USE_READPROGRESS" /D "USE_SCROLLBAR" /D "USE_SOURCE_CACHE" /D "USE_ZLIB" /D "PDCURSES" /D "COLOR_CURSES" /D "FANCY_CURSES" /D "USE_COLOR_STYLE" /D "USE_WINSOCK2_H" /D _WIN32_WINNT=0x0400 /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
......@@ -65,7 +65,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\..\..\src" /I "..\..\..\..\src\chrtrans" /I "..\..\..\..\WWW\Library\Implementation" /I "..\..\..\..\lib" /I "..\..\..\.." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D "DOSPATH" /D "NO_UNISTD_H" /D "__WIN32__" /D "WIN_EX" /D "NOUSERS" /D "DIRED_SUPPORT" /D "DISP_PARTIAL" /D "HAVE_KEYPAD" /D "NOSIGHUP" /D "NO_TTYTYPE" /D "NO_UTMP" /D "SH_EX" /D "USE_EXTERNALS" /D "USE_FILE_UPLOAD" /D "USE_MULTIBYTE_CURSES" /D "USE_PERSISTENT_COOKIES" /D "USE_PRETTYSRC" /D "USE_READPROGRESS" /D "USE_SCROLLBAR" /D "USE_SOURCE_CACHE" /D "USE_ZLIB" /D "PDCURSES" /D "COLOR_CURSES" /D "FANCY_CURSES" /D "USE_COLOR_STYLE" /D "USE_WINSOCK2_H" /D _WIN32_WINNT=0x0400 /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\..\..\src" /I "..\..\..\..\src\chrtrans" /I "..\..\..\..\WWW\Library\Implementation" /I "..\..\..\..\lib" /I "..\..\..\.." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D "DOSPATH" /D "NO_UNISTD_H" /D "__WIN32__" /D "WIN_EX" /D "NOUSERS" /D "DIRED_SUPPORT" /D "DISP_PARTIAL" /D "DONT_HAVE_TM_GMTOFF" /D "HAVE_KEYPAD" /D "NOSIGHUP" /D "NO_TTYTYPE" /D "NO_UTMP" /D "SH_EX" /D "USE_EXTERNALS" /D "USE_FILE_UPLOAD" /D "USE_MULTIBYTE_CURSES" /D "USE_PERSISTENT_COOKIES" /D "USE_PRETTYSRC" /D "USE_READPROGRESS" /D "USE_SCROLLBAR" /D "USE_SOURCE_CACHE" /D "USE_ZLIB" /D "PDCURSES" /D "COLOR_CURSES" /D "FANCY_CURSES" /D "USE_COLOR_STYLE" /D "USE_WINSOCK2_H" /D _WIN32_WINNT=0x0400 /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
......@@ -342,6 +342,10 @@ SOURCE=..\..\..\..\src\LYMap.c
# End Source File
# Begin Source File
SOURCE=..\..\..\..\src\LYmktime.c
# End Source File
# Begin Source File
SOURCE=..\..\..\..\src\LYNews.c
# End Source File
# Begin Source File
......@@ -398,6 +402,10 @@ SOURCE=..\..\..\..\src\mktime.c
# End Source File
# Begin Source File
SOURCE=..\..\..\..\src\parsdate.c
# End Source File
# Begin Source File
SOURCE=..\..\..\..\WWW\Library\Implementation\SGML.c
# End Source File
# Begin Source File
......
-- $LynxId: CHANGES,v 1.308 2008/09/21 21:12:42 tom Exp $
-- $LynxId: CHANGES,v 1.325 2008/12/14 20:04:30 tom Exp $
===============================================================================
Changes since Lynx 2.8 release
===============================================================================
2008-12-14 (2.8.7dev.11)
* add support for HTML5 rel=author in link (mailing list comments) -TD
* modify cookie-writing to not write if no cookies were read from the file
and none are available (Debian #354282) -TD
* fix src/tidy_tls.c X509_get_issuer_name to actually take the issuer DN of the
present certificate and not hope that it is the same as taking the subject DN
of the "next" certificate which may or may not exist (Debian #499945, patch
by Thomas Viehmann)
* modify exit code when doing a "-dump" to exit with error if the server
returned an error status for the page (Debian #299711) -TD
* fix ipv6 literal command-line parsing (Debian #180654, analysis by Fabio
Massimo Di Nitto) -TD
* extend configure macros CF_SSL and CF_GNUTLS to check for pkg-config, using
that for the default if the corresponding openssl or gnutls packages are
installed (suggested by PGNet) -TD
* add fi.po from
http://translationproject.org/latest/lynx/
* update fr.po from
http://translationproject.org/latest/lynx/
* correct handling of the option value from configure "--with-ssl", which was
not being used in the search-list (report by PGNet) -TD
* update configure script macros -TD
CF_CURSES_LIBS - add "pdcurses", e.g., to link with mingw
CF_UTF8_LIB - use CF_FIND_LINKAGE to better work with BSD ports.
CF_XOPEN_SOURCE - add case for dragonfly
* document width-limitation in manpage, fix a few stray 1024's still in the
source (report by Barry Haddow) -TD
* add "read_timeout" to lynx.cfg, and -read_timeout option to command-line
(prompted by Dries De Moor report on mailing list) -TD
* modify to handle a special case where the content-type is given as one of the
compressed types, to check if the address (after stripping the file suffix
for that compression) has a suffix that lynx could present -TD
For example:
http://foo/bar.html.gz
would display the uncompressed "bar.html" rather than offering to download
the file. This also allows one to add SUFFIX commands to lynx.cfg to display
the corresponding plain files.
For example:
SUFFIX:CHANGES.*:text/plain:8bit
SUFFIX:CHANGES:text/plain:8bit
for
http://foo/CHANGES.tmp.gz
http://foo/CHANGES.gz
* workaround for STRING redefinition in parsdate.c on DJGPP -GV
* improve configure-check to determine proper fallback when no long-long
printing format is available -TD
* update win32 makefiles/build scripts to add LYmktime, parsdate modules -TD
* update config.guess (2008-04-14), config.sub (2008-06-16)
2008-09-21 (2.8.7dev.10)
* remove rw.po, since the translation project no longer supplies it -TD
* implement "readonly" attribute for TEXTAREA and TEXT fields -TD
......
; $LynxId: lynx-curses.iss,v 1.2 2007/08/02 00:09:46 tom Exp $
; $LynxId: lynx-curses.iss,v 1.4 2008/09/24 22:43:18 tom Exp $
;
; This script assumes environment variables have been set, e.g., to point to
; data which is used by the installer:
;
; LYNX_DOCSDIR - files and subdirectories installed from Unix with "make install-doc"
; LYNX_HELPDIR - files and subdirectories installed from Unix with "make install-help"
;
; TODO: install curses or slang dll with executable
#define MyAppName "Lynx"
#define MyAppVerName "Lynx 2.8.7dev.5"
#define MyAppVerName "Lynx 2.8.7dev.10"
#define MyAppPublisher "Thomas E Dickey"
#define MyAppURL "http://lynx.isc.org"
#define MyAppExeName "lynx.exe"
......
/*
* $LynxId: HTFile.c,v 1.105 2008/09/18 21:34:25 tom Exp $
* $LynxId: HTFile.c,v 1.110 2008/12/07 18:49:34 tom Exp $
*
* File Access HTFile.c
* ===========
......@@ -1246,6 +1246,62 @@ CompressFileType HTCompressFileType(const char *filename,
return result;
}
/*
* Determine expected file-suffix from the compression method.
*/
const char *HTCompressTypeToSuffix(CompressFileType method)
{
const char *result = "";
switch (method) {
default:
case cftNone:
result = "";
break;
case cftGzip:
result = ".gz";
break;
case cftCompress:
result = ".Z";
break;
case cftBzip2:
result = ".bz2";
break;
case cftDeflate:
result = ".zz";
break;
}
return result;
}
/*
* Determine compression encoding from the compression method.
*/
const char *HTCompressTypeToEncoding(CompressFileType method)
{
const char *result = NULL;
switch (method) {
default:
case cftNone:
result = NULL;
break;
case cftGzip:
result = "gzip";
break;
case cftCompress:
result = "compress";
break;
case cftBzip2:
result = "bzip2";
break;
case cftDeflate:
result = "deflate";
break;
}
return result;
}
/*
* Check if the token from "Content-Encoding" corresponds to a compression
* type. RFC 2068 (and cut/paste into RFC 2616) lists these:
......@@ -1276,6 +1332,41 @@ CompressFileType HTEncodingToCompressType(const char *coding)
return result;
}
CompressFileType HTContentTypeToCompressType(const char *ct)
{
CompressFileType method = cftNone;
if (!strncasecomp(ct, "application/gzip", 16) ||
!strncasecomp(ct, "application/x-gzip", 18)) {
method = cftGzip;
} else if (!strncasecomp(ct, "application/compress", 20) ||
!strncasecomp(ct, "application/x-compress", 22)) {
method = cftCompress;
} else if (!strncasecomp(ct, "application/bzip2", 17) ||
!strncasecomp(ct, "application/x-bzip2", 19)) {
method = cftBzip2;
}
return method;
}
/*
* Check the anchor's content_type and content_encoding elements for a gzip or
* Unix compressed file -FM, TD
*/
CompressFileType HTContentToCompressType(HTParentAnchor *anchor)
{
CompressFileType method = cftNone;
const char *ct = HTAnchor_content_type(anchor);
const char *ce = HTAnchor_content_encoding(anchor);
if (ce == NULL && ct != 0) {
method = HTContentTypeToCompressType(ct);
} else if (ce != 0) {
method = HTEncodingToCompressType(ce);
}
return method;
}
/* Determine write access to a file.
* ---------------------------------
*
......
/* File access in libwww
/*
* $LynxId: HTFile.h,v 1.31 2008/12/07 18:49:53 tom Exp $
* File access in libwww
* FILE ACCESS
*
* These are routines for local file access used by WWW browsers and servers.
......@@ -221,15 +223,25 @@ extern "C" {
int *rootlen);
/*
* Determine compression type from the content-type.
* Determine compression type from the content-encoding.
*/
extern CompressFileType HTContentToCompressType(const char *encoding);
extern CompressFileType HTEncodingToCompressType(const char *encoding);
/*
* Determine compression type from the content-encoding.
*/
extern CompressFileType HTEncodingToCompressType(const char *encoding);
extern CompressFileType HTContentTypeToCompressType(const char *ct);
/*
* Determine compression type from the content-type and/or content-encoding.
*/
extern CompressFileType HTContentToCompressType(HTParentAnchor *anchor);
/*
* Determine compression encoding from the compression method.
*/
extern const char *HTCompressTypeToEncoding(CompressFileType method);
/*
* Determine expected file-suffix from the compression method.
*/
extern const char *HTCompressTypeToSuffix(CompressFileType method);
/*
* Determine write access to a file.
*
......
/*
* $LynxId: HTFormat.c,v 1.63 2008/09/10 23:22:59 tom Exp $
* $LynxId: HTFormat.c,v 1.65 2008/12/14 17:11:58 tom Exp $
*
* Manage different file formats HTFormat.c
* =============================
......@@ -396,8 +396,9 @@ static HTPresentation *HTFindPresentation(HTFormat rep_in,
if (pres->rep_out == rep_out) {
if (failsMailcap(pres, anchor))
continue;
CTRACE((tfp, "FindPresentation: found exact match: %s\n",
HTAtom_name(pres->rep)));
CTRACE((tfp, "FindPresentation: found exact match: %s -> %s\n",
HTAtom_name(pres->rep),
HTAtom_name(pres->rep_out)));
return pres;
} else if (!fill_in) {
......@@ -412,8 +413,9 @@ static HTPresentation *HTFindPresentation(HTFormat rep_in,
strong_wildcard_match = pres;
/* otherwise use the first one */
CTRACE((tfp,
"StreamStack: found strong wildcard match: %s\n",
HTAtom_name(pres->rep)));
"StreamStack: found strong wildcard match: %s -> %s\n",
HTAtom_name(pres->rep),
HTAtom_name(pres->rep_out)));
}
}
......@@ -429,8 +431,9 @@ static HTPresentation *HTFindPresentation(HTFormat rep_in,
strong_subtype_wildcard_match = pres;
/* otherwise use the first one */
CTRACE((tfp,
"StreamStack: found strong subtype wildcard match: %s\n",
HTAtom_name(pres->rep)));
"StreamStack: found strong subtype wildcard match: %s -> %s\n",
HTAtom_name(pres->rep),
HTAtom_name(pres->rep_out)));
}
}
......@@ -515,8 +518,9 @@ HTStream *HTStreamStack(HTFormat rep_in,
if (match == &temp) {
CTRACE((tfp, "StreamStack: Using %s\n", HTAtom_name(temp.rep_out)));
} else {
CTRACE((tfp, "StreamStack: found exact match: %s\n",
HTAtom_name(match->rep)));
CTRACE((tfp, "StreamStack: found exact match: %s -> %s\n",
HTAtom_name(match->rep),
HTAtom_name(match->rep_out)));
}
result = (*match->converter) (match, anchor, sink);
} else {
......@@ -1153,7 +1157,7 @@ static int HTZzFileCopy(FILE *zzfp, HTStream *sink)
status = inflateInit(&s);
if (status != Z_OK) {
CTRACE((tfp, "HTZzFileCopy inflateInit() %s\n", zError(status)));
exit_immediately(1);
exit_immediately(EXIT_FAILURE);
}
s.avail_in = 0;
s.next_out = (Bytef *) output_buffer;
......
/*
* $LynxId: HTMIME.c,v 1.64 2008/09/17 00:04:44 tom Exp $
* $LynxId: HTMIME.c,v 1.67 2008/12/14 18:46:52 tom Exp $
*
* MIME Message Parse HTMIME.c
* ==================
......@@ -215,8 +215,66 @@ static void dequote(char *url)
}
}
/*
* Strip off any compression-suffix from the address and check if the result
* looks like one of the presentable suffixes. If so, return the corresponding
* MIME type.
*/
static const char *UncompressedContentType(HTStream *me, CompressFileType method)
{
const char *result = 0;
char *address = me->anchor->address;
const char *expected = HTCompressTypeToSuffix(method);
const char *actual = strrchr(address, '.');
/*
* We have to ensure the suffix is consistent, to use HTFileFormat().
*/
if (actual != 0 && !strcasecomp(actual, expected)) {
HTFormat format;
HTAtom *pencoding = 0;
const char *description = 0;
format = HTFileFormat(address, &pencoding, &description);
result = HTAtom_name(format);
}
return result;
}
static int pumpData(HTStream *me)
{
CompressFileType method;
const char *new_encoding;
const char *new_content;
CTRACE((tfp, "Begin pumpData\n"));
/*
* If the content-type says it is compressed, and there is no
* content-encoding, check further and see if the address (omitting the
* suffix for a compressed type) looks like a type we can present. If so,
* rearrange things so we'll present the StreamStack code with the
* presentable type, already marked as compressed.
*/
CTRACE((tfp, "...address{%s}\n", me->anchor->address));
method = HTContentTypeToCompressType(me->anchor->content_type_params);
if ((method != cftNone)
&& isEmpty(me->anchor->content_encoding)
&& (new_content = UncompressedContentType(me, method)) != 0) {
new_encoding = HTCompressTypeToEncoding(method);
CTRACE((tfp, "reinterpreting as content-type:%s, encoding:%s\n",
new_content, new_encoding));
StrAllocCopy(me->anchor->content_encoding, new_encoding);
FREE(me->compression_encoding);
StrAllocCopy(me->compression_encoding, new_encoding);
strcpy(me->value, new_content);
StrAllocCopy(me->anchor->content_type_params, me->value);
me->format = HTAtom_for(me->value);
}
if (strchr(HTAtom_name(me->format), ';') != NULL) {
char *cp = NULL, *cp1, *cp2, *cp3 = NULL, *cp4;
......@@ -451,68 +509,72 @@ static int pumpData(HTStream *me)
}
}
}
CTRACE((tfp, "...pumpData finished reading header\n"));
if (me->head_only) {
/* We are done! - kw */
me->state = MIME_IGNORE;
return HT_OK;
}
if (me->no_streamstack) {
me->target = me->sink;
} else {
if (!me->compression_encoding) {
CTRACE((tfp,
"HTMIME: MIME Content-Type is '%s', converting to '%s'\n",
HTAtom_name(me->format), HTAtom_name(me->targetRep)));
if (me->no_streamstack) {
me->target = me->sink;
} else {
if (!me->compression_encoding) {
CTRACE((tfp,
"HTMIME: MIME Content-Type is '%s', converting to '%s'\n",
HTAtom_name(me->format), HTAtom_name(me->targetRep)));
} else {
/*
* Change the format to that for "www/compressed" and set up a
* stream to deal with it. - FM
*/
CTRACE((tfp, "HTMIME: MIME Content-Type is '%s',\n",
HTAtom_name(me->format)));
me->format = HTAtom_for("www/compressed");
CTRACE((tfp, " Treating as '%s'. Converting to '%s'\n",
HTAtom_name(me->format), HTAtom_name(me->targetRep)));
FREE(me->compression_encoding);
}
me->target = HTStreamStack(me->format, me->targetRep,
me->sink, me->anchor);
if (!me->target) {
CTRACE((tfp, "HTMIME: Can't translate! ** \n"));
me->target = me->sink; /* Cheat */
}
}
if (me->target) {
me->targetClass = *me->target->isa;
/*
* Change the format to that for "www/compressed" and set up a
* stream to deal with it. - FM
* Pump rest of data right through, according to the transfer encoding.
*/
CTRACE((tfp, "HTMIME: MIME Content-Type is '%s',\n", HTAtom_name(me->format)));
me->format = HTAtom_for("www/compressed");
CTRACE((tfp, " Treating as '%s'. Converting to '%s'\n",
HTAtom_name(me->format), HTAtom_name(me->targetRep)));
FREE(me->compression_encoding);
}
me->target = HTStreamStack(me->format, me->targetRep,
me->sink, me->anchor);
if (!me->target) {
CTRACE((tfp, "HTMIME: Can't translate! ** \n"));
me->target = me->sink; /* Cheat */
me->state = (me->chunked_encoding
? MIME_CHUNKED
: MIME_TRANSPARENT);
} else {
me->state = MIME_IGNORE; /* What else to do? */
}
}
if (me->target) {
me->targetClass = *me->target->isa;
/*
* Pump rest of data right through, according to the transfer encoding.
*/
me->state = (me->chunked_encoding
? MIME_CHUNKED
: MIME_TRANSPARENT);
} else {
me->state = MIME_IGNORE; /* What else to do? */
}
if (me->refresh_url != NULL && !content_is_compressed(me)) {
char *url = NULL;
char *num = NULL;
char *txt = NULL;
const char *base = ""; /* FIXME: refresh_url may be relative to doc */
LYParseRefreshURL(me->refresh_url, &num, &url);
if (url != NULL && me->format == WWW_HTML) {
CTRACE((tfp, "Formatting refresh-url as first line of result\n"));
HTSprintf0(&txt, gettext("Refresh: "));
HTSprintf(&txt, gettext("%s seconds "), num);
dequote(url);
HTSprintf(&txt, "<a href=\"%s%s\">%s</a><br>", base, url, url);
CTRACE((tfp, "URL %s%s\n", base, url));
(me->isa->put_string) (me, txt);
free(txt);
if (me->refresh_url != NULL && !content_is_compressed(me)) {
char *url = NULL;
char *num = NULL;
char *txt = NULL;
const char *base = ""; /* FIXME: refresh_url may be relative to doc */
LYParseRefreshURL(me->refresh_url, &num, &url);
if (url != NULL && me->format == WWW_HTML) {
CTRACE((tfp,
"Formatting refresh-url as first line of result\n"));
HTSprintf0(&txt, gettext("Refresh: "));
HTSprintf(&txt, gettext("%s seconds "), num);
dequote(url);
HTSprintf(&txt, "<a href=\"%s%s\">%s</a><br>", base, url, url);
CTRACE((tfp, "URL %s%s\n", base, url));
(me->isa->put_string) (me, txt);
free(txt);
}
FREE(num);
FREE(url);
}
FREE(num);
FREE(url);
}
CTRACE((tfp, "...end of pumpData\n"));
return HT_OK;
}
......@@ -1027,6 +1089,7 @@ static void HTMIME_put_character(HTStream *me,
if (c == CR) {
return;
}
/* FALLTHRU */
case mcCHUNKED_DATA_LF:
me->state = MIME_CHUNKED;
......
/*
* $LynxId: HTParse.c,v 1.48 2008/01/10 00:57:31 tom Exp $
* $LynxId: HTParse.c,v 1.50 2008/12/14 15:38:54 tom Exp $
*
* Parse HyperText Document Address HTParse.c
* ================================
......@@ -194,6 +194,46 @@ static char *strchr_or_end(char *string, int ch)
return result;
}
/*
* Given a host specification that may end with a port number, e.g.,
* foobar:123
* point to the ':' which begins the ":port" to make it simple to handle the
* substring.
*
* If no port is found (or a syntax error), return null.
*/
char *HTParsePort(char *host, int *portp)
{
int brackets = 0;
char *result = NULL;
*portp = 0;
if (host != NULL) {
while (*host != '\0' && result == 0) {
switch (*host++) {
case ':':
if (brackets == 0 && isdigit(UCH(*host))) {
char *next = NULL;
*portp = strtol(host, &next, 10);
if (next != 0 && next != host && *next == '\0') {
result = (host - 1);
CTRACE((tfp, "HTParsePort %d\n", *portp));
}
}
break;
case '[': /* for ipv6 */
++brackets;
break;
case ']': /* for ipv6 */
--brackets;
break;
}
}
}
return result;
}
/* Parse a Name relative to another name. HTParse()
* --------------------------------------
*
......@@ -356,37 +396,33 @@ char *HTParse(const char *aName,
*/
{
char *p2, *h;
int portnumber;
if ((p2 = strchr(result, '@')) != NULL)
tail = (p2 + 1);
p2 = strchr(tail, ':');
if (p2 != NULL && !isdigit(UCH(p2[1])))
/*
* Colon not followed by a port number.
*/
*p2 = '\0';
if (p2 != NULL && *p2 != '\0' && acc_method != NULL) {
p2 = HTParsePort(result, &portnumber);
if (p2 != NULL && acc_method != NULL) {
/*
* Port specified.
*/
#define ACC_METHOD(a,b) (!strcmp(acc_method, a) && !strcmp(p2, b))
if (ACC_METHOD("http", ":80") ||
ACC_METHOD("https", ":443") ||
ACC_METHOD("gopher", ":70") ||
ACC_METHOD("ftp", ":21") ||
ACC_METHOD("wais", ":210") ||
ACC_METHOD("nntp", ":119") ||
ACC_METHOD("news", ":119") ||
ACC_METHOD("newspost", ":119") ||
ACC_METHOD("newsreply", ":119") ||
ACC_METHOD("snews", ":563") ||
ACC_METHOD("snewspost", ":563") ||
ACC_METHOD("snewsreply", ":563") ||
ACC_METHOD("finger", ":79") ||
ACC_METHOD("telnet", ":23") ||
ACC_METHOD("tn3270", ":23") ||
ACC_METHOD("rlogin", ":513") ||
ACC_METHOD("cso", ":105"))
#define ACC_METHOD(a,b) (!strcmp(acc_method, a) && (portnumber == b))
if (ACC_METHOD("http", 80) ||
ACC_METHOD("https", 443) ||
ACC_METHOD("gopher", 70) ||
ACC_METHOD("ftp", 21) ||
ACC_METHOD("wais", 210) ||
ACC_METHOD("nntp", 119) ||
ACC_METHOD("news", 119) ||
ACC_METHOD("newspost", 119) ||
ACC_METHOD("newsreply", 119) ||