diff --git a/uppsrc/Ole/Ctrl/Ctrl.upp b/uppsrc/Ole/Ctrl/Ctrl.upp index 18961e8e9..7b3214f3c 100644 --- a/uppsrc/Ole/Ctrl/Ctrl.upp +++ b/uppsrc/Ole/Ctrl/Ctrl.upp @@ -8,9 +8,6 @@ file control.cpp, ocx.def; -mainconfig - "" = "DLL"; - custom() "idl", "midl /newtlb $(!/I) /h \"$(DIR)/$(TITLE)_idl.h\" /iid \"$(DIR)/$(TITLE" ")_idl.cpp\" /tlb \"$(DIR)/$(TITLE).tlb\" \"$(PATH)\"\r\n", diff --git a/uppsrc/Web/httpcli.cpp b/uppsrc/Web/httpcli.cpp index f841244fc..543b1a3ef 100644 --- a/uppsrc/Web/httpcli.cpp +++ b/uppsrc/Web/httpcli.cpp @@ -343,7 +343,7 @@ String HttpClient::Execute(Gate2 progress) if(!part.IsEmpty()) { if(body.GetLength() + part.GetLength() > DEFAULT_MAX_CONTENT_SIZE) { error = NFormat(t_("Maximum content size exceeded: %d"), body.GetLength() + part.GetLength()); - return tc_chunked ? chunked : body; + goto EXIT; } body.Cat(part); if(tc_chunked) @@ -410,7 +410,7 @@ String HttpClient::Execute(Gate2 progress) } if(progress(chunked.GetLength() + body.GetLength(), 0)) { aborted = true; - return chunked; + goto EXIT; } } } @@ -424,7 +424,7 @@ String HttpClient::Execute(Gate2 progress) } if(progress(chunked.GetLength() + body.GetLength(), max(content_length, 0))) { aborted = true; - return tc_chunked ? chunked : body; + break; } } @@ -432,11 +432,12 @@ EXIT: if(!keepalive || socket.IsError() || socket.IsEof()) Close(); - if(ce_gzip) { + if(tc_chunked) + body = chunked; + + if(ce_gzip) body = GZDecompress(body); - return body; - } - return tc_chunked ? chunked : body; + return body; } String HttpClientGet(String url, String proxy, String username, String password, diff --git a/uppsrc/Web/weblink/Copying b/uppsrc/Web/weblink/Copying deleted file mode 100644 index f135f3633..000000000 --- a/uppsrc/Web/weblink/Copying +++ /dev/null @@ -1,21 +0,0 @@ -Copyright 1998-2008 The U++ Project. All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, this list of - conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, this list of - conditions and the following disclaimer in the documentation and/or other materials - provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE U++ PROJECT ``AS IS'' AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FREEBSD PROJECT OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED -OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/uppsrc/Web/weblink/init b/uppsrc/Web/weblink/init deleted file mode 100644 index c87ebbe3c..000000000 --- a/uppsrc/Web/weblink/init +++ /dev/null @@ -1,5 +0,0 @@ -#ifndef _Web_weblink_icpp_init_stub -#define _Web_weblink_icpp_init_stub -#include "Web/init" -#include "plugin\bz2/init" -#endif diff --git a/uppsrc/Web/weblink/weblink.cpp b/uppsrc/Web/weblink/weblink.cpp deleted file mode 100644 index 8f370780d..000000000 --- a/uppsrc/Web/weblink/weblink.cpp +++ /dev/null @@ -1,228 +0,0 @@ -#include -#include - -#define WEBLINK_VERSION "1.0.r3" -#define WEBLINK_DATE Date(2004, 7, 1) -#define WEBLINK_COPYRIGHT "Copyright © 2004 Tomas Rylek" - -struct FilePacket -{ - void Serialize(Stream& stream); - - String filename; - String filedata; - Time filetime; -}; - -void FilePacket::Serialize(Stream& stream) -{ - int version = StreamHeading(stream, 1, 1, 1, "FilePacket"); - if(version >= 1) - stream % filename % filedata % filetime; -} - -static void SendFilePacket(String host, int port, FilePacket& packet) -{ - Socket socket = ClientSocket(host, port); - if(IsNull(socket)) - throw Exc(NFormat("cannot open %s:%d: %s", host, port, Socket::GetErrorText())); - StringStream stream; - stream % packet; - String compressed = BZ2Compress(stream.GetResult()); - char temp[12]; - strcpy(temp, "SEND"); - PokeIL(temp + 4, compressed.GetLength()); - int crc = GetCRC(compressed); - PokeIL(temp + 8, crc); - if(!socket.WriteWait(temp, 12, 2000)) - throw Exc("timeout writing packet header"); - for(int done = 0; done < compressed.GetLength();) { - fputs(NFormat("\r%s .. %d B", packet.filename, done), stdout); - fflush(stdout); - int bytes = socket.WriteRaw(compressed.GetIter(done), min(compressed.GetLength() - done, 1024)); - if(socket.IsError()) - throw Exc(NFormat("%s:%d: error writing socket: %s", host, port, Socket::GetErrorText())); - if(bytes > 0) - done += bytes; - socket.PeekWrite(1000); - } - fputs(NFormat("\rUpload of %s, %d B .. (done)", packet.filename, packet.filedata.GetLength()), stdout); - fflush(stdout); - for(;;) { - String peek = socket.PeekCount(4, 100); - if(peek.GetLength() >= 4) { - if(PeekIL(peek) != crc) - throw Exc(NFormat("%s:%d: bad checksum on file %s", host, port, packet.filename)); - fputs(" .. (OK)\n", stdout); - fflush(stdout); - break; - } - } -} - -static void RecvFilePacket(String host, int port, FilePacket& packet) -{ - Socket socket = ClientSocket(host, port); - if(IsNull(socket)) - throw Exc(NFormat("cannot open %s:%d: %s", host, port, Socket::GetErrorText())); - StringStream stream; - stream % packet; - String compressed = BZ2Compress(stream.GetResult()); - char temp[12]; - strcpy(temp, "RECV"); - PokeIL(temp + 4, compressed.GetLength()); - int crc = GetCRC(compressed); - PokeIL(temp + 8, crc); - if(!socket.WriteWait(temp, 12, 2000) || !socket.WriteWait(compressed, compressed.GetLength(), 10000)) - throw Exc("timeout writing request"); - if(socket.ReadCount(temp, 12, 30000) != 12 || memcmp(temp, "DOWN", 4)) - throw Exc(NFormat("%s:%d: error receiving response header", host, port)); - int downlen = PeekIL(temp + 4); - compressed = Null; - while(compressed.GetLength() < downlen) { - String part = socket.Read(1000, downlen - compressed.GetLength()); - if(!part.IsEmpty()) - compressed.Cat(part); - fputs(NFormat("\r%d / %d B", compressed.GetLength(), downlen, - iscale(compressed.GetLength(), 100, max(downlen, 1))), stdout); - fflush(stdout); - } - if(GetCRC(compressed) != PeekIL(temp + 8)) - throw Exc(NFormat("%s:%d: download CRC mismatch", host, port)); - stream.Open(BZ2Decompress(compressed)); - stream % packet; - if(stream.IsError()) - throw Exc(NFormat("%s:%d: download stream error", host, port)); -} - -static void RunServer(int port) -{ - Socket socket = ServerSocket(port); - if(IsNull(socket)) - throw Exc(NFormat("cannot open server socket %d: %s", port, Socket::GetErrorText())); - for(;;) - try { - fputs(NFormat("\rweblink server (version %s) running at port %d (%`)", WEBLINK_VERSION, port, GetSysTime()), stdout); - fflush(stdout); - Socket new_socket = socket.Accept(NULL, true, 1000); - if(!IsNull(new_socket)) { - char temp[12]; - if(new_socket.ReadCount(temp, 12, 30000) < 12) - throw Exc("error reading request header"); - String compressed; - int clen = PeekIL(temp + 4); - while(compressed.GetLength() < clen) { - fputs(NFormat("\r%d / %d B", compressed.GetLength(), clen), stdout); - fflush(stdout); - compressed.Cat(new_socket.Read(clen - compressed.GetLength(), 1000)); - } - if(GetCRC(compressed) != PeekIL(temp + 8)) - throw Exc("invalid request CRC"); - StringStream stream(BZ2Decompress(compressed)); - FilePacket packet; - stream % packet; - if(stream.IsError()) - throw Exc("request header error"); - if(!memcmp(temp, "SEND", 4)) { - if(!SaveFile(packet.filename, packet.filedata) || !FileSetTime(packet.filename, packet.filetime)) - throw Exc(NFormat("error saving file %s (%d B)", packet.filename, packet.filedata.GetLength())); - fputs(NFormat("\nUpload: %s, %d B\n", packet.filename, packet.filedata.GetLength()), stdout); - fflush(stdout); - if(!new_socket.WriteWait(temp + 8, 4, 10000)) - throw Exc("handshake error"); - } - else if(!memcmp(temp, "RECV", 4)) { - packet.filedata = LoadFile(packet.filename); - packet.filetime = FileGetTime(packet.filename); - if(packet.filedata.IsVoid()) - throw Exc(NFormat("error reading file '%s'", packet.filename)); - stream.Create(); - stream % packet; - compressed = BZ2Compress(stream.GetResult()); - strcpy(temp, "DOWN"); - PokeIL(temp + 4, compressed.GetLength()); - PokeIL(temp + 8, GetCRC(compressed)); - if(!new_socket.WriteWait(temp, 12, 30000)) - throw Exc("error writing response header"); - for(int done = 0; done < compressed.GetLength();) { - fputs(NFormat("\r%s .. %d / %d B", packet.filename, done, compressed.GetLength(), - iscale(done, 100, (compressed.GetLength(), 1))), stdout); - fflush(stdout); - int part = new_socket.WriteRaw(compressed.GetIter(done), min(compressed.GetLength() - done, 1024)); - if(part > 0) - done += part; - } - puts(NFormat("Download: %s, %d B\n", packet.filename, packet.filedata.GetLength())); - fflush(stdout); - } - else - throw Exc("request header error"); - } - - } - catch(Exc e) { - puts(e); - } -} - -static void TryMain() -{ - String server; - int port = 4444; - - const Vector& cmd = CommandLine(); - if(!cmd.IsEmpty() && cmd[0] == "-v") { - AppVersion(WEBLINK_VERSION); - return; - } - for(int i = 0; i < cmd.GetCount(); i++) { - const char *arg = cmd[i]; - if(*arg == '-' || *arg == '+') { - bool upload = (*arg++ == '+'); - if(!*arg) { - if(!*arg && ++i >= cmd.GetCount()) - throw Exc("+/- missing file name"); - arg = cmd[i]; - } - String file = arg; - if(IsNull(server)) - throw Exc("+/-: server name not set"); - FilePacket packet; - if(upload) { - packet.filename = GetFileName(file); - packet.filedata = LoadFile(file); - packet.filetime = FileGetTime(file); - if(packet.filedata.IsVoid()) - throw Exc(NFormat("error reading file '%s'", file)); - SendFilePacket(server, port, packet); - } - else { - packet.filename = GetFileName(file); - RecvFilePacket(server, port, packet); - if(!SaveFile(file, packet.filedata) || !FileSetTime(file, packet.filetime)) - throw Exc(NFormat("error writing file '%s'", file)); - } - } - else if(IsDigit(*arg)) { - port = ScanInt(arg + 1); - if(port < 1 || port > 65535) - throw Exc(NFormat("invalid port number: %d", port)); - } - else - server = arg; - } - - if(IsNull(server)) - RunServer(port); -} - -CONSOLE_APP_MAIN -{ - try { - TryMain(); - } - catch(Exc e) { - puts(e); - SetExitCode(1); - } -} diff --git a/uppsrc/Web/weblink/weblink.upp b/uppsrc/Web/weblink/weblink.upp deleted file mode 100644 index aa07d179e..000000000 --- a/uppsrc/Web/weblink/weblink.upp +++ /dev/null @@ -1,12 +0,0 @@ -uses - Web, - plugin\bz2; - -file - weblink.cpp, - Info readonly separator, - Copying; - -mainconfig - "" = ""; - diff --git a/uppsrc/Web/wisapi/version.h b/uppsrc/Web/wisapi/version.h index 253c5d647..4da774158 100644 --- a/uppsrc/Web/wisapi/version.h +++ b/uppsrc/Web/wisapi/version.h @@ -1,3 +1,3 @@ -#define WISAPI_VERSION "6.r14" -#define WISAPI_DATE Date(2008, 6, 11) -#define WISAPI_COPYRIGHT "Copyright 1999-2008 Tomas Rylek" +#define WISAPI_VERSION "6.r15" +#define WISAPI_DATE Date(2009, 5, 12) +#define WISAPI_COPYRIGHT "Copyright 1999-2009 Tomas Rylek" diff --git a/uppsrc/Web/wisapi/wisapi.upp b/uppsrc/Web/wisapi/wisapi.upp index bf957507c..f0982a5aa 100644 --- a/uppsrc/Web/wisapi/wisapi.upp +++ b/uppsrc/Web/wisapi/wisapi.upp @@ -2,6 +2,10 @@ uses Web, TCore; +target(MSC9X64) wisapi64.dll; + +target(!MSC9X64) wisapi.dll; + link(MAIN DLL) /DEF:wisapi.def; link(!DEBUG) /MAP; @@ -14,9 +18,6 @@ file Info readonly separator, Copying; -mainconfig - "" = "DLL MT"; - custom() "pre-link", "restserv w3svc", "";