diff --git a/MicroPython_BUILD/components/curl/LICENSE-MIXING.md b/MicroPython_BUILD/components/curl/LICENSE-MIXING.md new file mode 100644 index 0000000..5376bdb --- /dev/null +++ b/MicroPython_BUILD/components/curl/LICENSE-MIXING.md @@ -0,0 +1,127 @@ +License Mixing +============== + +libcurl can be built to use a fair amount of various third party libraries, +libraries that are written and provided by other parties that are distributed +using their own licenses. Even libcurl itself contains code that may cause +problems to some. This document attempts to describe what licenses libcurl and +the other libraries use and what possible dilemmas linking and mixing them all +can lead to for end users. + +I am not a lawyer and this is not legal advice! + +One common dilemma is that [GPL](https://www.gnu.org/licenses/gpl.html) +licensed code is not allowed to be linked with code licensed under the +[Original BSD license](https://spdx.org/licenses/BSD-4-Clause.html) (with the +announcement clause). You may still build your own copies that use them all, +but distributing them as binaries would be to violate the GPL license - unless +you accompany your license with an +[exception](https://www.gnu.org/licenses/gpl-faq.html#GPLIncompatibleLibs). This +particular problem was addressed when the [Modified BSD +license](https://opensource.org/licenses/BSD-3-Clause) was created, which does +not have the announcement clause that collides with GPL. + +## libcurl + + Uses an [MIT style license](https://curl.haxx.se/docs/copyright.html) that is + very liberal. + +## OpenSSL + + (May be used for SSL/TLS support) Uses an Original BSD-style license with an + announcement clause that makes it "incompatible" with GPL. You are not + allowed to ship binaries that link with OpenSSL that includes GPL code + (unless that specific GPL code includes an exception for OpenSSL - a habit + that is growing more and more common). If OpenSSL's licensing is a problem + for you, consider using another TLS library. + +## GnuTLS + + (May be used for SSL/TLS support) Uses the + [LGPL](https://www.gnu.org/licenses/lgpl.html) license. If this is a problem + for you, consider using another TLS library. Also note that GnuTLS itself + depends on and uses other libs (libgcrypt and libgpg-error) and they too are + LGPL- or GPL-licensed. + +## WolfSSL + + (May be used for SSL/TLS support) Uses the GPL license or a proprietary + license. If this is a problem for you, consider using another TLS library. + +## NSS + + (May be used for SSL/TLS support) Is covered by the + [MPL](https://www.mozilla.org/MPL/) license, the GPL license and the LGPL + license. You may choose to license the code under MPL terms, GPL terms, or + LGPL terms. These licenses grant you different permissions and impose + different obligations. You should select the license that best meets your + needs. + +## axTLS + + (May be used for SSL/TLS support) Uses a Modified BSD-style license. + +## mbedTLS + + (May be used for SSL/TLS support) Uses the [Apache 2.0 + license](https://opensource.org/licenses/Apache-2.0) or the GPL license. + You may choose to license the code under Apache 2.0 terms or GPL terms. + These licenses grant you different permissions and impose different + obligations. You should select the license that best meets your needs. + +## BoringSSL + + (May be used for SSL/TLS support) As an OpenSSL fork, it has the same + license as that. + +## libressl + + (May be used for SSL/TLS support) As an OpenSSL fork, it has the same + license as that. + +## c-ares + + (Used for asynchronous name resolves) Uses an MIT license that is very + liberal and imposes no restrictions on any other library or part you may link + with. + +## zlib + + (Used for compressed Transfer-Encoding support) Uses an MIT-style license + that shouldn't collide with any other library. + +## MIT Kerberos + + (May be used for GSS support) MIT licensed, that shouldn't collide with any + other parts. + +## Heimdal + + (May be used for GSS support) Heimdal is Original BSD licensed with the + announcement clause. + +## GNU GSS + + (May be used for GSS support) GNU GSS is GPL licensed. Note that you may not + distribute binary curl packages that uses this if you build curl to also link + and use any Original BSD licensed libraries! + +## libidn + + (Used for IDNA support) Uses the GNU Lesser General Public License [3]. LGPL + is a variation of GPL with slightly less aggressive "copyleft". This license + requires more requirements to be met when distributing binaries, see the + license for details. Also note that if you distribute a binary that includes + this library, you must also include the full LGPL license text. Please + properly point out what parts of the distributed package that the license + addresses. + +## OpenLDAP + + (Used for LDAP support) Uses a Modified BSD-style license. Since libcurl uses + OpenLDAP as a shared library only, I have not heard of anyone that ships + OpenLDAP linked with libcurl in an app. + +## libssh2 + + (Used for scp and sftp support) libssh2 uses a Modified BSD-style license. diff --git a/MicroPython_BUILD/components/curl/README b/MicroPython_BUILD/components/curl/README new file mode 100644 index 0000000..f0b3b93 --- /dev/null +++ b/MicroPython_BUILD/components/curl/README @@ -0,0 +1,49 @@ + _ _ ____ _ + ___| | | | _ \| | + / __| | | | |_) | | + | (__| |_| | _ <| |___ + \___|\___/|_| \_\_____| + +README + + Curl is a command line tool for transferring data specified with URL + syntax. Find out how to use curl by reading the curl.1 man page or the + MANUAL document. Find out how to install Curl by reading the INSTALL + document. + + libcurl is the library curl is using to do its job. It is readily + available to be used by your software. Read the libcurl.3 man page to + learn how! + + You find answers to the most frequent questions we get in the FAQ document. + + Study the COPYING file for distribution terms and similar. If you distribute + curl binaries or other binaries that involve libcurl, you might enjoy the + LICENSE-MIXING document. + +CONTACT + + If you have problems, questions, ideas or suggestions, please contact us + by posting to a suitable mailing list. See https://curl.haxx.se/mail/ + + All contributors to the project are listed in the THANKS document. + +WEB SITE + + Visit the curl web site for the latest news and downloads: + + https://curl.haxx.se/ + +GIT + + To download the very latest source off the GIT server do this: + + git clone https://github.com/curl/curl.git + + (you'll get a directory named curl created, filled with the source code) + +NOTICE + + Curl contains pieces of source code that is Copyright (c) 1998, 1999 + Kungliga Tekniska Högskolan. This notice is included here to comply with the + distribution terms. diff --git a/MicroPython_BUILD/components/curl/README_curl.md b/MicroPython_BUILD/components/curl/README_curl.md new file mode 100644 index 0000000..a599209 --- /dev/null +++ b/MicroPython_BUILD/components/curl/README_curl.md @@ -0,0 +1,51 @@ +![curl logo](https://cdn.rawgit.com/curl/curl-www/master/logo/curl-logo.svg) + +[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/63/badge)](https://bestpractices.coreinfrastructure.org/projects/63) +[![Coverity passed](https://scan.coverity.com/projects/curl/badge.svg)](https://scan.coverity.com/projects/curl) +[![Build Status](https://travis-ci.org/curl/curl.svg?branch=master)](https://travis-ci.org/curl/curl) +[![Coverage Status](https://coveralls.io/repos/github/curl/curl/badge.svg)](https://coveralls.io/github/curl/curl) + +Curl is a command-line tool for transferring data specified with URL +syntax. Find out how to use curl by reading [the curl.1 man +page](https://curl.haxx.se/docs/manpage.html) or [the MANUAL +document](https://curl.haxx.se/docs/manual.html). Find out how to install Curl +by reading [the INSTALL document](https://curl.haxx.se/docs/install.html). + +libcurl is the library curl is using to do its job. It is readily available to +be used by your software. Read [the libcurl.3 man +page](https://curl.haxx.se/libcurl/c/libcurl.html) to learn how! + +You find answers to the most frequent questions we get in [the FAQ +document](https://curl.haxx.se/docs/faq.html). + +Study [the COPYING file](https://curl.haxx.se/docs/copyright.html) for +distribution terms and similar. If you distribute curl binaries or other +binaries that involve libcurl, you might enjoy [the LICENSE-MIXING +document](https://curl.haxx.se/legal/licmix.html). + +## Contact + +If you have problems, questions, ideas or suggestions, please contact us by +posting to a suitable [mailing list](https://curl.haxx.se/mail/). + +All contributors to the project are listed in [the THANKS +document](https://curl.haxx.se/docs/thanks.html). + +## Website + +Visit the [curl web site](https://curl.haxx.se/) for the latest news and +downloads. + +## Git + +To download the very latest source off the Git server do this: + + git clone https://github.com/curl/curl.git + +(you'll get a directory named curl created, filled with the source code) + +## Notice + +Curl contains pieces of source code that is Copyright (c) 1998, 1999 Kungliga +Tekniska Högskolan. This notice is included here to comply with the +distribution terms. diff --git a/MicroPython_BUILD/components/curl_old.zip b/MicroPython_BUILD/components/curl_old.zip deleted file mode 100644 index 48847c5..0000000 Binary files a/MicroPython_BUILD/components/curl_old.zip and /dev/null differ diff --git a/MicroPython_BUILD/components/libssh2/COPYING b/MicroPython_BUILD/components/libssh2/COPYING new file mode 100644 index 0000000..f2ca947 --- /dev/null +++ b/MicroPython_BUILD/components/libssh2/COPYING @@ -0,0 +1,42 @@ +/* Copyright (c) 2004-2007 Sara Golemon + * Copyright (c) 2005,2006 Mikhail Gusarov + * Copyright (c) 2006-2007 The Written Word, Inc. + * Copyright (c) 2007 Eli Fant + * Copyright (c) 2009-2014 Daniel Stenberg + * Copyright (C) 2008, 2009 Simon Josefsson + * All rights reserved. + * + * Redistribution and use in source and binary forms, + * with or without modification, are permitted provided + * that the following conditions are met: + * + * Redistributions of source code must retain the above + * copyright notice, this list of conditions and the + * following disclaimer. + * + * 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. + * + * Neither the name of the copyright holder nor the names + * of any other contributors may be used to endorse or + * promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "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 COPYRIGHT OWNER 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/MicroPython_BUILD/components/libssh2/README.md b/MicroPython_BUILD/components/libssh2/README.md new file mode 100644 index 0000000..e0f6c25 --- /dev/null +++ b/MicroPython_BUILD/components/libssh2/README.md @@ -0,0 +1,16 @@ +# libssh2 - SSH2 library + +libssh2 is a library implementing the SSH2 protocol, available under +the revised BSD license. + +[Web site](https://www.libssh2.org/) + +[Mailing list](https://cool.haxx.se/mailman/listinfo/libssh2-devel) + +[BSD Licensed](https://libssh2.org/license.html) + +[Web site source code](https://github.com/libssh2/www) + +Installation instructions: + - [for CMake](docs/INSTALL_CMAKE) + - [for autotools](docs/INSTALL_AUTOTOOLS) diff --git a/MicroPython_BUILD/components/libssh2/RELEASE-NOTES b/MicroPython_BUILD/components/libssh2/RELEASE-NOTES new file mode 100644 index 0000000..5b78ede --- /dev/null +++ b/MicroPython_BUILD/components/libssh2/RELEASE-NOTES @@ -0,0 +1,31 @@ +libssh2 1.8.0 + +This release includes the following changes: + + o added a basic dockerised test suite + o crypto: add support for the mbedTLS backend + +This release includes the following bugfixes: + + o libgcrypt: fixed a NULL pointer dereference on OOM + o VMS: can't use %zd for off_t format + o VMS: update vms/libssh2_config.h + o windows: link with crypt32.lib + o libssh2_channel_open: speeling error fixed in channel error message + o msvc: fixed 14 compilation warnings + o tests: HAVE_NETINET_IN_H was not defined correctly + o openssl: add OpenSSL 1.1.0 compatibility + o cmake: Add CLEAR_MEMORY option, analogously to that for autoconf + o configure: make the --with-* options override the OpenSSL default + o libssh2_wait_socket: set err_msg on errors + o libssh2_wait_socket: Fix comparison with api_timeout to use milliseconds + +This release would not have looked like this without help, code, reports and +advice from friends like these: + + Alexander Lamaison, Antenore Gatta, Brad Harder, Charles Collicutt, + Craig A. Berry, Dan Fandrich, Daniel Stenberg, Kamil Dudka, Keno Fischer, + Taylor Holberton, Viktor Szakats, Will Cosgrove, Zenju + (12 contributors) + + Thanks! (and sorry if I forgot to mention someone) diff --git a/MicroPython_BUILD/components/micropython/esp32/libs/tft/tftspi.c b/MicroPython_BUILD/components/micropython/esp32/libs/tft/tftspi.c index a625695..2d73368 100644 --- a/MicroPython_BUILD/components/micropython/esp32/libs/tft/tftspi.c +++ b/MicroPython_BUILD/components/micropython/esp32/libs/tft/tftspi.c @@ -854,6 +854,23 @@ void _tft_setRotation(uint8_t rot) { break; } } + else if (_invert_rot == 3) { + // used for M5Stack display + switch (rotation) { + case PORTRAIT: + madctl = (MADCTL_MX | MADCTL_MV | _rgb_bgr); + break; + case LANDSCAPE: + madctl = (_rgb_bgr); + break; + case PORTRAIT_FLIP: + madctl = (MADCTL_MY | MADCTL_MV | _rgb_bgr); + break; + case LANDSCAPE_FLIP: + madctl = (MADCTL_MY | MADCTL_MX | _rgb_bgr); + break; + } + } else { switch (rotation) { case PORTRAIT: diff --git a/MicroPython_BUILD/components/micropython/esp32/libs/tft/tftspi.h b/MicroPython_BUILD/components/micropython/esp32/libs/tft/tftspi.h index c0a0021..09a95c5 100644 --- a/MicroPython_BUILD/components/micropython/esp32/libs/tft/tftspi.h +++ b/MicroPython_BUILD/components/micropython/esp32/libs/tft/tftspi.h @@ -42,8 +42,6 @@ #include "sdkconfig.h" #include "stmpe610.h" -#define CONFIG_EXAMPLE_ESP_WROVER_KIT - // === Various display constants constants === #define PORTRAIT 0 #define LANDSCAPE 1 @@ -62,8 +60,9 @@ //#define DISP_COLOR_BITS_16 0x55 #define DISP_COLOR_BITS_24 0x66 -#define TFT_RGB_BGR 0x00 +#define TFT_RGB_BGR 0x00 // default only, set when initializing the display +// Pins defaults (ESP32-WROVER-KIT v3) #define PIN_NUM_MISO 25 // SPI MISO #define PIN_NUM_MOSI 23 // SPI MOSI #define PIN_NUM_CLK 19 // SPI CLOCK pin diff --git a/MicroPython_BUILD/components/micropython/esp32/modsocket.c b/MicroPython_BUILD/components/micropython/esp32/modsocket.c index 9ff63d8..9385c07 100644 --- a/MicroPython_BUILD/components/micropython/esp32/modsocket.c +++ b/MicroPython_BUILD/components/micropython/esp32/modsocket.c @@ -158,6 +158,7 @@ STATIC mp_obj_t socket_accept(const mp_obj_t arg0) { struct sockaddr addr; socklen_t addr_len = sizeof(addr); + mp_hal_set_wdt_tmo(); int new_fd = -1; for (int i=0; i<=self->retries; i++) { MP_THREAD_GIL_EXIT(); @@ -166,6 +167,7 @@ STATIC mp_obj_t socket_accept(const mp_obj_t arg0) { if (new_fd >= 0) break; if (errno != EAGAIN) exception_from_errno(errno); check_for_exceptions(); + mp_hal_reset_wdt(); } if (new_fd < 0) mp_raise_OSError(MP_ETIMEDOUT); @@ -198,6 +200,7 @@ STATIC mp_obj_t socket_accepted(const mp_obj_t arg0) { socklen_t addr_len = sizeof(addr); int new_fd = -1; + mp_hal_set_wdt_tmo(); for (int i=0; i<=self->retries; i++) { MP_THREAD_GIL_EXIT(); new_fd = lwip_accept_r(self->fd, &addr, &addr_len); @@ -205,6 +208,7 @@ STATIC mp_obj_t socket_accepted(const mp_obj_t arg0) { if (new_fd >= 0) break; if (errno != EAGAIN) exception_from_errno(errno); check_for_exceptions(); + mp_hal_reset_wdt(); } mp_obj_tuple_t *client = mp_obj_new_tuple(2, NULL); @@ -331,6 +335,7 @@ mp_obj_t _socket_recvfrom(mp_obj_t self_in, mp_obj_t len_in, vstr_init_len(&vstr, len); // XXX Would be nicer to use RTC to handle timeouts + mp_hal_set_wdt_tmo(); for (int i=0; i<=sock->retries; i++) { MP_THREAD_GIL_EXIT(); int r = lwip_recvfrom_r(sock->fd, vstr.buf, len, 0, from, from_len); @@ -338,6 +343,7 @@ mp_obj_t _socket_recvfrom(mp_obj_t self_in, mp_obj_t len_in, if (r >= 0) { vstr.len = r; return mp_obj_new_str_from_vstr(&mp_type_bytes, &vstr); } if (errno != EWOULDBLOCK) exception_from_errno(errno); check_for_exceptions(); + mp_hal_reset_wdt(); } mp_raise_OSError(MP_ETIMEDOUT); } @@ -364,6 +370,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_recvfrom_obj, socket_recvfrom); int _socket_send(socket_obj_t *sock, const char *data, size_t datalen) { int sentlen = 0; + mp_hal_set_wdt_tmo(); for (int i=0; i<=sock->retries && sentlen < datalen; i++) { MP_THREAD_GIL_EXIT(); int r = lwip_write_r(sock->fd, data+sentlen, datalen-sentlen); @@ -371,6 +378,7 @@ int _socket_send(socket_obj_t *sock, const char *data, size_t datalen) { if (r < 0 && errno != EWOULDBLOCK) exception_from_errno(errno); if (r > 0) sentlen += r; check_for_exceptions(); + mp_hal_reset_wdt(); } if (sentlen == 0) mp_raise_OSError(MP_ETIMEDOUT); return sentlen; @@ -411,6 +419,7 @@ STATIC mp_obj_t socket_sendto(mp_obj_t self_in, mp_obj_t data_in, mp_obj_t addr_ to.sin_port = lwip_htons(netutils_parse_inet_addr(addr_in, (uint8_t*)&to.sin_addr, NETUTILS_BIG)); // send the data + mp_hal_set_wdt_tmo(); for (int i=0; i<=self->retries; i++) { MP_THREAD_GIL_EXIT(); int ret = lwip_sendto_r(self->fd, bufinfo.buf, bufinfo.len, 0, (struct sockaddr*)&to, sizeof(to)); @@ -420,6 +429,7 @@ STATIC mp_obj_t socket_sendto(mp_obj_t self_in, mp_obj_t data_in, mp_obj_t addr_ exception_from_errno(errno); } check_for_exceptions(); + mp_hal_reset_wdt(); } mp_raise_OSError(MP_ETIMEDOUT); } @@ -446,6 +456,7 @@ STATIC mp_uint_t socket_stream_read(mp_obj_t self_in, void *buf, mp_uint_t size, socket_obj_t *sock = self_in; // XXX Would be nicer to use RTC to handle timeouts + mp_hal_set_wdt_tmo(); for (int i=0; i<=sock->retries; i++) { MP_THREAD_GIL_EXIT(); int r = lwip_recvfrom_r(sock->fd, buf, size, 0, NULL, NULL); @@ -453,6 +464,7 @@ STATIC mp_uint_t socket_stream_read(mp_obj_t self_in, void *buf, mp_uint_t size, if (r >= 0) return r; if (r < 0 && errno != EWOULDBLOCK) { *errcode = errno; return MP_STREAM_ERROR; } check_for_exceptions(); + mp_hal_reset_wdt(); } *errcode = sock->retries == 0 ? MP_EWOULDBLOCK : MP_ETIMEDOUT; return MP_STREAM_ERROR; @@ -460,6 +472,7 @@ STATIC mp_uint_t socket_stream_read(mp_obj_t self_in, void *buf, mp_uint_t size, STATIC mp_uint_t socket_stream_write(mp_obj_t self_in, const void *buf, mp_uint_t size, int *errcode) { socket_obj_t *sock = self_in; + mp_hal_set_wdt_tmo(); for (int i=0; i<=sock->retries; i++) { MP_THREAD_GIL_EXIT(); int r = lwip_write_r(sock->fd, buf, size); @@ -467,6 +480,7 @@ STATIC mp_uint_t socket_stream_write(mp_obj_t self_in, const void *buf, mp_uint_ if (r > 0) return r; if (r < 0 && errno != EWOULDBLOCK) { *errcode = errno; return MP_STREAM_ERROR; } check_for_exceptions(); + mp_hal_reset_wdt(); } *errcode = sock->retries == 0 ? MP_EWOULDBLOCK : MP_ETIMEDOUT; return MP_STREAM_ERROR; diff --git a/MicroPython_BUILD/components/micropython/esp32/modules/microWebSocket.py b/MicroPython_BUILD/components/micropython/esp32/modules/microWebSocket.py new file mode 100644 index 0000000..afc1664 --- /dev/null +++ b/MicroPython_BUILD/components/micropython/esp32/modules/microWebSocket.py @@ -0,0 +1,266 @@ + +from hashlib import sha1 +from binascii import b2a_base64 +from struct import pack +import gc, _thread, time + +class MicroWebSocket : + + # ============================================================================ + # ===( Constants )============================================================ + # ============================================================================ + + _handshakeSign = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11" + + _opContFrame = 0x0 + _opTextFrame = 0x1 + _opBinFrame = 0x2 + _opCloseFrame = 0x8 + _opPingFrame = 0x9 + _opPongFrame = 0xA + + _msgTypeText = 1 + _msgTypeBin = 2 + + # ============================================================================ + # ===( Utils )=============================================================== + # ============================================================================ + + def _tryAllocByteArray(size) : + for x in range(10) : + try : + gc.collect() + return bytearray(size) + except : + pass + return None + + # ---------------------------------------------------------------------------- + + def _tryStartThread(func, args=(), stackSize=4096) : + _ = _thread.stack_size(stackSize) + for x in range(4) : + try : + gc.collect() + th = _thread.start_new_thread("MicroWebSocket", func, args) + return th + except : + time.sleep_ms(100) + return False + + # ============================================================================ + # ===( Constructor )========================================================== + # ============================================================================ + + def __init__(self, socket, httpClient, httpResponse, maxRecvLen, threaded, acceptCallback, stackSize=4096) : + self._socket = socket + self._httpCli = httpClient + self._closed = True + self.RecvTextCallback = None + self.RecvBinaryCallback = None + self.ClosedCallback = None + self.thID = None + self.isThreaded = threaded + if self._handshake(httpResponse) : + self._ctrlBuf = MicroWebSocket._tryAllocByteArray(0x7D) + self._msgBuf = MicroWebSocket._tryAllocByteArray(maxRecvLen) + if self._ctrlBuf and self._msgBuf : + self._msgType = None + self._msgLen = 0 + if threaded : + th = MicroWebSocket._tryStartThread(self._wsProcess, (acceptCallback, ), stackSize) + if th: + self.thID = th + return + else : + self._wsProcess(acceptCallback) + return + print("MicroWebSocket : Out of memory on new WebSocket connection.") + try : + self._socket.close() + except : + pass + + # ============================================================================ + # ===( Functions )============================================================ + # ============================================================================ + + def _handshake(self, httpResponse) : + try : + key = self._httpCli.GetRequestHeaders().get('Sec-WebSocket-Key', None) + if key : + r = sha1(key + self._handshakeSign).digest() + r = b2a_base64(r).decode() + httpResponse.WriteSwitchProto("websocket", { "Sec-WebSocket-Accept" : r }) + return True + except : + pass + return False + + # ---------------------------------------------------------------------------- + + def _wsProcess(self, acceptCallback) : + self._socket.settimeout(3600) + self._closed = False + try : + acceptCallback(self, self._httpCli) + except Exception as ex : + print("MicroWebSocket : Error on accept callback (%s)." % str(ex)) + + while not self._closed : + if self.isThreaded: + notify = _thread.getnotification() + if notify == _thread.EXIT: + self.Close() + break + if not self._receiveFrame() : + self.Close() + + if self.ClosedCallback : + try : + self.ClosedCallback(self) + except Exception as ex : + print("MicroWebSocket : Error on closed callback (%s)." % str(ex)) + + # ---------------------------------------------------------------------------- + + def _receiveFrame(self) : + try : + + b = self._socket.read(2) + if not b or len(b) != 2 : + return False + + fin = b[0] & 0x80 > 0 + opcode = b[0] & 0x0F + masked = b[1] & 0x80 > 0 + length = b[1] & 0x7F + + if opcode == self._opContFrame and not self._msgType : + return False + elif opcode == self._opTextFrame : + self._msgType = self._msgTypeText + elif opcode == self._opBinFrame : + self._msgType = self._msgTypeBin + + if length == 0x7E : + b = self._socket.read(2) + if not b or len(b) != 2 : + return False + length = (b[0] << 8) + b[1] + elif length == 0x7F : + return False + + mask = self._socket.read(4) if masked else None + if masked and (not mask or len(mask) != 4) : + return False + + if opcode == self._opContFrame or \ + opcode == self._opTextFrame or \ + opcode == self._opBinFrame : + + if length > 0 : + buf = memoryview(self._msgBuf)[self._msgLen:] + if length > len(buf) : + return False + if self._socket.readinto(buf, length) != length : + return False + if masked : + for i in range(length) : + idx = self._msgLen + i + self._msgBuf[idx] ^= mask[i%4] + self._msgLen += length + if fin : + b = bytes(memoryview(self._msgBuf)[:self._msgLen]) + if self._msgType == self._msgTypeText : + if self.RecvTextCallback : + try : + self.RecvTextCallback(self, b.decode()) + except Exception as ex : + print("MicroWebSocket : Error on recv text callback (%s)." % str(ex)) + else : + if self.RecvBinaryCallback : + try : + self.RecvBinaryCallback(self, b) + except Exception as ex : + print("MicroWebSocket : Error on recv binary callback (%s)." % str(ex)) + self._msgType = None + self._msgLen = 0 + else : + return False + + elif opcode == self._opPingFrame : + + if length > len(self._ctrlBuf) : + return False + if length > 0 : + if self._socket.readinto(self._ctrlBuf, length) != length : + return False + pingData = memoryview(self._ctrlBuf)[:length] + else : + pingData = None + self._sendFrame(self._opPongFrame, pingData) + + elif opcode == self._opCloseFrame : + self.Close() + + except : + return False + + return True + + # ---------------------------------------------------------------------------- + + def _sendFrame(self, opcode, data=None, fin=True) : + if not self._closed and opcode >= 0x00 and opcode <= 0x0F : + dataLen = 0 if not data else len(data) + if dataLen <= 0xFFFF : + b1 = (0x80 | opcode) if fin else opcode + b2 = 0x7E if dataLen >= 0x7E else dataLen + try : + if self._socket.write(pack('>BB', b1, b2)) == 2 : + if dataLen > 0 : + if dataLen >= 0x7E : + self._socket.write(pack('>H', dataLen)) + return self._socket.write(data) == dataLen + else : + return True + except : + pass + return False + + # ---------------------------------------------------------------------------- + + def SendText(self, msg) : + return self._sendFrame(self._opTextFrame, msg.encode()) + + # ---------------------------------------------------------------------------- + + def SendBinary(self, data) : + return self._sendFrame(self._opBinFrame, data) + + # ---------------------------------------------------------------------------- + + def IsClosed(self) : + return self._closed + + # ---------------------------------------------------------------------------- + + def threadID(self) : + return self.thID + + # ---------------------------------------------------------------------------- + + def Close(self) : + if not self._closed : + try : + self._sendFrame(self._opCloseFrame) + self._socket.close() + self._closed = True + except : + pass + + # ============================================================================ + # ============================================================================ + # ============================================================================ + diff --git a/MicroPython_BUILD/components/micropython/esp32/modules/microWebSrv.py b/MicroPython_BUILD/components/micropython/esp32/modules/microWebSrv.py index 2bc5156..589a001 100644 --- a/MicroPython_BUILD/components/micropython/esp32/modules/microWebSrv.py +++ b/MicroPython_BUILD/components/micropython/esp32/modules/microWebSrv.py @@ -1,11 +1,10 @@ -from ujson import dumps -from uos import stat -from utime import sleep_ms -from sys import exc_info -from hashlib import sha1 -from ubinascii import b2a_base64 -import socket, gc, _thread +from json import dumps +from os import stat +import socket +import gc +import network +import socket, gc, _thread, time try : from microWebTemplate import MicroWebTemplate @@ -32,42 +31,119 @@ class MicroWebSrv : "default.htm" ] - # ---------------------------------------------------------------------------- - _mimeTypes = { - ".txt" : "text/plain", - ".htm" : "text/html", - ".html" : "text/html", - ".css" : "text/css", - ".csv" : "text/csv", - ".js" : "application/javascript", - ".xml" : "application/xml", - ".xhtml" : "application/xhtml+xml", - ".json" : "application/json", - ".zip" : "application/zip", - ".pdf" : "application/pdf", - ".jpg" : "image/jpeg", - ".jpeg" : "image/jpeg", - ".png" : "image/png", - ".gif" : "image/gif", - ".svg" : "image/svg+xml", - ".ico" : "image/x-icon" + ".txt" : "text/plain", + ".htm" : "text/html", + ".html" : "text/html", + ".css" : "text/css", + ".csv" : "text/csv", + ".js" : "application/javascript", + ".xml" : "application/xml", + ".xhtml" : "application/xhtml+xml", + ".json" : "application/json", + ".zip" : "application/zip", + ".pdf" : "application/pdf", + ".jpg" : "image/jpeg", + ".jpeg" : "image/jpeg", + ".png" : "image/png", + ".gif" : "image/gif", + ".svg" : "image/svg+xml", + ".ico" : "image/x-icon" } - # ---------------------------------------------------------------------------- + _html_escape_chars = { + "&" : "&", + '"' : """, + "'" : "'", + ">" : ">", + "<" : "<" + } _pyhtmlPagesExt = '.pyhtml' + # ============================================================================ + # ===( Utils )=============================================================== + # ============================================================================ + + def HTMLEscape(s) : + return ''.join(MicroWebSrv._html_escape_chars.get(c, c) for c in s) + + # ---------------------------------------------------------------------------- + + def _tryAllocByteArray(size) : + for x in range(10) : + try : + gc.collect() + return bytearray(size) + except : + pass + return None + + # ---------------------------------------------------------------------------- + + def _tryStartThread(func, args=()) : + _ = _thread.stack_size(8*1024) + for x in range(4) : + try : + gc.collect() + th = _thread.start_new_thread("MicroWebServer", func, args) + return th + except : + time.sleep_ms(100) + return False + + # ---------------------------------------------------------------------------- + def _unquote(s) : + r = s.split('%') + for i in range(1, len(r)) : + s = r[i] + try : + r[i] = chr(int(s[:2], 16)) + s[2:] + except : + r[i] = '%' + s + return ''.join(r) + + # ---------------------------------------------------------------------------- + + def _unquote_plus(s) : + return MicroWebSrv._unquote(s.replace('+', ' ')) + + # ---------------------------------------------------------------------------- + + def _fileExists(path) : + try : + stat(path) + return True + except : + return False + + # ---------------------------------------------------------------------------- + + def _isPyHTMLFile(filename) : + return filename.lower().endswith(MicroWebSrv._pyhtmlPagesExt) + # ============================================================================ # ===( Constructor )========================================================== # ============================================================================ - def __init__(self, routeHandlers=None, port=80, webPath="/flash/www") : + def __init__( self, + routeHandlers = None, + port = 80, + bindIP = '0.0.0.0', + webPath = "/flash/www" ) : self._routeHandlers = routeHandlers - self._srvAddr = ('0.0.0.0', port) + self._srvAddr = (bindIP, port) self._webPath = webPath self._notFoundUrl = None self._started = False + self.thID = None + self.isThreaded = False + self._state = "Stoped" + + self.MaxWebSocketRecvLen = 1024 + self.WebSocketThreaded = True + self.WebSocketStackSize = 4096 + self.AcceptWebSocketCallback = None # ============================================================================ # ===( Server Process )======================================================= @@ -75,10 +151,23 @@ class MicroWebSrv : def _serverProcess(self) : self._started = True + self._state = "Running" while True : - gc.collect() try : - client, cliAddr = self._server.accept() + client, cliAddr = self._server.accepted() + if client == None: + if self.isThreaded: + notify = _thread.getnotification() + if notify == _thread.EXIT: + break + elif notify == _thread.SUSPEND: + self._state = "Suspended" + while _thread.wait() != _thread.RESUME: + pass + self._state = "Running" + # gc.collect() + time.sleep_ms(2) + continue except : break self._client(self, client, cliAddr) @@ -90,6 +179,10 @@ class MicroWebSrv : def Start(self, threaded=True) : if not self._started : + if not network.WLAN().isconnected(): + print("WLAN not connected!") + return + gc.collect() self._server = socket.socket( socket.AF_INET, socket.SOCK_STREAM, socket.IPPROTO_TCP ) @@ -98,10 +191,13 @@ class MicroWebSrv : 1 ) self._server.bind(self._srvAddr) self._server.listen(1) - gc.collect() + self.isThreaded = threaded + # using non-blocking socket + self._server.settimeout(0.5) if threaded : - _ = _thread.stack_size(8*1024) - _thread.start_new_thread("MicroWebServer", self._serverProcess, ()) + th = MicroWebSrv._tryStartThread(self._serverProcess) + if th: + self.thID = th else : self._serverProcess() @@ -113,6 +209,21 @@ class MicroWebSrv : # ---------------------------------------------------------------------------- + def IsStarted(self) : + return self._started + + # ---------------------------------------------------------------------------- + + def threadID(self) : + return self.thID + + # ---------------------------------------------------------------------------- + + def State(self) : + return self._state + + # ---------------------------------------------------------------------------- + def SetNotFoundPageUrl(self, url=None) : self._notFoundUrl = url @@ -128,7 +239,7 @@ class MicroWebSrv : # ---------------------------------------------------------------------------- def GetRouteHandler(self, resUrl, method) : - if self._routeHandlers is not None : + if self._routeHandlers : resUrl = resUrl.upper() method = method.upper() for route in self._routeHandlers : @@ -140,66 +251,18 @@ class MicroWebSrv : # ---------------------------------------------------------------------------- - def HTMLEscape(self, s) : - return ''.join(self._html_escape_chars.get(c, c) for c in s) - - _html_escape_chars = { - "&": "&", - '"': """, - "'": "'", - ">": ">", - "<": "<" - } - - # ============================================================================ - # ===( Utils )=============================================================== - # ============================================================================ - - _hextochr = dict(('%02x' % i, chr(i)) for i in range(256)) - - def _unquote(self, s) : - res = s.split('%') - for i in range(1, len(res)): - item = res[i] - try: - res[i] = self._hextochr[item[:2].lower()] + item[2:] - except KeyError: - res[i] = '%' + item - return "".join(res) - - # ---------------------------------------------------------------------------- - - def _unquote_plus(self, s) : - return self._unquote(s.replace('+', ' ')) - - # ---------------------------------------------------------------------------- - - def _fileExists(self, path) : - try : - stat(path) - return True - except : - return False - - # ---------------------------------------------------------------------------- - def _physPathFromURLPath(self, urlPath) : if urlPath == '/' : for idxPage in self._indexPages : physPath = self._webPath + '/' + idxPage - if self._fileExists(physPath) : + if MicroWebSrv._fileExists(physPath) : return physPath else : physPath = self._webPath + urlPath - if self._fileExists(physPath) : + if MicroWebSrv._fileExists(physPath) : return physPath return None - # ---------------------------------------------------------------------------- - - def _isPyHTMLFile(self, filename) : - return filename.lower().endswith(self._pyhtmlPagesExt) - # ============================================================================ # ===( Class Client )======================================================== # ============================================================================ @@ -209,7 +272,7 @@ class MicroWebSrv : # ------------------------------------------------------------------------ def __init__(self, microWebSrv, socket, addr) : - socket.settimeout(5) + socket.settimeout(4) self._microWebSrv = microWebSrv self._socket = socket self._addr = addr @@ -232,18 +295,18 @@ class MicroWebSrv : if self._parseFirstLine(response) : if self._parseHeader(response) : upg = self._getConnUpgrade() - if upg is None : + if not upg : routeHandler = self._microWebSrv.GetRouteHandler(self._resPath, self._method) - if routeHandler is not None : + if routeHandler : routeHandler(self, response) elif self._method.upper() == "GET" : filepath = self._microWebSrv._physPathFromURLPath(self._resPath) - if filepath is not None : - if self._microWebSrv._isPyHTMLFile(filepath) : + if filepath : + if MicroWebSrv._isPyHTMLFile(filepath) : response.WriteResponsePyHTMLFile(filepath) else : contentType = self._microWebSrv.GetMimeTypeFromFilename(filepath) - if contentType is not None : + if contentType : response.WriteResponseFile(filepath, contentType) else : response.WriteResponseForbidden() @@ -251,9 +314,16 @@ class MicroWebSrv : response.WriteResponseNotFound() else : response.WriteResponseMethodNotAllowed() - elif upg == 'websocket' and 'MicroWebSocket' in globals() : - MicroWebSocket(self._socket, self, response) - return + elif upg == 'websocket' and 'MicroWebSocket' in globals() \ + and self._microWebSrv.AcceptWebSocketCallback : + MicroWebSocket( socket = self._socket, + httpClient = self, + httpResponse = response, + maxRecvLen = self._microWebSrv.MaxWebSocketRecvLen, + threaded = self._microWebSrv.WebSocketThreaded, + acceptCallback = self._microWebSrv.AcceptWebSocketCallback, + stackSize = self._microWebSrv.WebSocketStackSize ) + return else : response.WriteResponseNotImplemented() else : @@ -269,22 +339,22 @@ class MicroWebSrv : def _parseFirstLine(self, response) : try : - elements = self._socket.readline().decode().split() + elements = self._socket.readline().decode().strip().split() if len(elements) == 3 : self._method = elements[0].upper() self._path = elements[1] self._httpVer = elements[2].upper() elements = self._path.split('?', 1) if len(elements) > 0 : - self._resPath = self._microWebSrv._unquote(elements[0]) + self._resPath = MicroWebSrv._unquote_plus(elements[0]) if len(elements) > 1 : self._queryString = elements[1] elements = self._queryString.split('&') for s in elements : param = s.split('=', 1) if len(param) > 0 : - value = self._microWebSrv._unquote_plus(param[1]) if len(param) > 1 else '' - self._queryParams[self._microWebSrv._unquote(param[0])] = value + value = MicroWebSrv._unquote(param[1]) if len(param) > 1 else '' + self._queryParams[MicroWebSrv._unquote(param[0])] = value return True except : pass @@ -300,7 +370,7 @@ class MicroWebSrv : elif len(elements) == 1 and len(elements[0]) == 0 : if self._method == 'POST' : self._contentType = self._headers.get("Content-Type", None) - self._contentLength = self._headers.get("Content-Length", 0) + self._contentLength = int(self._headers.get("Content-Length", 0)) return True else : return False @@ -308,7 +378,7 @@ class MicroWebSrv : # ------------------------------------------------------------------------ def _getConnUpgrade(self) : - if self._headers.get('Connection', '').lower() == 'upgrade' : + if 'upgrade' in self._headers.get('Connection', '').lower() : return self._headers.get('Upgrade', '').lower() return None @@ -376,14 +446,16 @@ class MicroWebSrv : def ReadRequestContent(self, size=None) : self._socket.setblocking(False) - if size is None : - b = self._socket.readall() - elif size <= 0 : - b = None - else : - b = self._socket.read(size) + b = None + try : + if not size : + b = self._socket.read(self._contentLength) + elif size > 0 : + b = self._socket.read(size) + except : + pass self._socket.setblocking(True) - return b if b is not None else b'' + return b if b else b'' # ------------------------------------------------------------------------ @@ -395,8 +467,8 @@ class MicroWebSrv : for s in elements : param = s.split('=', 1) if len(param) > 0 : - value = self._microWebSrv._unquote_plus(param[1]) if len(param) > 1 else '' - res[self._microWebSrv._unquote(param[0])] = value + value = MicroWebSrv._unquote(param[1]) if len(param) > 1 else '' + res[MicroWebSrv._unquote(param[0])] = value return res # ============================================================================ @@ -413,7 +485,7 @@ class MicroWebSrv : # ------------------------------------------------------------------------ def _write(self, data) : - return self._client._socket.send(data) + return self._client._socket.write(data) # ------------------------------------------------------------------------ @@ -429,9 +501,9 @@ class MicroWebSrv : # ------------------------------------------------------------------------ def _writeContentTypeHeader(self, contentType, charset=None) : - if contentType is not None : + if contentType : ct = contentType \ - + (("; charset=%s" % charset) if charset is not None else "") + + (("; charset=%s" % charset) if charset else "") else : ct = "application/octet-stream" self._writeHeader("Content-Type", ct) @@ -469,7 +541,7 @@ class MicroWebSrv : def WriteResponse(self, code, headers, contentType, contentCharset, content) : try : - contentLength = len(content) if content is not None else 0 + contentLength = len(content) if content else 0 self._writeBeforeContent(code, headers, contentType, contentCharset, contentLength) if contentLength > 0 : self._write(content) @@ -483,17 +555,17 @@ class MicroWebSrv : if 'MicroWebTemplate' in globals() : with open(filepath, 'r') as file : code = file.read() - mWebTmpl = MicroWebTemplate(code, escapeStrFunc=self._client._microWebSrv.HTMLEscape) + mWebTmpl = MicroWebTemplate(code, escapeStrFunc=MicroWebSrv.HTMLEscape) try : return self.WriteResponseOk(headers, "text/html", "UTF-8", mWebTmpl.Execute()) - except : + except Exception as ex : return self.WriteResponse( 500, None, "text/html", "UTF-8", self._execErrCtnTmpl % { 'module' : 'PyHTML', - 'message' : exc_info()[1] + 'message' : str(ex) } ) return self.WriteResponseNotImplemented() @@ -501,33 +573,21 @@ class MicroWebSrv : def WriteResponseFile(self, filepath, contentType=None, headers=None) : try : - filesize = stat(filepath)[6] - if filesize > 0 : + size = stat(filepath)[6] + if size > 0 : with open(filepath, 'rb') as file : - self._writeBeforeContent(200, headers, contentType, None, filesize) - sizeRead = 0 - while True : - retry = 0 - while True : - try : - data = file.read(256) - break - except : - retry += 1 - if retry > 30 : - file.close() - return False - sleep_ms(10) - rdlen = len(data) - sktres = -1 - try : - sktres = self._write(data) - except : - pass - sizeRead += rdlen - if (sizeRead == filesize) or (len(data) < 256) or (sktres < 0) : - file.close() - return True + self._writeBeforeContent(200, headers, contentType, None, size) + buf = MicroWebSrv._tryAllocByteArray(1024) + if buf : + while size > 0 : + x = file.readinto(buf) + if x < len(buf) : + buf = memoryview(buf)[:x] + self._write(buf) + size -= x + return True + self.WriteResponseInternalServerError() + return False except : pass self.WriteResponseNotFound() @@ -578,7 +638,7 @@ class MicroWebSrv : None, "application/json", "UTF-8", - dumps(obj if obj is not None else { }) ) + dumps(obj if obj else { }) ) # ------------------------------------------------------------------------ @@ -593,7 +653,7 @@ class MicroWebSrv : # ------------------------------------------------------------------------ def WriteResponseNotFound(self) : - if self._client._microWebSrv._notFoundUrl is not None : + if self._client._microWebSrv._notFoundUrl : self.WriteResponseRedirect(self._client._microWebSrv._notFoundUrl) else : return self.WriteResponseError(404) diff --git a/MicroPython_BUILD/components/micropython/esp32/modules/microWebSrv.py.lobo b/MicroPython_BUILD/components/micropython/esp32/modules/microWebSrv.py.lobo new file mode 100644 index 0000000..2bc5156 --- /dev/null +++ b/MicroPython_BUILD/components/micropython/esp32/modules/microWebSrv.py.lobo @@ -0,0 +1,715 @@ + +from ujson import dumps +from uos import stat +from utime import sleep_ms +from sys import exc_info +from hashlib import sha1 +from ubinascii import b2a_base64 +import socket, gc, _thread + +try : + from microWebTemplate import MicroWebTemplate +except : + pass + +try : + from microWebSocket import MicroWebSocket +except : + pass + +class MicroWebSrv : + + # ============================================================================ + # ===( Constants )============================================================ + # ============================================================================ + + _indexPages = [ + "index.pyhtml", + "index.html", + "index.htm", + "default.pyhtml", + "default.html", + "default.htm" + ] + + # ---------------------------------------------------------------------------- + + _mimeTypes = { + ".txt" : "text/plain", + ".htm" : "text/html", + ".html" : "text/html", + ".css" : "text/css", + ".csv" : "text/csv", + ".js" : "application/javascript", + ".xml" : "application/xml", + ".xhtml" : "application/xhtml+xml", + ".json" : "application/json", + ".zip" : "application/zip", + ".pdf" : "application/pdf", + ".jpg" : "image/jpeg", + ".jpeg" : "image/jpeg", + ".png" : "image/png", + ".gif" : "image/gif", + ".svg" : "image/svg+xml", + ".ico" : "image/x-icon" + } + + # ---------------------------------------------------------------------------- + + _pyhtmlPagesExt = '.pyhtml' + + # ============================================================================ + # ===( Constructor )========================================================== + # ============================================================================ + + def __init__(self, routeHandlers=None, port=80, webPath="/flash/www") : + self._routeHandlers = routeHandlers + self._srvAddr = ('0.0.0.0', port) + self._webPath = webPath + self._notFoundUrl = None + self._started = False + + # ============================================================================ + # ===( Server Process )======================================================= + # ============================================================================ + + def _serverProcess(self) : + self._started = True + while True : + gc.collect() + try : + client, cliAddr = self._server.accept() + except : + break + self._client(self, client, cliAddr) + self._started = False + + # ============================================================================ + # ===( Functions )============================================================ + # ============================================================================ + + def Start(self, threaded=True) : + if not self._started : + self._server = socket.socket( socket.AF_INET, + socket.SOCK_STREAM, + socket.IPPROTO_TCP ) + self._server.setsockopt( socket.SOL_SOCKET, + socket.SO_REUSEADDR, + 1 ) + self._server.bind(self._srvAddr) + self._server.listen(1) + gc.collect() + if threaded : + _ = _thread.stack_size(8*1024) + _thread.start_new_thread("MicroWebServer", self._serverProcess, ()) + else : + self._serverProcess() + + # ---------------------------------------------------------------------------- + + def Stop(self) : + if self._started : + self._server.close() + + # ---------------------------------------------------------------------------- + + def SetNotFoundPageUrl(self, url=None) : + self._notFoundUrl = url + + # ---------------------------------------------------------------------------- + + def GetMimeTypeFromFilename(self, filename) : + filename = filename.lower() + for ext in self._mimeTypes : + if filename.endswith(ext) : + return self._mimeTypes[ext] + return None + + # ---------------------------------------------------------------------------- + + def GetRouteHandler(self, resUrl, method) : + if self._routeHandlers is not None : + resUrl = resUrl.upper() + method = method.upper() + for route in self._routeHandlers : + if len(route) == 3 and \ + route[0].upper() == resUrl and \ + route[1].upper() == method : + return route[2] + return None + + # ---------------------------------------------------------------------------- + + def HTMLEscape(self, s) : + return ''.join(self._html_escape_chars.get(c, c) for c in s) + + _html_escape_chars = { + "&": "&", + '"': """, + "'": "'", + ">": ">", + "<": "<" + } + + # ============================================================================ + # ===( Utils )=============================================================== + # ============================================================================ + + _hextochr = dict(('%02x' % i, chr(i)) for i in range(256)) + + def _unquote(self, s) : + res = s.split('%') + for i in range(1, len(res)): + item = res[i] + try: + res[i] = self._hextochr[item[:2].lower()] + item[2:] + except KeyError: + res[i] = '%' + item + return "".join(res) + + # ---------------------------------------------------------------------------- + + def _unquote_plus(self, s) : + return self._unquote(s.replace('+', ' ')) + + # ---------------------------------------------------------------------------- + + def _fileExists(self, path) : + try : + stat(path) + return True + except : + return False + + # ---------------------------------------------------------------------------- + + def _physPathFromURLPath(self, urlPath) : + if urlPath == '/' : + for idxPage in self._indexPages : + physPath = self._webPath + '/' + idxPage + if self._fileExists(physPath) : + return physPath + else : + physPath = self._webPath + urlPath + if self._fileExists(physPath) : + return physPath + return None + + # ---------------------------------------------------------------------------- + + def _isPyHTMLFile(self, filename) : + return filename.lower().endswith(self._pyhtmlPagesExt) + + # ============================================================================ + # ===( Class Client )======================================================== + # ============================================================================ + + class _client : + + # ------------------------------------------------------------------------ + + def __init__(self, microWebSrv, socket, addr) : + socket.settimeout(5) + self._microWebSrv = microWebSrv + self._socket = socket + self._addr = addr + self._method = None + self._path = None + self._httpVer = None + self._resPath = "/" + self._queryString = "" + self._queryParams = { } + self._headers = { } + self._contentType = None + self._contentLength = 0 + self._processRequest() + + # ------------------------------------------------------------------------ + + def _processRequest(self) : + try : + response = MicroWebSrv._response(self) + if self._parseFirstLine(response) : + if self._parseHeader(response) : + upg = self._getConnUpgrade() + if upg is None : + routeHandler = self._microWebSrv.GetRouteHandler(self._resPath, self._method) + if routeHandler is not None : + routeHandler(self, response) + elif self._method.upper() == "GET" : + filepath = self._microWebSrv._physPathFromURLPath(self._resPath) + if filepath is not None : + if self._microWebSrv._isPyHTMLFile(filepath) : + response.WriteResponsePyHTMLFile(filepath) + else : + contentType = self._microWebSrv.GetMimeTypeFromFilename(filepath) + if contentType is not None : + response.WriteResponseFile(filepath, contentType) + else : + response.WriteResponseForbidden() + else : + response.WriteResponseNotFound() + else : + response.WriteResponseMethodNotAllowed() + elif upg == 'websocket' and 'MicroWebSocket' in globals() : + MicroWebSocket(self._socket, self, response) + return + else : + response.WriteResponseNotImplemented() + else : + response.WriteResponseBadRequest() + except : + response.WriteResponseInternalServerError() + try : + self._socket.close() + except : + pass + + # ------------------------------------------------------------------------ + + def _parseFirstLine(self, response) : + try : + elements = self._socket.readline().decode().split() + if len(elements) == 3 : + self._method = elements[0].upper() + self._path = elements[1] + self._httpVer = elements[2].upper() + elements = self._path.split('?', 1) + if len(elements) > 0 : + self._resPath = self._microWebSrv._unquote(elements[0]) + if len(elements) > 1 : + self._queryString = elements[1] + elements = self._queryString.split('&') + for s in elements : + param = s.split('=', 1) + if len(param) > 0 : + value = self._microWebSrv._unquote_plus(param[1]) if len(param) > 1 else '' + self._queryParams[self._microWebSrv._unquote(param[0])] = value + return True + except : + pass + return False + + # ------------------------------------------------------------------------ + + def _parseHeader(self, response) : + while True : + elements = self._socket.readline().decode().strip().split(':', 1) + if len(elements) == 2 : + self._headers[elements[0].strip()] = elements[1].strip() + elif len(elements) == 1 and len(elements[0]) == 0 : + if self._method == 'POST' : + self._contentType = self._headers.get("Content-Type", None) + self._contentLength = self._headers.get("Content-Length", 0) + return True + else : + return False + + # ------------------------------------------------------------------------ + + def _getConnUpgrade(self) : + if self._headers.get('Connection', '').lower() == 'upgrade' : + return self._headers.get('Upgrade', '').lower() + return None + + # ------------------------------------------------------------------------ + + def GetServer(self) : + return self._microWebSrv + + # ------------------------------------------------------------------------ + + def GetAddr(self) : + return self._addr + + # ------------------------------------------------------------------------ + + def GetIPAddr(self) : + return self._addr[0] + + # ------------------------------------------------------------------------ + + def GetPort(self) : + return self._addr[1] + + # ------------------------------------------------------------------------ + + def GetRequestMethod(self) : + return self._method + + # ------------------------------------------------------------------------ + + def GetRequestTotalPath(self) : + return self._path + + # ------------------------------------------------------------------------ + + def GetRequestPath(self) : + return self._resPath + + # ------------------------------------------------------------------------ + + def GetRequestQueryString(self) : + return self._queryString + + # ------------------------------------------------------------------------ + + def GetRequestQueryParams(self) : + return self._queryParams + + # ------------------------------------------------------------------------ + + def GetRequestHeaders(self) : + return self._headers + + # ------------------------------------------------------------------------ + + def GetRequestContentType(self) : + return self._contentType + + # ------------------------------------------------------------------------ + + def GetRequestContentLength(self) : + return self._contentLength + + # ------------------------------------------------------------------------ + + def ReadRequestContent(self, size=None) : + self._socket.setblocking(False) + if size is None : + b = self._socket.readall() + elif size <= 0 : + b = None + else : + b = self._socket.read(size) + self._socket.setblocking(True) + return b if b is not None else b'' + + # ------------------------------------------------------------------------ + + def ReadRequestPostedFormData(self) : + res = { } + data = self.ReadRequestContent() + if len(data) > 0 : + elements = data.decode().split('&') + for s in elements : + param = s.split('=', 1) + if len(param) > 0 : + value = self._microWebSrv._unquote_plus(param[1]) if len(param) > 1 else '' + res[self._microWebSrv._unquote(param[0])] = value + return res + + # ============================================================================ + # ===( Class Response )====================================================== + # ============================================================================ + + class _response : + + # ------------------------------------------------------------------------ + + def __init__(self, client) : + self._client = client + + # ------------------------------------------------------------------------ + + def _write(self, data) : + return self._client._socket.send(data) + + # ------------------------------------------------------------------------ + + def _writeFirstLine(self, code) : + reason = self._responseCodes.get(code, ('Unknown reason', ))[0] + self._write("HTTP/1.0 %s %s\r\n" % (code, reason)) + + # ------------------------------------------------------------------------ + + def _writeHeader(self, name, value) : + self._write("%s: %s\r\n" % (name, value)) + + # ------------------------------------------------------------------------ + + def _writeContentTypeHeader(self, contentType, charset=None) : + if contentType is not None : + ct = contentType \ + + (("; charset=%s" % charset) if charset is not None else "") + else : + ct = "application/octet-stream" + self._writeHeader("Content-Type", ct) + + # ------------------------------------------------------------------------ + + def _writeEndHeader(self) : + self._write("\r\n") + + # ------------------------------------------------------------------------ + + def _writeBeforeContent(self, code, headers, contentType, contentCharset, contentLength) : + self._writeFirstLine(code) + if isinstance(headers, dict) : + for header in headers : + self._writeHeader(header, headers[header]) + if contentLength > 0 : + self._writeContentTypeHeader(contentType, contentCharset) + self._writeHeader("Content-Length", contentLength) + self._writeHeader("Server", "MicroWebSrv by JC`zic") + self._writeHeader("Connection", "close") + self._writeEndHeader() + + # ------------------------------------------------------------------------ + + def WriteSwitchProto(self, upgrade, headers=None) : + self._writeFirstLine(101) + self._writeHeader("Connection", "Upgrade") + self._writeHeader("Upgrade", upgrade) + if isinstance(headers, dict) : + for header in headers : + self._writeHeader(header, headers[header]) + + # ------------------------------------------------------------------------ + + def WriteResponse(self, code, headers, contentType, contentCharset, content) : + try : + contentLength = len(content) if content is not None else 0 + self._writeBeforeContent(code, headers, contentType, contentCharset, contentLength) + if contentLength > 0 : + self._write(content) + return True + except : + return False + + # ------------------------------------------------------------------------ + + def WriteResponsePyHTMLFile(self, filepath, headers=None) : + if 'MicroWebTemplate' in globals() : + with open(filepath, 'r') as file : + code = file.read() + mWebTmpl = MicroWebTemplate(code, escapeStrFunc=self._client._microWebSrv.HTMLEscape) + try : + return self.WriteResponseOk(headers, "text/html", "UTF-8", mWebTmpl.Execute()) + except : + return self.WriteResponse( 500, + None, + "text/html", + "UTF-8", + self._execErrCtnTmpl % { + 'module' : 'PyHTML', + 'message' : exc_info()[1] + } ) + return self.WriteResponseNotImplemented() + + # ------------------------------------------------------------------------ + + def WriteResponseFile(self, filepath, contentType=None, headers=None) : + try : + filesize = stat(filepath)[6] + if filesize > 0 : + with open(filepath, 'rb') as file : + self._writeBeforeContent(200, headers, contentType, None, filesize) + sizeRead = 0 + while True : + retry = 0 + while True : + try : + data = file.read(256) + break + except : + retry += 1 + if retry > 30 : + file.close() + return False + sleep_ms(10) + rdlen = len(data) + sktres = -1 + try : + sktres = self._write(data) + except : + pass + sizeRead += rdlen + if (sizeRead == filesize) or (len(data) < 256) or (sktres < 0) : + file.close() + return True + except : + pass + self.WriteResponseNotFound() + return False + + # ------------------------------------------------------------------------ + + def WriteResponseFileAttachment(self, filepath, attachmentName, headers=None) : + if not isinstance(headers, dict) : + headers = { } + headers["Content-Disposition"] = "attachment; filename=\"%s\"" % attachmentName + return self.WriteResponseFile(filepath, None, headers) + + # ------------------------------------------------------------------------ + + def WriteResponseOk(self, headers=None, contentType=None, contentCharset=None, content=None) : + return self.WriteResponse(200, headers, contentType, contentCharset, content) + + # ------------------------------------------------------------------------ + + def WriteResponseJSONOk(self, obj=None, headers=None) : + return self.WriteResponseOk(headers, "application/json", "UTF-8", dumps(obj)) + + # ------------------------------------------------------------------------ + + def WriteResponseRedirect(self, location) : + headers = { "Location" : location } + return self.WriteResponse(302, headers, None, None, None) + + # ------------------------------------------------------------------------ + + def WriteResponseError(self, code) : + responseCode = self._responseCodes.get(code, ('Unknown reason', '')) + return self.WriteResponse( code, + None, + "text/html", + "UTF-8", + self._errCtnTmpl % { + 'code' : code, + 'reason' : responseCode[0], + 'message' : responseCode[1] + } ) + + # ------------------------------------------------------------------------ + + def WriteResponseJSONError(self, code, obj=None) : + return self.WriteResponse( code, + None, + "application/json", + "UTF-8", + dumps(obj if obj is not None else { }) ) + + # ------------------------------------------------------------------------ + + def WriteResponseBadRequest(self) : + return self.WriteResponseError(400) + + # ------------------------------------------------------------------------ + + def WriteResponseForbidden(self) : + return self.WriteResponseError(403) + + # ------------------------------------------------------------------------ + + def WriteResponseNotFound(self) : + if self._client._microWebSrv._notFoundUrl is not None : + self.WriteResponseRedirect(self._client._microWebSrv._notFoundUrl) + else : + return self.WriteResponseError(404) + + # ------------------------------------------------------------------------ + + def WriteResponseMethodNotAllowed(self) : + return self.WriteResponseError(405) + + # ------------------------------------------------------------------------ + + def WriteResponseInternalServerError(self) : + return self.WriteResponseError(500) + + # ------------------------------------------------------------------------ + + def WriteResponseNotImplemented(self) : + return self.WriteResponseError(501) + + # ------------------------------------------------------------------------ + + _errCtnTmpl = """\ + + + Error + + +

%(code)d %(reason)s

+ %(message)s + + + """ + + # ------------------------------------------------------------------------ + + _execErrCtnTmpl = """\ + + + Page execution error + + +

%(module)s page execution error

+ %(message)s + + + """ + + # ------------------------------------------------------------------------ + + _responseCodes = { + 100: ('Continue', 'Request received, please continue'), + 101: ('Switching Protocols', + 'Switching to new protocol; obey Upgrade header'), + + 200: ('OK', 'Request fulfilled, document follows'), + 201: ('Created', 'Document created, URL follows'), + 202: ('Accepted', + 'Request accepted, processing continues off-line'), + 203: ('Non-Authoritative Information', 'Request fulfilled from cache'), + 204: ('No Content', 'Request fulfilled, nothing follows'), + 205: ('Reset Content', 'Clear input form for further input.'), + 206: ('Partial Content', 'Partial content follows.'), + + 300: ('Multiple Choices', + 'Object has several resources -- see URI list'), + 301: ('Moved Permanently', 'Object moved permanently -- see URI list'), + 302: ('Found', 'Object moved temporarily -- see URI list'), + 303: ('See Other', 'Object moved -- see Method and URL list'), + 304: ('Not Modified', + 'Document has not changed since given time'), + 305: ('Use Proxy', + 'You must use proxy specified in Location to access this ' + 'resource.'), + 307: ('Temporary Redirect', + 'Object moved temporarily -- see URI list'), + + 400: ('Bad Request', + 'Bad request syntax or unsupported method'), + 401: ('Unauthorized', + 'No permission -- see authorization schemes'), + 402: ('Payment Required', + 'No payment -- see charging schemes'), + 403: ('Forbidden', + 'Request forbidden -- authorization will not help'), + 404: ('Not Found', 'Nothing matches the given URI'), + 405: ('Method Not Allowed', + 'Specified method is invalid for this resource.'), + 406: ('Not Acceptable', 'URI not available in preferred format.'), + 407: ('Proxy Authentication Required', 'You must authenticate with ' + 'this proxy before proceeding.'), + 408: ('Request Timeout', 'Request timed out; try again later.'), + 409: ('Conflict', 'Request conflict.'), + 410: ('Gone', + 'URI no longer exists and has been permanently removed.'), + 411: ('Length Required', 'Client must specify Content-Length.'), + 412: ('Precondition Failed', 'Precondition in headers is false.'), + 413: ('Request Entity Too Large', 'Entity is too large.'), + 414: ('Request-URI Too Long', 'URI is too long.'), + 415: ('Unsupported Media Type', 'Entity body in unsupported format.'), + 416: ('Requested Range Not Satisfiable', + 'Cannot satisfy request range.'), + 417: ('Expectation Failed', + 'Expect condition could not be satisfied.'), + + 500: ('Internal Server Error', 'Server got itself in trouble'), + 501: ('Not Implemented', + 'Server does not support this operation'), + 502: ('Bad Gateway', 'Invalid responses from another server/proxy.'), + 503: ('Service Unavailable', + 'The server cannot process the request due to a high load'), + 504: ('Gateway Timeout', + 'The gateway server did not receive a timely response'), + 505: ('HTTP Version Not Supported', 'Cannot fulfill request.'), + } + + # ============================================================================ + # ============================================================================ + # ============================================================================ + diff --git a/MicroPython_BUILD/components/micropython/esp32/modules/microWebTemplate.py b/MicroPython_BUILD/components/micropython/esp32/modules/microWebTemplate.py index e782f70..35dcfaf 100644 --- a/MicroPython_BUILD/components/micropython/esp32/modules/microWebTemplate.py +++ b/MicroPython_BUILD/components/micropython/esp32/modules/microWebTemplate.py @@ -1,6 +1,5 @@ -from sys import exc_info -import re +import re class MicroWebTemplate : @@ -51,8 +50,8 @@ class MicroWebTemplate : try : self._parseCode(execute=False) return None - except : - return exc_info()[1] + except Exception as ex : + return str(ex) # ---------------------------------------------------------------------------- @@ -60,8 +59,8 @@ class MicroWebTemplate : try : self._parseCode(execute=True) return self._rendered - except : - raise Exception(exc_info()[1]) + except Exception as ex : + raise Exception(str(ex)) # ============================================================================ # ===( Utils )=============================================================== @@ -131,8 +130,8 @@ class MicroWebTemplate : self._rendered += self._escapeStrFunc(s) else : self._rendered += s - except : - raise Exception('%s (line %s)' % (exc_info()[1], self._line)) + except Exception as ex : + raise Exception('%s (line %s)' % (str(ex), self._line)) return newTokenToProcess # ---------------------------------------------------------------------------- @@ -192,8 +191,8 @@ class MicroWebTemplate : pyCode += line + '\n' try : exec(pyCode, self._pyGlobalVars, self._pyLocalVars) - except : - raise Exception('%s (line %s)' % (exc_info()[1], self._line)) + except Exception as ex : + raise Exception('%s (line %s)' % (str(ex), self._line)) return None # ---------------------------------------------------------------------------- @@ -205,8 +204,8 @@ class MicroWebTemplate : result = eval(instructionBody, self._pyGlobalVars, self._pyLocalVars) if not isinstance(result, bool) : raise Exception('"%s" is not a boolean expression (line %s)' % (instructionBody, self._line)) - except : - raise Exception('%s (line %s)' % (exc_info()[1], self._line)) + except Exception as ex : + raise Exception('%s (line %s)' % (str(ex), self._line)) else : result = False newTokenToProcess = self._parseBloc(execute and result) @@ -265,7 +264,7 @@ class MicroWebTemplate : try : result = eval(expression, self._pyGlobalVars, self._pyLocalVars) except : - raise Exception('%s (line %s)' % (exc_info()[1], self._line)) + raise Exception('%s (line %s)' % (str(ex), self._line)) if execute and len(result) > 0 : for x in result : self._pyLocalVars[identifier] = x diff --git a/MicroPython_BUILD/components/micropython/esp32/modules/microWebTemplate.py.orig b/MicroPython_BUILD/components/micropython/esp32/modules/microWebTemplate.py.orig new file mode 100644 index 0000000..e782f70 --- /dev/null +++ b/MicroPython_BUILD/components/micropython/esp32/modules/microWebTemplate.py.orig @@ -0,0 +1,300 @@ + +from sys import exc_info +import re + +class MicroWebTemplate : + + # ============================================================================ + # ===( Constants )============================================================ + # ============================================================================ + + TOKEN_OPEN = '{{' + TOKEN_CLOSE = '}}' + TOKEN_OPEN_LEN = len(TOKEN_OPEN) + TOKEN_CLOSE_LEN = len(TOKEN_CLOSE) + + INSTRUCTION_PYTHON = 'py' + INSTRUCTION_IF = 'if' + INSTRUCTION_ELIF = 'elif' + INSTRUCTION_ELSE = 'else' + INSTRUCTION_FOR = 'for' + INSTRUCTION_END = 'end' + + # ============================================================================ + # ===( Constructor )========================================================== + # ============================================================================ + + def __init__(self, code, escapeStrFunc=None) : + self._code = code + self._escapeStrFunc = escapeStrFunc + self._pos = 0 + self._endPos = len(code)-1 + self._line = 1 + self._reIdentifier = re.compile(r'[a-zA-Z_][a-zA-Z0-9_]*$') + self._pyGlobalVars = { } + self._pyLocalVars = { } + self._rendered = '' + self._instructions = { + MicroWebTemplate.INSTRUCTION_PYTHON : self._processInstructionPYTHON, + MicroWebTemplate.INSTRUCTION_IF : self._processInstructionIF, + MicroWebTemplate.INSTRUCTION_ELIF : self._processInstructionELIF, + MicroWebTemplate.INSTRUCTION_ELSE : self._processInstructionELSE, + MicroWebTemplate.INSTRUCTION_FOR : self._processInstructionFOR, + MicroWebTemplate.INSTRUCTION_END : self._processInstructionEND, + } + + # ============================================================================ + # ===( Functions )============================================================ + # ============================================================================ + + def Validate(self) : + try : + self._parseCode(execute=False) + return None + except : + return exc_info()[1] + + # ---------------------------------------------------------------------------- + + def Execute(self) : + try : + self._parseCode(execute=True) + return self._rendered + except : + raise Exception(exc_info()[1]) + + # ============================================================================ + # ===( Utils )=============================================================== + # ============================================================================ + + def _parseCode(self, execute) : + self._pyGlobalVars = { } + self._pyLocalVars = { } + self._rendered = '' + newTokenToProcess = self._parseBloc(execute) + if newTokenToProcess is not None : + raise Exception( '"%s" instruction is not valid here (line %s)' + % (newTokenToProcess, self._line) ) + + # ---------------------------------------------------------------------------- + + def _parseBloc(self, execute) : + while self._pos <= self._endPos : + c = self._code[self._pos] + if c == MicroWebTemplate.TOKEN_OPEN[0] and \ + self._code[ self._pos : self._pos + MicroWebTemplate.TOKEN_OPEN_LEN ] == MicroWebTemplate.TOKEN_OPEN : + self._pos += MicroWebTemplate.TOKEN_OPEN_LEN + tokenContent = '' + x = self._pos + while True : + if x > self._endPos : + raise Exception("%s is missing (line %s)" % (MicroWebTemplate.TOKEN_CLOSE, self._line)) + c = self._code[x] + if c == MicroWebTemplate.TOKEN_CLOSE[0] and \ + self._code[ x : x + MicroWebTemplate.TOKEN_CLOSE_LEN ] == MicroWebTemplate.TOKEN_CLOSE : + self._pos = x + MicroWebTemplate.TOKEN_CLOSE_LEN + break + elif c == '\n' : + self._line += 1 + tokenContent += c + x += 1 + newTokenToProcess = self._processToken(tokenContent, execute) + if newTokenToProcess is not None : + return newTokenToProcess + continue + elif c == '\n' : + self._line += 1 + if execute : + self._rendered += c + self._pos += 1 + return None + + # ---------------------------------------------------------------------------- + + def _processToken(self, tokenContent, execute) : + tokenContent = tokenContent.strip() + parts = tokenContent.split(' ', 1) + instructName = parts[0].strip() + instructBody = parts[1].strip() if len(parts) > 1 else None + if len(instructName) == 0 : + raise Exception( '"%s %s" : instruction is missing (line %s)' + % (MicroWebTemplate.TOKEN_OPEN, MicroWebTemplate.TOKEN_CLOSE, self._line) ) + newTokenToProcess = None + if instructName in self._instructions : + newTokenToProcess = self._instructions[instructName](instructBody, execute) + elif execute : + try : + s = str( eval( tokenContent, + self._pyGlobalVars, + self._pyLocalVars ) ) + if (self._escapeStrFunc is not None) : + self._rendered += self._escapeStrFunc(s) + else : + self._rendered += s + except : + raise Exception('%s (line %s)' % (exc_info()[1], self._line)) + return newTokenToProcess + + # ---------------------------------------------------------------------------- + + def _processInstructionPYTHON(self, instructionBody, execute) : + if instructionBody is not None : + raise Exception( 'Instruction "%s" is invalid (line %s)' + % (MicroWebTemplate.INSTRUCTION_PYTHON, self._line) ) + pyCode = '' + while True : + if self._pos > self._endPos : + raise Exception( '"%s" instruction is missing (line %s)' + % (MicroWebTemplate.INSTRUCTION_END, self._line) ) + c = self._code[self._pos] + if c == MicroWebTemplate.TOKEN_OPEN[0] and \ + self._code[ self._pos : self._pos + MicroWebTemplate.TOKEN_OPEN_LEN ] == MicroWebTemplate.TOKEN_OPEN : + self._pos += MicroWebTemplate.TOKEN_OPEN_LEN + tokenContent = '' + x = self._pos + while True : + if x > self._endPos : + raise Exception("%s is missing (line %s)" % (MicroWebTemplate.TOKEN_CLOSE, self._line)) + c = self._code[x] + if c == MicroWebTemplate.TOKEN_CLOSE[0] and \ + self._code[ x : x + MicroWebTemplate.TOKEN_CLOSE_LEN ] == MicroWebTemplate.TOKEN_CLOSE : + self._pos = x + MicroWebTemplate.TOKEN_CLOSE_LEN + break + elif c == '\n' : + self._line += 1 + tokenContent += c + x += 1 + tokenContent = tokenContent.strip() + if tokenContent == MicroWebTemplate.INSTRUCTION_END : + break + raise Exception( '"%s" is a bad instruction in a python bloc (line %s)' + % (tokenContent, self._line) ) + elif c == '\n' : + self._line += 1 + if execute : + pyCode += c + self._pos += 1 + if execute : + lines = pyCode.split('\n') + indent = '' + for line in lines : + if len(line.strip()) > 0 : + for c in line : + if c == ' ' or c == '\t' : + indent += c + else : + break + break + pyCode = '' + for line in lines : + if line.find(indent) == 0 : + line = line[len(indent):] + pyCode += line + '\n' + try : + exec(pyCode, self._pyGlobalVars, self._pyLocalVars) + except : + raise Exception('%s (line %s)' % (exc_info()[1], self._line)) + return None + + # ---------------------------------------------------------------------------- + + def _processInstructionIF(self, instructionBody, execute) : + if instructionBody is not None : + if execute : + try : + result = eval(instructionBody, self._pyGlobalVars, self._pyLocalVars) + if not isinstance(result, bool) : + raise Exception('"%s" is not a boolean expression (line %s)' % (instructionBody, self._line)) + except : + raise Exception('%s (line %s)' % (exc_info()[1], self._line)) + else : + result = False + newTokenToProcess = self._parseBloc(execute and result) + if newTokenToProcess is not None : + if newTokenToProcess == MicroWebTemplate.INSTRUCTION_END : + return None + elif newTokenToProcess == MicroWebTemplate.INSTRUCTION_ELSE : + newTokenToProcess = self._parseBloc(execute and not result) + if newTokenToProcess is not None : + if newTokenToProcess == MicroWebTemplate.INSTRUCTION_END : + return None + raise Exception( '"%s" instruction waited (line %s)' + % (MicroWebTemplate.INSTRUCTION_END, self._line) ) + raise Exception( '"%s" instruction is missing (line %s)' + % (MicroWebTemplate.INSTRUCTION_END, self._line) ) + elif newTokenToProcess == MicroWebTemplate.INSTRUCTION_ELIF : + self._processInstructionIF(self._elifInstructionBody, execute and not result) + return None + raise Exception( '"%s" instruction waited (line %s)' + % (MicroWebTemplate.INSTRUCTION_END, self._line) ) + raise Exception( '"%s" instruction is missing (line %s)' + % (MicroWebTemplate.INSTRUCTION_END, self._line) ) + raise Exception( '"%s" alone is an incomplete syntax (line %s)' + % (MicroWebTemplate.INSTRUCTION_IF, self._line) ) + + # ---------------------------------------------------------------------------- + + def _processInstructionELIF(self, instructionBody, execute) : + if instructionBody is None : + raise Exception( '"%s" alone is an incomplete syntax (line %s)' + % (MicroWebTemplate.INSTRUCTION_ELIF, self._line) ) + self._elifInstructionBody = instructionBody + return MicroWebTemplate.INSTRUCTION_ELIF + + # ---------------------------------------------------------------------------- + + def _processInstructionELSE(self, instructionBody, execute) : + if instructionBody is not None : + raise Exception( 'Instruction "%s" is invalid (line %s)' + % (MicroWebTemplate.INSTRUCTION_ELSE, self._line) ) + return MicroWebTemplate.INSTRUCTION_ELSE + + # ---------------------------------------------------------------------------- + + def _processInstructionFOR(self, instructionBody, execute) : + if instructionBody is not None : + parts = instructionBody.split(' ', 1) + identifier = parts[0].strip() + if self._reIdentifier.match(identifier) is not None and len(parts) > 1 : + parts = parts[1].strip().split(' ', 1) + if parts[0] == 'in' and len(parts) > 1 : + expression = parts[1].strip() + newTokenToProcess = None + beforePos = self._pos + if execute : + try : + result = eval(expression, self._pyGlobalVars, self._pyLocalVars) + except : + raise Exception('%s (line %s)' % (exc_info()[1], self._line)) + if execute and len(result) > 0 : + for x in result : + self._pyLocalVars[identifier] = x + self._pos = beforePos + newTokenToProcess = self._parseBloc(True) + if newTokenToProcess != MicroWebTemplate.INSTRUCTION_END : + break + else : + newTokenToProcess = self._parseBloc(False) + if newTokenToProcess is not None : + if newTokenToProcess == MicroWebTemplate.INSTRUCTION_END : + return None + raise Exception( '"%s" instruction waited (line %s)' + % (MicroWebTemplate.INSTRUCTION_END, self._line) ) + raise Exception( '"%s" instruction is missing (line %s)' + % (MicroWebTemplate.INSTRUCTION_END, self._line) ) + raise Exception( '"%s %s" is an invalid syntax' + % (MicroWebTemplate.INSTRUCTION_FOR, instructionBody) ) + raise Exception( '"%s" alone is an incomplete syntax (line %s)' + % (MicroWebTemplate.INSTRUCTION_FOR, self._line) ) + + # ---------------------------------------------------------------------------- + + def _processInstructionEND(self, instructionBody, execute) : + if instructionBody is not None : + raise Exception( 'Instruction "%s" is invalid (line %s)' + % (MicroWebTemplate.INSTRUCTION_END, self._line) ) + return MicroWebTemplate.INSTRUCTION_END + + # ============================================================================ + # ============================================================================ + # ============================================================================ diff --git a/MicroPython_BUILD/components/micropython/esp32/modules/uftpserver.py b/MicroPython_BUILD/components/micropython/esp32/modules/uftpserver.py index f2733d8..03bcd4c 100644 --- a/MicroPython_BUILD/components/micropython/esp32/modules/uftpserver.py +++ b/MicroPython_BUILD/components/micropython/esp32/modules/uftpserver.py @@ -118,7 +118,7 @@ def check_notify(nquit): def ftpserver(timeout = 300, inthread = False, prnip = True): global quiet_run quiet_run = inthread - notify_quit = 7591 + notify_quit = _thread.EXIT if prnip: print ("Starting ftp server. Version 1.2") @@ -139,10 +139,8 @@ def ftpserver(timeout = 300, inthread = False, prnip = True): datasocket.bind(socket.getaddrinfo("0.0.0.0", DATA_PORT)[0][4]) ftpsocket.listen(1) - if inthread: - ftpsocket.settimeout(1) - else: - ftpsocket.settimeout(None) + ftpsocket.settimeout(1) + datasocket.listen(1) datasocket.settimeout(None) @@ -157,15 +155,14 @@ def ftpserver(timeout = 300, inthread = False, prnip = True): fromname = None do_run = True while do_run: - if inthread: - cl, remote_addr = ftpsocket.accepted() - if cl == None: + cl, remote_addr = ftpsocket.accepted() + if cl == None: + if inthread: notif = check_notify(notify_quit) if notif == notify_quit: break - continue - else: - cl, remote_addr = ftpsocket.accept() + utime.sleep_ms(2) + continue cl.settimeout(timeout) cwd = '/' try: @@ -183,7 +180,7 @@ def ftpserver(timeout = 300, inthread = False, prnip = True): data = cl.readline().decode("utf-8").rstrip("\r\n") if len(data) <= 0: if not quiet_run: - print("Client disappeared") + print("Client disconnected") break command = data.split(" ")[0].upper() diff --git a/MicroPython_BUILD/components/micropython/esp32/modules_examples/webserver/webserver_example.py b/MicroPython_BUILD/components/micropython/esp32/modules_examples/webserver/webserver_example.py index 449290e..047d430 100644 --- a/MicroPython_BUILD/components/micropython/esp32/modules_examples/webserver/webserver_example.py +++ b/MicroPython_BUILD/components/micropython/esp32/modules_examples/webserver/webserver_example.py @@ -2,41 +2,45 @@ from microWebSrv import MicroWebSrv import _thread +# set to True to print WebSocket messages +WS_messages = False + +# ---------------------------------------------------------------------------- + def _httpHandlerTestGet(httpClient, httpResponse) : - content = """\ - - + content = """\ + + - + TEST GET

TEST GET

Client IP address = %s
-
- First name:
- Last name:
- -
+
+ First name:
+ Last name:
+ +
- """ % httpClient.GetIPAddr() - httpResponse.WriteResponseOk( headers = None, - contentType = "text/html", - contentCharset = "UTF-8", - content = content ) + """ % httpClient.GetIPAddr() + httpResponse.WriteResponseOk( headers = None, + contentType = "text/html", + contentCharset = "UTF-8", + content = content ) def _httpHandlerTestPost(httpClient, httpResponse) : - formData = httpClient.ReadRequestPostedFormData() - firstname = formData["firstname"] - lastname = formData["lastname"] - escape = httpClient.GetServer().HTMLEscape - content = """\ - - - - + formData = httpClient.ReadRequestPostedFormData() + firstname = formData["firstname"] + lastname = formData["lastname"] + content = """\ + + + + TEST POST @@ -45,17 +49,58 @@ def _httpHandlerTestPost(httpClient, httpResponse) : Lastname = %s
- """ % (escape(firstname), escape(lastname)) - httpResponse.WriteResponseOk( headers = None, - contentType = "text/html", - contentCharset = "UTF-8", - content = content ) + """ % ( MicroWebSrv.HTMLEscape(firstname), + MicroWebSrv.HTMLEscape(lastname) ) + httpResponse.WriteResponseOk( headers = None, + contentType = "text/html", + contentCharset = "UTF-8", + content = content ) + +# ---------------------------------------------------------------------------- + +def _acceptWebSocketCallback(webSocket, httpClient) : + if WS_messages: + print("WS ACCEPT") + _thread.list() + webSocket.RecvTextCallback = _recvTextCallback + webSocket.RecvBinaryCallback = _recvBinaryCallback + webSocket.ClosedCallback = _closedCallback + +def _recvTextCallback(webSocket, msg) : + if WS_messages: + print("WS RECV TEXT : %s" % msg) + webSocket.SendText("Reply for %s" % msg) + +def _recvBinaryCallback(webSocket, data) : + if WS_messages: + print("WS RECV DATA : %s" % data) + +def _closedCallback(webSocket) : + if WS_messages: + _thread.list() + print("WS CLOSED") + +# ---------------------------------------------------------------------------- routeHandlers = [ - ( "/test", "GET", _httpHandlerTestGet ), - ( "/test", "POST", _httpHandlerTestPost ) + ( "/test", "GET", _httpHandlerTestGet ), + ( "/test", "POST", _httpHandlerTestPost ) ] srv = MicroWebSrv(routeHandlers=routeHandlers) +# ------------------------------------------------------ +# WebSocket configuration +srv.MaxWebSocketRecvLen = 256 +# Run WebSocket in thread +srv.WebSocketThreaded = True +# If WS is running in thread, set the thread stack size +# For this example 4096 is enough, for more complex +# webSocket handling you may need to increase this size +srv.WebSocketStackSize = 4096 +srv.AcceptWebSocketCallback = _acceptWebSocketCallback +# ------------------------------------------------------ + srv.Start(threaded=True) + +# ---------------------------------------------------------------------------- diff --git a/MicroPython_BUILD/components/micropython/esp32/modules_examples/webserver/www/wstest.html b/MicroPython_BUILD/components/micropython/esp32/modules_examples/webserver/www/wstest.html new file mode 100644 index 0000000..3a9a1a1 --- /dev/null +++ b/MicroPython_BUILD/components/micropython/esp32/modules_examples/webserver/www/wstest.html @@ -0,0 +1,78 @@ + + + + + + + MicroWebSocket Test + + + + + +

MicroWebSocket Test :

+
+ + + \ No newline at end of file diff --git a/MicroPython_BUILD/components/micropython/esp32/mphalport.c b/MicroPython_BUILD/components/micropython/esp32/mphalport.c index 3284b4e..d9dd488 100644 --- a/MicroPython_BUILD/components/micropython/esp32/mphalport.c +++ b/MicroPython_BUILD/components/micropython/esp32/mphalport.c @@ -76,6 +76,9 @@ void mp_hal_set_wdt_tmo() struct timeval tv; gettimeofday(&tv, NULL); mp_hal_wdg_rst_tmo = (tv.tv_sec * 1000 + (tv.tv_usec / 1000)) + (CONFIG_TASK_WDT_TIMEOUT_S * 500); + #ifdef CONFIG_MICROPY_USE_TASK_WDT + esp_task_wdt_reset(); + #endif } @@ -279,6 +282,10 @@ int mp_hal_delay_ms(uint32_t ms) { if (ms == 0) return 0; + #ifdef CONFIG_MICROPY_USE_TASK_WDT + esp_task_wdt_reset(); + #endif + if (ms <= 10) { // For delays up to 10 ms we use blocking delay ets_delay_us(ms * 1000); @@ -292,10 +299,6 @@ int mp_hal_delay_ms(uint32_t ms) uint32_t tend = tstart; uint32_t nres = tstart; - #ifdef CONFIG_MICROPY_USE_TASK_WDT - esp_task_wdt_reset(); - #endif - MP_THREAD_GIL_EXIT(); int ncheck = 0; diff --git a/MicroPython_BUILD/components/micropython/esp32/mpversion.h b/MicroPython_BUILD/components/micropython/esp32/mpversion.h index e9f7d21..1fa8c39 100644 --- a/MicroPython_BUILD/components/micropython/esp32/mpversion.h +++ b/MicroPython_BUILD/components/micropython/esp32/mpversion.h @@ -1,8 +1,8 @@ // MicroPython version info -#define MICROPY_GIT_TAG "ESP32_LoBo_v3.1.12" +#define MICROPY_GIT_TAG "ESP32_LoBo_v3.1.13" #define MICROPY_GIT_HASH "gdaa8cfa8" -#define MICROPY_BUILD_DATE "2017-01-27" +#define MICROPY_BUILD_DATE "2017-01-28" #define MICROPY_VERSION_MAJOR (3) #define MICROPY_VERSION_MINOR (1) -#define MICROPY_VERSION_MICRO (12) -#define MICROPY_VERSION_STRING "3.1.12" +#define MICROPY_VERSION_MICRO (13) +#define MICROPY_VERSION_STRING "3.1.13" diff --git a/MicroPython_BUILD/components/quickmail/AUTHORS b/MicroPython_BUILD/components/quickmail/AUTHORS new file mode 100644 index 0000000..56a21ea --- /dev/null +++ b/MicroPython_BUILD/components/quickmail/AUTHORS @@ -0,0 +1 @@ +Brecht Sanders - brechtsanders@users.sourceforge.net diff --git a/MicroPython_BUILD/components/quickmail/COPYING b/MicroPython_BUILD/components/quickmail/COPYING new file mode 100644 index 0000000..94a9ed0 --- /dev/null +++ b/MicroPython_BUILD/components/quickmail/COPYING @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. 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 +them 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 prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. 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. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey 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; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If 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 convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU 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 that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + 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. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +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. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + 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 +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + 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 3 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, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program 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, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU 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. But first, please read +. diff --git a/MicroPython_BUILD/components/quickmail/ChangeLog b/MicroPython_BUILD/components/quickmail/ChangeLog new file mode 100644 index 0000000..9239cfc --- /dev/null +++ b/MicroPython_BUILD/components/quickmail/ChangeLog @@ -0,0 +1,249 @@ +0.1.25 + +2016-10-31 Brecht Sanders + + * added "Content-Disposition: attachment; filename=" (thanks to David Singleton) + +0.1.24 + +2016-05-29 Brecht Sanders + + * fixed missing #include in smtpsocket.h + * added quickmail_cleanup() the fix memory leak when using cURL (thanks to Fulvio Senore) + +2016-05-25 Brecht Sanders + + * fixed date issue if locale is not English (thanks to Fulvio Senore) + +2016-05-19 Brecht Sanders + + * fixed daylight saving time issue on Windows (thanks to Fulvio Senore) + +0.1.23 + +2016-05-16 Brecht Sanders + + * move variable declaration to beginning of cose block for older C compilers + +2016-03-23 Brecht Sanders + + * removed -l from light command line application (without libcurl) + +0.1.22 + +2016-03-23 Brecht Sanders + + * added quickmail_send_secure() for SMTPS support (libcurl only) + +0.1.21 + +2015-12-11 Brecht Sanders + + * fixed base64 padding bug (reported by Wojtek Kunda) + * fixed missing end quote in body separator (reported by Wojtek Kunda) + * added multi-body support to command line application + +0.1.20 + +2015-10-08 Brecht Sanders + + * fixed some allocation code (reported by Carlos Tangerino) + +2015-05-09 Brecht Sanders + + * fixed configure.ac for MinGW static+shared build + +0.1.19 + +2015-04-29 Brecht Sanders + + * fixed curl error "VRFY command is disabled" (Andreas Baumann) + +0.1.18 + +2014-04-07 Brecht Sanders + + * fixed additional line break after Date header + +0.1.17 + +2013-11-10 Brecht Sanders + + * fixed Date header to show local time with proper UTC offset + +2013-11-05 Brecht Sanders + + * fixed line breaks in source files (UNIX EOL) + * show only the version of libcurl instead of all its components + +0.1.16 + +2013-10-21 Brecht Sanders + + * added code to catch failing malloc/realloc when out of memory + +0.1.15 + +2013-05-28 Brecht Sanders + + * API change: added mimetype parameter to the following functions + quickmail_list_attachment_callback_fn + quickmail_add_attachment_file + quickmail_add_attachment_memory + quickmail_add_attachment_custom + +2013-05-10 Brecht Sanders + + * fix automake to add -DNOCURL when compiling quickmaillight + * fix autoconf to allow compiling with per-target flags + +0.1.14 + +2013-05-03 Brecht Sanders + + * added header line for body: Content-Disposition: inline + +2013-04-16 Brecht Sanders + + * use angle brackets with CURLOPT_MAIL_FROM/CURLOPT_MAIL_RCPT + +2013-04-15 Brecht Sanders + + * added command line options -u username -w password + +0.1.13 + +2013-04-04 Brecht Sanders + + * added man page for application (quickmail.1) + +2013-03-16 Brecht Sanders + + * introduced dual licensing (GPL/commercial) and added License.txt + +2013-02-17 Brecht Sanders + + * fixed usage info in command line help (missing -m short help) + * added version information of libcurl library (and dependancies) + * undo previous change to use LF instead of CRLF, see RFC 2822 + +0.1.12 + +2013-02-16 Brecht Sanders + + * fixed a memory leak in quickmail_get_data when handling body data + * use LF instead of CRLF in headers (fixes a specific test case) + * quickmail program now accepts body from stdin if not supplied + * quickmail program now checks if at least 1 destination is supplied + +2013-02-13 Brecht Sanders + + * fixed bugs in custom body/attachment handling + * changes to support Microsoft Visual C as proposed by Troels K. + +2013-02-12 Brecht Sanders + + * changes to support Microsoft Visual C as proposed by Troels K. + +2012-11-24 Brecht Sanders + + * added -m command line parameter for MIME type of body + +0.1.11 + +2012-11-23 Brecht Sanders + + * fixed hang on remote SMTP disconnect if libcurl is not used + * quickmail application now returns nonzero exit code on error + * quickmail_set_body result is no longer const and caller must free() + * fixed missing Content-Type if no attachments + * added multipart/alternative support for multiple bodies + * added quickmail_add_body_file: add body from file + * added quickmail_add_body_memory: add body from memory + * added quickmail_add_body_custom: add body from custom source + * added quickmail_remove_body: remove body + * added quickmail_list_bodies: list bodies + +0.1.10 + +2012-11-13 Brecht Sanders + + * don't print to debuglog if it is NULL in smtpsocket.c + * include arpa/inet.h in smtpsocket.h for non-Windows systems + +0.1.9 + +2012-11-11 Brecht Sanders + + * quickmail application now returns nonzero exit code on error + * CURL_STATICLIB is defined when building static libquickmail.a + +0.1.8 + +2012-11-10 Brecht Sanders + + * now includes quickmail program to send mail from command line + * added quickmail_remove_attachment: remove attachment + * added quickmail_list_attachments: list attachments + * added quickmail_set_from: get from address + * added quickmail_get_subject: get subject + * quickmail_set_subject now sets the subject instead of from address + +0.1.7 + +2012-11-03 Brecht Sanders + + * added quickmail_initialize: initialize library + * added quickmail_add_attachment_memory: send attachment from memory + * added quickmail_add_attachment_custom: send custom data attachment + * added quickmail_add_header: add custom mail header + * fixed multiple To/Cc recipients are now joined in one header line + +0.1.6 + +2012-10-28 Brecht Sanders + + * fixes for building libquickmaillight on systems other than Windows + +0.1.5 + +2012-10-27 Brecht Sanders + + * new library libquickmaillight added with SMTP transport without libcurl + * added angle brackets around RCPT TO and MAIL FROM parameters + +0.1.4 + +2012-09-20 Brecht Sanders + + * fixed timezone issue by adding " +0000" to date header + +0.1.3 + +2012-09-20 Brecht Sanders + + * fixed missing ending quote in boundary header (reported by Mazin SW) + * fixed crash whith no attachments (reported by Mazin SW) + * fixed issue generating to stdio instead of file (reported by Mazin SW) + +0.1.2 + +2012-09-18 Brecht Sanders + + * removed header "Content-Description: The fixed length records" + +0.1.1 + +2012-08-03 Brecht Sanders + + * tested on Debian Linux + * added function quickmail_get_version() to get version number + * added Doxygen style comments to quickmail.h + +0.1.0 + +2012-08-02 Brecht Sanders + + * first release on SourceForge under GPL license + * depends on libcurl + * tested on Windows with MinGW and MinGW-64 compilers diff --git a/MicroPython_BUILD/components/quickmail/README b/MicroPython_BUILD/components/quickmail/README new file mode 100644 index 0000000..268291d --- /dev/null +++ b/MicroPython_BUILD/components/quickmail/README @@ -0,0 +1,17 @@ +Project name: + libquickmail +URL: + http://sourceforge.net/projects/libquickmail/ +Project discription: + C library intended to give C/C++ developers a quick and easy way + to send e-mail from their applications. + For the actual SMTP communication this library depends on libcurl. + There is also a light version available without libcurl dependancy. + The library can also be used to just create a multipart MIME + message body. + Features: + - multiple To/Cc/Bcc recipients + - multiple attachments without size limitation + - multiple bodies in alternative formats (e.g: text + HTML) + - SMTP authentication + - TLS encryption (via libcurl) diff --git a/MicroPython_BUILD/components/zlib/ChangeLog b/MicroPython_BUILD/components/zlib/ChangeLog new file mode 100644 index 0000000..30199a6 --- /dev/null +++ b/MicroPython_BUILD/components/zlib/ChangeLog @@ -0,0 +1,1515 @@ + + ChangeLog file for zlib + +Changes in 1.2.11 (15 Jan 2017) +- Fix deflate stored bug when pulling last block from window +- Permit immediate deflateParams changes before any deflate input + +Changes in 1.2.10 (2 Jan 2017) +- Avoid warnings on snprintf() return value +- Fix bug in deflate_stored() for zero-length input +- Fix bug in gzwrite.c that produced corrupt gzip files +- Remove files to be installed before copying them in Makefile.in +- Add warnings when compiling with assembler code + +Changes in 1.2.9 (31 Dec 2016) +- Fix contrib/minizip to permit unzipping with desktop API [Zouzou] +- Improve contrib/blast to return unused bytes +- Assure that gzoffset() is correct when appending +- Improve compress() and uncompress() to support large lengths +- Fix bug in test/example.c where error code not saved +- Remedy Coverity warning [Randers-Pehrson] +- Improve speed of gzprintf() in transparent mode +- Fix inflateInit2() bug when windowBits is 16 or 32 +- Change DEBUG macro to ZLIB_DEBUG +- Avoid uninitialized access by gzclose_w() +- Allow building zlib outside of the source directory +- Fix bug that accepted invalid zlib header when windowBits is zero +- Fix gzseek() problem on MinGW due to buggy _lseeki64 there +- Loop on write() calls in gzwrite.c in case of non-blocking I/O +- Add --warn (-w) option to ./configure for more compiler warnings +- Reject a window size of 256 bytes if not using the zlib wrapper +- Fix bug when level 0 used with Z_HUFFMAN or Z_RLE +- Add --debug (-d) option to ./configure to define ZLIB_DEBUG +- Fix bugs in creating a very large gzip header +- Add uncompress2() function, which returns the input size used +- Assure that deflateParams() will not switch functions mid-block +- Dramatically speed up deflation for level 0 (storing) +- Add gzfread(), duplicating the interface of fread() +- Add gzfwrite(), duplicating the interface of fwrite() +- Add deflateGetDictionary() function +- Use snprintf() for later versions of Microsoft C +- Fix *Init macros to use z_ prefix when requested +- Replace as400 with os400 for OS/400 support [Monnerat] +- Add crc32_z() and adler32_z() functions with size_t lengths +- Update Visual Studio project files [AraHaan] + +Changes in 1.2.8 (28 Apr 2013) +- Update contrib/minizip/iowin32.c for Windows RT [Vollant] +- Do not force Z_CONST for C++ +- Clean up contrib/vstudio [Roß] +- Correct spelling error in zlib.h +- Fix mixed line endings in contrib/vstudio + +Changes in 1.2.7.3 (13 Apr 2013) +- Fix version numbers and DLL names in contrib/vstudio/*/zlib.rc + +Changes in 1.2.7.2 (13 Apr 2013) +- Change check for a four-byte type back to hexadecimal +- Fix typo in win32/Makefile.msc +- Add casts in gzwrite.c for pointer differences + +Changes in 1.2.7.1 (24 Mar 2013) +- Replace use of unsafe string functions with snprintf if available +- Avoid including stddef.h on Windows for Z_SOLO compile [Niessink] +- Fix gzgetc undefine when Z_PREFIX set [Turk] +- Eliminate use of mktemp in Makefile (not always available) +- Fix bug in 'F' mode for gzopen() +- Add inflateGetDictionary() function +- Correct comment in deflate.h +- Use _snprintf for snprintf in Microsoft C +- On Darwin, only use /usr/bin/libtool if libtool is not Apple +- Delete "--version" file if created by "ar --version" [Richard G.] +- Fix configure check for veracity of compiler error return codes +- Fix CMake compilation of static lib for MSVC2010 x64 +- Remove unused variable in infback9.c +- Fix argument checks in gzlog_compress() and gzlog_write() +- Clean up the usage of z_const and respect const usage within zlib +- Clean up examples/gzlog.[ch] comparisons of different types +- Avoid shift equal to bits in type (caused endless loop) +- Fix uninitialized value bug in gzputc() introduced by const patches +- Fix memory allocation error in examples/zran.c [Nor] +- Fix bug where gzopen(), gzclose() would write an empty file +- Fix bug in gzclose() when gzwrite() runs out of memory +- Check for input buffer malloc failure in examples/gzappend.c +- Add note to contrib/blast to use binary mode in stdio +- Fix comparisons of differently signed integers in contrib/blast +- Check for invalid code length codes in contrib/puff +- Fix serious but very rare decompression bug in inftrees.c +- Update inflateBack() comments, since inflate() can be faster +- Use underscored I/O function names for WINAPI_FAMILY +- Add _tr_flush_bits to the external symbols prefixed by --zprefix +- Add contrib/vstudio/vc10 pre-build step for static only +- Quote --version-script argument in CMakeLists.txt +- Don't specify --version-script on Apple platforms in CMakeLists.txt +- Fix casting error in contrib/testzlib/testzlib.c +- Fix types in contrib/minizip to match result of get_crc_table() +- Simplify contrib/vstudio/vc10 with 'd' suffix +- Add TOP support to win32/Makefile.msc +- Suport i686 and amd64 assembler builds in CMakeLists.txt +- Fix typos in the use of _LARGEFILE64_SOURCE in zconf.h +- Add vc11 and vc12 build files to contrib/vstudio +- Add gzvprintf() as an undocumented function in zlib +- Fix configure for Sun shell +- Remove runtime check in configure for four-byte integer type +- Add casts and consts to ease user conversion to C++ +- Add man pages for minizip and miniunzip +- In Makefile uninstall, don't rm if preceding cd fails +- Do not return Z_BUF_ERROR if deflateParam() has nothing to write + +Changes in 1.2.7 (2 May 2012) +- Replace use of memmove() with a simple copy for portability +- Test for existence of strerror +- Restore gzgetc_ for backward compatibility with 1.2.6 +- Fix build with non-GNU make on Solaris +- Require gcc 4.0 or later on Mac OS X to use the hidden attribute +- Include unistd.h for Watcom C +- Use __WATCOMC__ instead of __WATCOM__ +- Do not use the visibility attribute if NO_VIZ defined +- Improve the detection of no hidden visibility attribute +- Avoid using __int64 for gcc or solo compilation +- Cast to char * in gzprintf to avoid warnings [Zinser] +- Fix make_vms.com for VAX [Zinser] +- Don't use library or built-in byte swaps +- Simplify test and use of gcc hidden attribute +- Fix bug in gzclose_w() when gzwrite() fails to allocate memory +- Add "x" (O_EXCL) and "e" (O_CLOEXEC) modes support to gzopen() +- Fix bug in test/minigzip.c for configure --solo +- Fix contrib/vstudio project link errors [Mohanathas] +- Add ability to choose the builder in make_vms.com [Schweda] +- Add DESTDIR support to mingw32 win32/Makefile.gcc +- Fix comments in win32/Makefile.gcc for proper usage +- Allow overriding the default install locations for cmake +- Generate and install the pkg-config file with cmake +- Build both a static and a shared version of zlib with cmake +- Include version symbols for cmake builds +- If using cmake with MSVC, add the source directory to the includes +- Remove unneeded EXTRA_CFLAGS from win32/Makefile.gcc [Truta] +- Move obsolete emx makefile to old [Truta] +- Allow the use of -Wundef when compiling or using zlib +- Avoid the use of the -u option with mktemp +- Improve inflate() documentation on the use of Z_FINISH +- Recognize clang as gcc +- Add gzopen_w() in Windows for wide character path names +- Rename zconf.h in CMakeLists.txt to move it out of the way +- Add source directory in CMakeLists.txt for building examples +- Look in build directory for zlib.pc in CMakeLists.txt +- Remove gzflags from zlibvc.def in vc9 and vc10 +- Fix contrib/minizip compilation in the MinGW environment +- Update ./configure for Solaris, support --64 [Mooney] +- Remove -R. from Solaris shared build (possible security issue) +- Avoid race condition for parallel make (-j) running example +- Fix type mismatch between get_crc_table() and crc_table +- Fix parsing of version with "-" in CMakeLists.txt [Snider, Ziegler] +- Fix the path to zlib.map in CMakeLists.txt +- Force the native libtool in Mac OS X to avoid GNU libtool [Beebe] +- Add instructions to win32/Makefile.gcc for shared install [Torri] + +Changes in 1.2.6.1 (12 Feb 2012) +- Avoid the use of the Objective-C reserved name "id" +- Include io.h in gzguts.h for Microsoft compilers +- Fix problem with ./configure --prefix and gzgetc macro +- Include gz_header definition when compiling zlib solo +- Put gzflags() functionality back in zutil.c +- Avoid library header include in crc32.c for Z_SOLO +- Use name in GCC_CLASSIC as C compiler for coverage testing, if set +- Minor cleanup in contrib/minizip/zip.c [Vollant] +- Update make_vms.com [Zinser] +- Remove unnecessary gzgetc_ function +- Use optimized byte swap operations for Microsoft and GNU [Snyder] +- Fix minor typo in zlib.h comments [Rzesniowiecki] + +Changes in 1.2.6 (29 Jan 2012) +- Update the Pascal interface in contrib/pascal +- Fix function numbers for gzgetc_ in zlibvc.def files +- Fix configure.ac for contrib/minizip [Schiffer] +- Fix large-entry detection in minizip on 64-bit systems [Schiffer] +- Have ./configure use the compiler return code for error indication +- Fix CMakeLists.txt for cross compilation [McClure] +- Fix contrib/minizip/zip.c for 64-bit architectures [Dalsnes] +- Fix compilation of contrib/minizip on FreeBSD [Marquez] +- Correct suggested usages in win32/Makefile.msc [Shachar, Horvath] +- Include io.h for Turbo C / Borland C on all platforms [Truta] +- Make version explicit in contrib/minizip/configure.ac [Bosmans] +- Avoid warning for no encryption in contrib/minizip/zip.c [Vollant] +- Minor cleanup up contrib/minizip/unzip.c [Vollant] +- Fix bug when compiling minizip with C++ [Vollant] +- Protect for long name and extra fields in contrib/minizip [Vollant] +- Avoid some warnings in contrib/minizip [Vollant] +- Add -I../.. -L../.. to CFLAGS for minizip and miniunzip +- Add missing libs to minizip linker command +- Add support for VPATH builds in contrib/minizip +- Add an --enable-demos option to contrib/minizip/configure +- Add the generation of configure.log by ./configure +- Exit when required parameters not provided to win32/Makefile.gcc +- Have gzputc return the character written instead of the argument +- Use the -m option on ldconfig for BSD systems [Tobias] +- Correct in zlib.map when deflateResetKeep was added + +Changes in 1.2.5.3 (15 Jan 2012) +- Restore gzgetc function for binary compatibility +- Do not use _lseeki64 under Borland C++ [Truta] +- Update win32/Makefile.msc to build test/*.c [Truta] +- Remove old/visualc6 given CMakefile and other alternatives +- Update AS400 build files and documentation [Monnerat] +- Update win32/Makefile.gcc to build test/*.c [Truta] +- Permit stronger flushes after Z_BLOCK flushes +- Avoid extraneous empty blocks when doing empty flushes +- Permit Z_NULL arguments to deflatePending +- Allow deflatePrime() to insert bits in the middle of a stream +- Remove second empty static block for Z_PARTIAL_FLUSH +- Write out all of the available bits when using Z_BLOCK +- Insert the first two strings in the hash table after a flush + +Changes in 1.2.5.2 (17 Dec 2011) +- fix ld error: unable to find version dependency 'ZLIB_1.2.5' +- use relative symlinks for shared libs +- Avoid searching past window for Z_RLE strategy +- Assure that high-water mark initialization is always applied in deflate +- Add assertions to fill_window() in deflate.c to match comments +- Update python link in README +- Correct spelling error in gzread.c +- Fix bug in gzgets() for a concatenated empty gzip stream +- Correct error in comment for gz_make() +- Change gzread() and related to ignore junk after gzip streams +- Allow gzread() and related to continue after gzclearerr() +- Allow gzrewind() and gzseek() after a premature end-of-file +- Simplify gzseek() now that raw after gzip is ignored +- Change gzgetc() to a macro for speed (~40% speedup in testing) +- Fix gzclose() to return the actual error last encountered +- Always add large file support for windows +- Include zconf.h for windows large file support +- Include zconf.h.cmakein for windows large file support +- Update zconf.h.cmakein on make distclean +- Merge vestigial vsnprintf determination from zutil.h to gzguts.h +- Clarify how gzopen() appends in zlib.h comments +- Correct documentation of gzdirect() since junk at end now ignored +- Add a transparent write mode to gzopen() when 'T' is in the mode +- Update python link in zlib man page +- Get inffixed.h and MAKEFIXED result to match +- Add a ./config --solo option to make zlib subset with no library use +- Add undocumented inflateResetKeep() function for CAB file decoding +- Add --cover option to ./configure for gcc coverage testing +- Add #define ZLIB_CONST option to use const in the z_stream interface +- Add comment to gzdopen() in zlib.h to use dup() when using fileno() +- Note behavior of uncompress() to provide as much data as it can +- Add files in contrib/minizip to aid in building libminizip +- Split off AR options in Makefile.in and configure +- Change ON macro to Z_ARG to avoid application conflicts +- Facilitate compilation with Borland C++ for pragmas and vsnprintf +- Include io.h for Turbo C / Borland C++ +- Move example.c and minigzip.c to test/ +- Simplify incomplete code table filling in inflate_table() +- Remove code from inflate.c and infback.c that is impossible to execute +- Test the inflate code with full coverage +- Allow deflateSetDictionary, inflateSetDictionary at any time (in raw) +- Add deflateResetKeep and fix inflateResetKeep to retain dictionary +- Fix gzwrite.c to accommodate reduced memory zlib compilation +- Have inflate() with Z_FINISH avoid the allocation of a window +- Do not set strm->adler when doing raw inflate +- Fix gzeof() to behave just like feof() when read is not past end of file +- Fix bug in gzread.c when end-of-file is reached +- Avoid use of Z_BUF_ERROR in gz* functions except for premature EOF +- Document gzread() capability to read concurrently written files +- Remove hard-coding of resource compiler in CMakeLists.txt [Blammo] + +Changes in 1.2.5.1 (10 Sep 2011) +- Update FAQ entry on shared builds (#13) +- Avoid symbolic argument to chmod in Makefile.in +- Fix bug and add consts in contrib/puff [Oberhumer] +- Update contrib/puff/zeros.raw test file to have all block types +- Add full coverage test for puff in contrib/puff/Makefile +- Fix static-only-build install in Makefile.in +- Fix bug in unzGetCurrentFileInfo() in contrib/minizip [Kuno] +- Add libz.a dependency to shared in Makefile.in for parallel builds +- Spell out "number" (instead of "nb") in zlib.h for total_in, total_out +- Replace $(...) with `...` in configure for non-bash sh [Bowler] +- Add darwin* to Darwin* and solaris* to SunOS\ 5* in configure [Groffen] +- Add solaris* to Linux* in configure to allow gcc use [Groffen] +- Add *bsd* to Linux* case in configure [Bar-Lev] +- Add inffast.obj to dependencies in win32/Makefile.msc +- Correct spelling error in deflate.h [Kohler] +- Change libzdll.a again to libz.dll.a (!) in win32/Makefile.gcc +- Add test to configure for GNU C looking for gcc in output of $cc -v +- Add zlib.pc generation to win32/Makefile.gcc [Weigelt] +- Fix bug in zlib.h for _FILE_OFFSET_BITS set and _LARGEFILE64_SOURCE not +- Add comment in zlib.h that adler32_combine with len2 < 0 makes no sense +- Make NO_DIVIDE option in adler32.c much faster (thanks to John Reiser) +- Make stronger test in zconf.h to include unistd.h for LFS +- Apply Darwin patches for 64-bit file offsets to contrib/minizip [Slack] +- Fix zlib.h LFS support when Z_PREFIX used +- Add updated as400 support (removed from old) [Monnerat] +- Avoid deflate sensitivity to volatile input data +- Avoid division in adler32_combine for NO_DIVIDE +- Clarify the use of Z_FINISH with deflateBound() amount of space +- Set binary for output file in puff.c +- Use u4 type for crc_table to avoid conversion warnings +- Apply casts in zlib.h to avoid conversion warnings +- Add OF to prototypes for adler32_combine_ and crc32_combine_ [Miller] +- Improve inflateSync() documentation to note indeterminancy +- Add deflatePending() function to return the amount of pending output +- Correct the spelling of "specification" in FAQ [Randers-Pehrson] +- Add a check in configure for stdarg.h, use for gzprintf() +- Check that pointers fit in ints when gzprint() compiled old style +- Add dummy name before $(SHAREDLIBV) in Makefile [Bar-Lev, Bowler] +- Delete line in configure that adds -L. libz.a to LDFLAGS [Weigelt] +- Add debug records in assmebler code [Londer] +- Update RFC references to use http://tools.ietf.org/html/... [Li] +- Add --archs option, use of libtool to configure for Mac OS X [Borstel] + +Changes in 1.2.5 (19 Apr 2010) +- Disable visibility attribute in win32/Makefile.gcc [Bar-Lev] +- Default to libdir as sharedlibdir in configure [Nieder] +- Update copyright dates on modified source files +- Update trees.c to be able to generate modified trees.h +- Exit configure for MinGW, suggesting win32/Makefile.gcc +- Check for NULL path in gz_open [Homurlu] + +Changes in 1.2.4.5 (18 Apr 2010) +- Set sharedlibdir in configure [Torok] +- Set LDFLAGS in Makefile.in [Bar-Lev] +- Avoid mkdir objs race condition in Makefile.in [Bowler] +- Add ZLIB_INTERNAL in front of internal inter-module functions and arrays +- Define ZLIB_INTERNAL to hide internal functions and arrays for GNU C +- Don't use hidden attribute when it is a warning generator (e.g. Solaris) + +Changes in 1.2.4.4 (18 Apr 2010) +- Fix CROSS_PREFIX executable testing, CHOST extract, mingw* [Torok] +- Undefine _LARGEFILE64_SOURCE in zconf.h if it is zero, but not if empty +- Try to use bash or ksh regardless of functionality of /bin/sh +- Fix configure incompatibility with NetBSD sh +- Remove attempt to run under bash or ksh since have better NetBSD fix +- Fix win32/Makefile.gcc for MinGW [Bar-Lev] +- Add diagnostic messages when using CROSS_PREFIX in configure +- Added --sharedlibdir option to configure [Weigelt] +- Use hidden visibility attribute when available [Frysinger] + +Changes in 1.2.4.3 (10 Apr 2010) +- Only use CROSS_PREFIX in configure for ar and ranlib if they exist +- Use CROSS_PREFIX for nm [Bar-Lev] +- Assume _LARGEFILE64_SOURCE defined is equivalent to true +- Avoid use of undefined symbols in #if with && and || +- Make *64 prototypes in gzguts.h consistent with functions +- Add -shared load option for MinGW in configure [Bowler] +- Move z_off64_t to public interface, use instead of off64_t +- Remove ! from shell test in configure (not portable to Solaris) +- Change +0 macro tests to -0 for possibly increased portability + +Changes in 1.2.4.2 (9 Apr 2010) +- Add consistent carriage returns to readme.txt's in masmx86 and masmx64 +- Really provide prototypes for *64 functions when building without LFS +- Only define unlink() in minigzip.c if unistd.h not included +- Update README to point to contrib/vstudio project files +- Move projects/vc6 to old/ and remove projects/ +- Include stdlib.h in minigzip.c for setmode() definition under WinCE +- Clean up assembler builds in win32/Makefile.msc [Rowe] +- Include sys/types.h for Microsoft for off_t definition +- Fix memory leak on error in gz_open() +- Symbolize nm as $NM in configure [Weigelt] +- Use TEST_LDSHARED instead of LDSHARED to link test programs [Weigelt] +- Add +0 to _FILE_OFFSET_BITS and _LFS64_LARGEFILE in case not defined +- Fix bug in gzeof() to take into account unused input data +- Avoid initialization of structures with variables in puff.c +- Updated win32/README-WIN32.txt [Rowe] + +Changes in 1.2.4.1 (28 Mar 2010) +- Remove the use of [a-z] constructs for sed in configure [gentoo 310225] +- Remove $(SHAREDLIB) from LIBS in Makefile.in [Creech] +- Restore "for debugging" comment on sprintf() in gzlib.c +- Remove fdopen for MVS from gzguts.h +- Put new README-WIN32.txt in win32 [Rowe] +- Add check for shell to configure and invoke another shell if needed +- Fix big fat stinking bug in gzseek() on uncompressed files +- Remove vestigial F_OPEN64 define in zutil.h +- Set and check the value of _LARGEFILE_SOURCE and _LARGEFILE64_SOURCE +- Avoid errors on non-LFS systems when applications define LFS macros +- Set EXE to ".exe" in configure for MINGW [Kahle] +- Match crc32() in crc32.c exactly to the prototype in zlib.h [Sherrill] +- Add prefix for cross-compilation in win32/makefile.gcc [Bar-Lev] +- Add DLL install in win32/makefile.gcc [Bar-Lev] +- Allow Linux* or linux* from uname in configure [Bar-Lev] +- Allow ldconfig to be redefined in configure and Makefile.in [Bar-Lev] +- Add cross-compilation prefixes to configure [Bar-Lev] +- Match type exactly in gz_load() invocation in gzread.c +- Match type exactly of zcalloc() in zutil.c to zlib.h alloc_func +- Provide prototypes for *64 functions when building zlib without LFS +- Don't use -lc when linking shared library on MinGW +- Remove errno.h check in configure and vestigial errno code in zutil.h + +Changes in 1.2.4 (14 Mar 2010) +- Fix VER3 extraction in configure for no fourth subversion +- Update zlib.3, add docs to Makefile.in to make .pdf out of it +- Add zlib.3.pdf to distribution +- Don't set error code in gzerror() if passed pointer is NULL +- Apply destination directory fixes to CMakeLists.txt [Lowman] +- Move #cmakedefine's to a new zconf.in.cmakein +- Restore zconf.h for builds that don't use configure or cmake +- Add distclean to dummy Makefile for convenience +- Update and improve INDEX, README, and FAQ +- Update CMakeLists.txt for the return of zconf.h [Lowman] +- Update contrib/vstudio/vc9 and vc10 [Vollant] +- Change libz.dll.a back to libzdll.a in win32/Makefile.gcc +- Apply license and readme changes to contrib/asm686 [Raiter] +- Check file name lengths and add -c option in minigzip.c [Li] +- Update contrib/amd64 and contrib/masmx86/ [Vollant] +- Avoid use of "eof" parameter in trees.c to not shadow library variable +- Update make_vms.com for removal of zlibdefs.h [Zinser] +- Update assembler code and vstudio projects in contrib [Vollant] +- Remove outdated assembler code contrib/masm686 and contrib/asm586 +- Remove old vc7 and vc8 from contrib/vstudio +- Update win32/Makefile.msc, add ZLIB_VER_SUBREVISION [Rowe] +- Fix memory leaks in gzclose_r() and gzclose_w(), file leak in gz_open() +- Add contrib/gcc_gvmat64 for longest_match and inflate_fast [Vollant] +- Remove *64 functions from win32/zlib.def (they're not 64-bit yet) +- Fix bug in void-returning vsprintf() case in gzwrite.c +- Fix name change from inflate.h in contrib/inflate86/inffas86.c +- Check if temporary file exists before removing in make_vms.com [Zinser] +- Fix make install and uninstall for --static option +- Fix usage of _MSC_VER in gzguts.h and zutil.h [Truta] +- Update readme.txt in contrib/masmx64 and masmx86 to assemble + +Changes in 1.2.3.9 (21 Feb 2010) +- Expunge gzio.c +- Move as400 build information to old +- Fix updates in contrib/minizip and contrib/vstudio +- Add const to vsnprintf test in configure to avoid warnings [Weigelt] +- Delete zconf.h (made by configure) [Weigelt] +- Change zconf.in.h to zconf.h.in per convention [Weigelt] +- Check for NULL buf in gzgets() +- Return empty string for gzgets() with len == 1 (like fgets()) +- Fix description of gzgets() in zlib.h for end-of-file, NULL return +- Update minizip to 1.1 [Vollant] +- Avoid MSVC loss of data warnings in gzread.c, gzwrite.c +- Note in zlib.h that gzerror() should be used to distinguish from EOF +- Remove use of snprintf() from gzlib.c +- Fix bug in gzseek() +- Update contrib/vstudio, adding vc9 and vc10 [Kuno, Vollant] +- Fix zconf.h generation in CMakeLists.txt [Lowman] +- Improve comments in zconf.h where modified by configure + +Changes in 1.2.3.8 (13 Feb 2010) +- Clean up text files (tabs, trailing whitespace, etc.) [Oberhumer] +- Use z_off64_t in gz_zero() and gz_skip() to match state->skip +- Avoid comparison problem when sizeof(int) == sizeof(z_off64_t) +- Revert to Makefile.in from 1.2.3.6 (live with the clutter) +- Fix missing error return in gzflush(), add zlib.h note +- Add *64 functions to zlib.map [Levin] +- Fix signed/unsigned comparison in gz_comp() +- Use SFLAGS when testing shared linking in configure +- Add --64 option to ./configure to use -m64 with gcc +- Fix ./configure --help to correctly name options +- Have make fail if a test fails [Levin] +- Avoid buffer overrun in contrib/masmx64/gvmat64.asm [Simpson] +- Remove assembler object files from contrib + +Changes in 1.2.3.7 (24 Jan 2010) +- Always gzopen() with O_LARGEFILE if available +- Fix gzdirect() to work immediately after gzopen() or gzdopen() +- Make gzdirect() more precise when the state changes while reading +- Improve zlib.h documentation in many places +- Catch memory allocation failure in gz_open() +- Complete close operation if seek forward in gzclose_w() fails +- Return Z_ERRNO from gzclose_r() if close() fails +- Return Z_STREAM_ERROR instead of EOF for gzclose() being passed NULL +- Return zero for gzwrite() errors to match zlib.h description +- Return -1 on gzputs() error to match zlib.h description +- Add zconf.in.h to allow recovery from configure modification [Weigelt] +- Fix static library permissions in Makefile.in [Weigelt] +- Avoid warnings in configure tests that hide functionality [Weigelt] +- Add *BSD and DragonFly to Linux case in configure [gentoo 123571] +- Change libzdll.a to libz.dll.a in win32/Makefile.gcc [gentoo 288212] +- Avoid access of uninitialized data for first inflateReset2 call [Gomes] +- Keep object files in subdirectories to reduce the clutter somewhat +- Remove default Makefile and zlibdefs.h, add dummy Makefile +- Add new external functions to Z_PREFIX, remove duplicates, z_z_ -> z_ +- Remove zlibdefs.h completely -- modify zconf.h instead + +Changes in 1.2.3.6 (17 Jan 2010) +- Avoid void * arithmetic in gzread.c and gzwrite.c +- Make compilers happier with const char * for gz_error message +- Avoid unused parameter warning in inflate.c +- Avoid signed-unsigned comparison warning in inflate.c +- Indent #pragma's for traditional C +- Fix usage of strwinerror() in glib.c, change to gz_strwinerror() +- Correct email address in configure for system options +- Update make_vms.com and add make_vms.com to contrib/minizip [Zinser] +- Update zlib.map [Brown] +- Fix Makefile.in for Solaris 10 make of example64 and minizip64 [Torok] +- Apply various fixes to CMakeLists.txt [Lowman] +- Add checks on len in gzread() and gzwrite() +- Add error message for no more room for gzungetc() +- Remove zlib version check in gzwrite() +- Defer compression of gzprintf() result until need to +- Use snprintf() in gzdopen() if available +- Remove USE_MMAP configuration determination (only used by minigzip) +- Remove examples/pigz.c (available separately) +- Update examples/gun.c to 1.6 + +Changes in 1.2.3.5 (8 Jan 2010) +- Add space after #if in zutil.h for some compilers +- Fix relatively harmless bug in deflate_fast() [Exarevsky] +- Fix same problem in deflate_slow() +- Add $(SHAREDLIBV) to LIBS in Makefile.in [Brown] +- Add deflate_rle() for faster Z_RLE strategy run-length encoding +- Add deflate_huff() for faster Z_HUFFMAN_ONLY encoding +- Change name of "write" variable in inffast.c to avoid library collisions +- Fix premature EOF from gzread() in gzio.c [Brown] +- Use zlib header window size if windowBits is 0 in inflateInit2() +- Remove compressBound() call in deflate.c to avoid linking compress.o +- Replace use of errno in gz* with functions, support WinCE [Alves] +- Provide alternative to perror() in minigzip.c for WinCE [Alves] +- Don't use _vsnprintf on later versions of MSVC [Lowman] +- Add CMake build script and input file [Lowman] +- Update contrib/minizip to 1.1 [Svensson, Vollant] +- Moved nintendods directory from contrib to . +- Replace gzio.c with a new set of routines with the same functionality +- Add gzbuffer(), gzoffset(), gzclose_r(), gzclose_w() as part of above +- Update contrib/minizip to 1.1b +- Change gzeof() to return 0 on error instead of -1 to agree with zlib.h + +Changes in 1.2.3.4 (21 Dec 2009) +- Use old school .SUFFIXES in Makefile.in for FreeBSD compatibility +- Update comments in configure and Makefile.in for default --shared +- Fix test -z's in configure [Marquess] +- Build examplesh and minigzipsh when not testing +- Change NULL's to Z_NULL's in deflate.c and in comments in zlib.h +- Import LDFLAGS from the environment in configure +- Fix configure to populate SFLAGS with discovered CFLAGS options +- Adapt make_vms.com to the new Makefile.in [Zinser] +- Add zlib2ansi script for C++ compilation [Marquess] +- Add _FILE_OFFSET_BITS=64 test to make test (when applicable) +- Add AMD64 assembler code for longest match to contrib [Teterin] +- Include options from $SFLAGS when doing $LDSHARED +- Simplify 64-bit file support by introducing z_off64_t type +- Make shared object files in objs directory to work around old Sun cc +- Use only three-part version number for Darwin shared compiles +- Add rc option to ar in Makefile.in for when ./configure not run +- Add -WI,-rpath,. to LDFLAGS for OSF 1 V4* +- Set LD_LIBRARYN32_PATH for SGI IRIX shared compile +- Protect against _FILE_OFFSET_BITS being defined when compiling zlib +- Rename Makefile.in targets allstatic to static and allshared to shared +- Fix static and shared Makefile.in targets to be independent +- Correct error return bug in gz_open() by setting state [Brown] +- Put spaces before ;;'s in configure for better sh compatibility +- Add pigz.c (parallel implementation of gzip) to examples/ +- Correct constant in crc32.c to UL [Leventhal] +- Reject negative lengths in crc32_combine() +- Add inflateReset2() function to work like inflateEnd()/inflateInit2() +- Include sys/types.h for _LARGEFILE64_SOURCE [Brown] +- Correct typo in doc/algorithm.txt [Janik] +- Fix bug in adler32_combine() [Zhu] +- Catch missing-end-of-block-code error in all inflates and in puff + Assures that random input to inflate eventually results in an error +- Added enough.c (calculation of ENOUGH for inftrees.h) to examples/ +- Update ENOUGH and its usage to reflect discovered bounds +- Fix gzerror() error report on empty input file [Brown] +- Add ush casts in trees.c to avoid pedantic runtime errors +- Fix typo in zlib.h uncompress() description [Reiss] +- Correct inflate() comments with regard to automatic header detection +- Remove deprecation comment on Z_PARTIAL_FLUSH (it stays) +- Put new version of gzlog (2.0) in examples with interruption recovery +- Add puff compile option to permit invalid distance-too-far streams +- Add puff TEST command options, ability to read piped input +- Prototype the *64 functions in zlib.h when _FILE_OFFSET_BITS == 64, but + _LARGEFILE64_SOURCE not defined +- Fix Z_FULL_FLUSH to truly erase the past by resetting s->strstart +- Fix deflateSetDictionary() to use all 32K for output consistency +- Remove extraneous #define MIN_LOOKAHEAD in deflate.c (in deflate.h) +- Clear bytes after deflate lookahead to avoid use of uninitialized data +- Change a limit in inftrees.c to be more transparent to Coverity Prevent +- Update win32/zlib.def with exported symbols from zlib.h +- Correct spelling errors in zlib.h [Willem, Sobrado] +- Allow Z_BLOCK for deflate() to force a new block +- Allow negative bits in inflatePrime() to delete existing bit buffer +- Add Z_TREES flush option to inflate() to return at end of trees +- Add inflateMark() to return current state information for random access +- Add Makefile for NintendoDS to contrib [Costa] +- Add -w in configure compile tests to avoid spurious warnings [Beucler] +- Fix typos in zlib.h comments for deflateSetDictionary() +- Fix EOF detection in transparent gzread() [Maier] + +Changes in 1.2.3.3 (2 October 2006) +- Make --shared the default for configure, add a --static option +- Add compile option to permit invalid distance-too-far streams +- Add inflateUndermine() function which is required to enable above +- Remove use of "this" variable name for C++ compatibility [Marquess] +- Add testing of shared library in make test, if shared library built +- Use ftello() and fseeko() if available instead of ftell() and fseek() +- Provide two versions of all functions that use the z_off_t type for + binary compatibility -- a normal version and a 64-bit offset version, + per the Large File Support Extension when _LARGEFILE64_SOURCE is + defined; use the 64-bit versions by default when _FILE_OFFSET_BITS + is defined to be 64 +- Add a --uname= option to configure to perhaps help with cross-compiling + +Changes in 1.2.3.2 (3 September 2006) +- Turn off silly Borland warnings [Hay] +- Use off64_t and define _LARGEFILE64_SOURCE when present +- Fix missing dependency on inffixed.h in Makefile.in +- Rig configure --shared to build both shared and static [Teredesai, Truta] +- Remove zconf.in.h and instead create a new zlibdefs.h file +- Fix contrib/minizip/unzip.c non-encrypted after encrypted [Vollant] +- Add treebuild.xml (see http://treebuild.metux.de/) [Weigelt] + +Changes in 1.2.3.1 (16 August 2006) +- Add watcom directory with OpenWatcom make files [Daniel] +- Remove #undef of FAR in zconf.in.h for MVS [Fedtke] +- Update make_vms.com [Zinser] +- Use -fPIC for shared build in configure [Teredesai, Nicholson] +- Use only major version number for libz.so on IRIX and OSF1 [Reinholdtsen] +- Use fdopen() (not _fdopen()) for Interix in zutil.h [Bäck] +- Add some FAQ entries about the contrib directory +- Update the MVS question in the FAQ +- Avoid extraneous reads after EOF in gzio.c [Brown] +- Correct spelling of "successfully" in gzio.c [Randers-Pehrson] +- Add comments to zlib.h about gzerror() usage [Brown] +- Set extra flags in gzip header in gzopen() like deflate() does +- Make configure options more compatible with double-dash conventions + [Weigelt] +- Clean up compilation under Solaris SunStudio cc [Rowe, Reinholdtsen] +- Fix uninstall target in Makefile.in [Truta] +- Add pkgconfig support [Weigelt] +- Use $(DESTDIR) macro in Makefile.in [Reinholdtsen, Weigelt] +- Replace set_data_type() with a more accurate detect_data_type() in + trees.c, according to the txtvsbin.txt document [Truta] +- Swap the order of #include and #include "zlib.h" in + gzio.c, example.c and minigzip.c [Truta] +- Shut up annoying VS2005 warnings about standard C deprecation [Rowe, + Truta] (where?) +- Fix target "clean" from win32/Makefile.bor [Truta] +- Create .pdb and .manifest files in win32/makefile.msc [Ziegler, Rowe] +- Update zlib www home address in win32/DLL_FAQ.txt [Truta] +- Update contrib/masmx86/inffas32.asm for VS2005 [Vollant, Van Wassenhove] +- Enable browse info in the "Debug" and "ASM Debug" configurations in + the Visual C++ 6 project, and set (non-ASM) "Debug" as default [Truta] +- Add pkgconfig support [Weigelt] +- Add ZLIB_VER_MAJOR, ZLIB_VER_MINOR and ZLIB_VER_REVISION in zlib.h, + for use in win32/zlib1.rc [Polushin, Rowe, Truta] +- Add a document that explains the new text detection scheme to + doc/txtvsbin.txt [Truta] +- Add rfc1950.txt, rfc1951.txt and rfc1952.txt to doc/ [Truta] +- Move algorithm.txt into doc/ [Truta] +- Synchronize FAQ with website +- Fix compressBound(), was low for some pathological cases [Fearnley] +- Take into account wrapper variations in deflateBound() +- Set examples/zpipe.c input and output to binary mode for Windows +- Update examples/zlib_how.html with new zpipe.c (also web site) +- Fix some warnings in examples/gzlog.c and examples/zran.c (it seems + that gcc became pickier in 4.0) +- Add zlib.map for Linux: "All symbols from zlib-1.1.4 remain + un-versioned, the patch adds versioning only for symbols introduced in + zlib-1.2.0 or later. It also declares as local those symbols which are + not designed to be exported." [Levin] +- Update Z_PREFIX list in zconf.in.h, add --zprefix option to configure +- Do not initialize global static by default in trees.c, add a response + NO_INIT_GLOBAL_POINTERS to initialize them if needed [Marquess] +- Don't use strerror() in gzio.c under WinCE [Yakimov] +- Don't use errno.h in zutil.h under WinCE [Yakimov] +- Move arguments for AR to its usage to allow replacing ar [Marot] +- Add HAVE_VISIBILITY_PRAGMA in zconf.in.h for Mozilla [Randers-Pehrson] +- Improve inflateInit() and inflateInit2() documentation +- Fix structure size comment in inflate.h +- Change configure help option from --h* to --help [Santos] + +Changes in 1.2.3 (18 July 2005) +- Apply security vulnerability fixes to contrib/infback9 as well +- Clean up some text files (carriage returns, trailing space) +- Update testzlib, vstudio, masmx64, and masmx86 in contrib [Vollant] + +Changes in 1.2.2.4 (11 July 2005) +- Add inflatePrime() function for starting inflation at bit boundary +- Avoid some Visual C warnings in deflate.c +- Avoid more silly Visual C warnings in inflate.c and inftrees.c for 64-bit + compile +- Fix some spelling errors in comments [Betts] +- Correct inflateInit2() error return documentation in zlib.h +- Add zran.c example of compressed data random access to examples + directory, shows use of inflatePrime() +- Fix cast for assignments to strm->state in inflate.c and infback.c +- Fix zlibCompileFlags() in zutil.c to use 1L for long shifts [Oberhumer] +- Move declarations of gf2 functions to right place in crc32.c [Oberhumer] +- Add cast in trees.c t avoid a warning [Oberhumer] +- Avoid some warnings in fitblk.c, gun.c, gzjoin.c in examples [Oberhumer] +- Update make_vms.com [Zinser] +- Initialize state->write in inflateReset() since copied in inflate_fast() +- Be more strict on incomplete code sets in inflate_table() and increase + ENOUGH and MAXD -- this repairs a possible security vulnerability for + invalid inflate input. Thanks to Tavis Ormandy and Markus Oberhumer for + discovering the vulnerability and providing test cases. +- Add ia64 support to configure for HP-UX [Smith] +- Add error return to gzread() for format or i/o error [Levin] +- Use malloc.h for OS/2 [Necasek] + +Changes in 1.2.2.3 (27 May 2005) +- Replace 1U constants in inflate.c and inftrees.c for 64-bit compile +- Typecast fread() return values in gzio.c [Vollant] +- Remove trailing space in minigzip.c outmode (VC++ can't deal with it) +- Fix crc check bug in gzread() after gzungetc() [Heiner] +- Add the deflateTune() function to adjust internal compression parameters +- Add a fast gzip decompressor, gun.c, to examples (use of inflateBack) +- Remove an incorrect assertion in examples/zpipe.c +- Add C++ wrapper in infback9.h [Donais] +- Fix bug in inflateCopy() when decoding fixed codes +- Note in zlib.h how much deflateSetDictionary() actually uses +- Remove USE_DICT_HEAD in deflate.c (would mess up inflate if used) +- Add _WIN32_WCE to define WIN32 in zconf.in.h [Spencer] +- Don't include stderr.h or errno.h for _WIN32_WCE in zutil.h [Spencer] +- Add gzdirect() function to indicate transparent reads +- Update contrib/minizip [Vollant] +- Fix compilation of deflate.c when both ASMV and FASTEST [Oberhumer] +- Add casts in crc32.c to avoid warnings [Oberhumer] +- Add contrib/masmx64 [Vollant] +- Update contrib/asm586, asm686, masmx86, testzlib, vstudio [Vollant] + +Changes in 1.2.2.2 (30 December 2004) +- Replace structure assignments in deflate.c and inflate.c with zmemcpy to + avoid implicit memcpy calls (portability for no-library compilation) +- Increase sprintf() buffer size in gzdopen() to allow for large numbers +- Add INFLATE_STRICT to check distances against zlib header +- Improve WinCE errno handling and comments [Chang] +- Remove comment about no gzip header processing in FAQ +- Add Z_FIXED strategy option to deflateInit2() to force fixed trees +- Add updated make_vms.com [Coghlan], update README +- Create a new "examples" directory, move gzappend.c there, add zpipe.c, + fitblk.c, gzlog.[ch], gzjoin.c, and zlib_how.html. +- Add FAQ entry and comments in deflate.c on uninitialized memory access +- Add Solaris 9 make options in configure [Gilbert] +- Allow strerror() usage in gzio.c for STDC +- Fix DecompressBuf in contrib/delphi/ZLib.pas [ManChesTer] +- Update contrib/masmx86/inffas32.asm and gvmat32.asm [Vollant] +- Use z_off_t for adler32_combine() and crc32_combine() lengths +- Make adler32() much faster for small len +- Use OS_CODE in deflate() default gzip header + +Changes in 1.2.2.1 (31 October 2004) +- Allow inflateSetDictionary() call for raw inflate +- Fix inflate header crc check bug for file names and comments +- Add deflateSetHeader() and gz_header structure for custom gzip headers +- Add inflateGetheader() to retrieve gzip headers +- Add crc32_combine() and adler32_combine() functions +- Add alloc_func, free_func, in_func, out_func to Z_PREFIX list +- Use zstreamp consistently in zlib.h (inflate_back functions) +- Remove GUNZIP condition from definition of inflate_mode in inflate.h + and in contrib/inflate86/inffast.S [Truta, Anderson] +- Add support for AMD64 in contrib/inflate86/inffas86.c [Anderson] +- Update projects/README.projects and projects/visualc6 [Truta] +- Update win32/DLL_FAQ.txt [Truta] +- Avoid warning under NO_GZCOMPRESS in gzio.c; fix typo [Truta] +- Deprecate Z_ASCII; use Z_TEXT instead [Truta] +- Use a new algorithm for setting strm->data_type in trees.c [Truta] +- Do not define an exit() prototype in zutil.c unless DEBUG defined +- Remove prototype of exit() from zutil.c, example.c, minigzip.c [Truta] +- Add comment in zlib.h for Z_NO_FLUSH parameter to deflate() +- Fix Darwin build version identification [Peterson] + +Changes in 1.2.2 (3 October 2004) +- Update zlib.h comments on gzip in-memory processing +- Set adler to 1 in inflateReset() to support Java test suite [Walles] +- Add contrib/dotzlib [Ravn] +- Update win32/DLL_FAQ.txt [Truta] +- Update contrib/minizip [Vollant] +- Move contrib/visual-basic.txt to old/ [Truta] +- Fix assembler builds in projects/visualc6/ [Truta] + +Changes in 1.2.1.2 (9 September 2004) +- Update INDEX file +- Fix trees.c to update strm->data_type (no one ever noticed!) +- Fix bug in error case in inflate.c, infback.c, and infback9.c [Brown] +- Add "volatile" to crc table flag declaration (for DYNAMIC_CRC_TABLE) +- Add limited multitasking protection to DYNAMIC_CRC_TABLE +- Add NO_vsnprintf for VMS in zutil.h [Mozilla] +- Don't declare strerror() under VMS [Mozilla] +- Add comment to DYNAMIC_CRC_TABLE to use get_crc_table() to initialize +- Update contrib/ada [Anisimkov] +- Update contrib/minizip [Vollant] +- Fix configure to not hardcode directories for Darwin [Peterson] +- Fix gzio.c to not return error on empty files [Brown] +- Fix indentation; update version in contrib/delphi/ZLib.pas and + contrib/pascal/zlibpas.pas [Truta] +- Update mkasm.bat in contrib/masmx86 [Truta] +- Update contrib/untgz [Truta] +- Add projects/README.projects [Truta] +- Add project for MS Visual C++ 6.0 in projects/visualc6 [Cadieux, Truta] +- Update win32/DLL_FAQ.txt [Truta] +- Update list of Z_PREFIX symbols in zconf.h [Randers-Pehrson, Truta] +- Remove an unnecessary assignment to curr in inftrees.c [Truta] +- Add OS/2 to exe builds in configure [Poltorak] +- Remove err dummy parameter in zlib.h [Kientzle] + +Changes in 1.2.1.1 (9 January 2004) +- Update email address in README +- Several FAQ updates +- Fix a big fat bug in inftrees.c that prevented decoding valid + dynamic blocks with only literals and no distance codes -- + Thanks to "Hot Emu" for the bug report and sample file +- Add a note to puff.c on no distance codes case. + +Changes in 1.2.1 (17 November 2003) +- Remove a tab in contrib/gzappend/gzappend.c +- Update some interfaces in contrib for new zlib functions +- Update zlib version number in some contrib entries +- Add Windows CE definition for ptrdiff_t in zutil.h [Mai, Truta] +- Support shared libraries on Hurd and KFreeBSD [Brown] +- Fix error in NO_DIVIDE option of adler32.c + +Changes in 1.2.0.8 (4 November 2003) +- Update version in contrib/delphi/ZLib.pas and contrib/pascal/zlibpas.pas +- Add experimental NO_DIVIDE #define in adler32.c + - Possibly faster on some processors (let me know if it is) +- Correct Z_BLOCK to not return on first inflate call if no wrap +- Fix strm->data_type on inflate() return to correctly indicate EOB +- Add deflatePrime() function for appending in the middle of a byte +- Add contrib/gzappend for an example of appending to a stream +- Update win32/DLL_FAQ.txt [Truta] +- Delete Turbo C comment in README [Truta] +- Improve some indentation in zconf.h [Truta] +- Fix infinite loop on bad input in configure script [Church] +- Fix gzeof() for concatenated gzip files [Johnson] +- Add example to contrib/visual-basic.txt [Michael B.] +- Add -p to mkdir's in Makefile.in [vda] +- Fix configure to properly detect presence or lack of printf functions +- Add AS400 support [Monnerat] +- Add a little Cygwin support [Wilson] + +Changes in 1.2.0.7 (21 September 2003) +- Correct some debug formats in contrib/infback9 +- Cast a type in a debug statement in trees.c +- Change search and replace delimiter in configure from % to # [Beebe] +- Update contrib/untgz to 0.2 with various fixes [Truta] +- Add build support for Amiga [Nikl] +- Remove some directories in old that have been updated to 1.2 +- Add dylib building for Mac OS X in configure and Makefile.in +- Remove old distribution stuff from Makefile +- Update README to point to DLL_FAQ.txt, and add comment on Mac OS X +- Update links in README + +Changes in 1.2.0.6 (13 September 2003) +- Minor FAQ updates +- Update contrib/minizip to 1.00 [Vollant] +- Remove test of gz functions in example.c when GZ_COMPRESS defined [Truta] +- Update POSTINC comment for 68060 [Nikl] +- Add contrib/infback9 with deflate64 decoding (unsupported) +- For MVS define NO_vsnprintf and undefine FAR [van Burik] +- Add pragma for fdopen on MVS [van Burik] + +Changes in 1.2.0.5 (8 September 2003) +- Add OF to inflateBackEnd() declaration in zlib.h +- Remember start when using gzdopen in the middle of a file +- Use internal off_t counters in gz* functions to properly handle seeks +- Perform more rigorous check for distance-too-far in inffast.c +- Add Z_BLOCK flush option to return from inflate at block boundary +- Set strm->data_type on return from inflate + - Indicate bits unused, if at block boundary, and if in last block +- Replace size_t with ptrdiff_t in crc32.c, and check for correct size +- Add condition so old NO_DEFLATE define still works for compatibility +- FAQ update regarding the Windows DLL [Truta] +- INDEX update: add qnx entry, remove aix entry [Truta] +- Install zlib.3 into mandir [Wilson] +- Move contrib/zlib_dll_FAQ.txt to win32/DLL_FAQ.txt; update [Truta] +- Adapt the zlib interface to the new DLL convention guidelines [Truta] +- Introduce ZLIB_WINAPI macro to allow the export of functions using + the WINAPI calling convention, for Visual Basic [Vollant, Truta] +- Update msdos and win32 scripts and makefiles [Truta] +- Export symbols by name, not by ordinal, in win32/zlib.def [Truta] +- Add contrib/ada [Anisimkov] +- Move asm files from contrib/vstudio/vc70_32 to contrib/asm386 [Truta] +- Rename contrib/asm386 to contrib/masmx86 [Truta, Vollant] +- Add contrib/masm686 [Truta] +- Fix offsets in contrib/inflate86 and contrib/masmx86/inffas32.asm + [Truta, Vollant] +- Update contrib/delphi; rename to contrib/pascal; add example [Truta] +- Remove contrib/delphi2; add a new contrib/delphi [Truta] +- Avoid inclusion of the nonstandard in contrib/iostream, + and fix some method prototypes [Truta] +- Fix the ZCR_SEED2 constant to avoid warnings in contrib/minizip + [Truta] +- Avoid the use of backslash (\) in contrib/minizip [Vollant] +- Fix file time handling in contrib/untgz; update makefiles [Truta] +- Update contrib/vstudio/vc70_32 to comply with the new DLL guidelines + [Vollant] +- Remove contrib/vstudio/vc15_16 [Vollant] +- Rename contrib/vstudio/vc70_32 to contrib/vstudio/vc7 [Truta] +- Update README.contrib [Truta] +- Invert the assignment order of match_head and s->prev[...] in + INSERT_STRING [Truta] +- Compare TOO_FAR with 32767 instead of 32768, to avoid 16-bit warnings + [Truta] +- Compare function pointers with 0, not with NULL or Z_NULL [Truta] +- Fix prototype of syncsearch in inflate.c [Truta] +- Introduce ASMINF macro to be enabled when using an ASM implementation + of inflate_fast [Truta] +- Change NO_DEFLATE to NO_GZCOMPRESS [Truta] +- Modify test_gzio in example.c to take a single file name as a + parameter [Truta] +- Exit the example.c program if gzopen fails [Truta] +- Add type casts around strlen in example.c [Truta] +- Remove casting to sizeof in minigzip.c; give a proper type + to the variable compared with SUFFIX_LEN [Truta] +- Update definitions of STDC and STDC99 in zconf.h [Truta] +- Synchronize zconf.h with the new Windows DLL interface [Truta] +- Use SYS16BIT instead of __32BIT__ to distinguish between + 16- and 32-bit platforms [Truta] +- Use far memory allocators in small 16-bit memory models for + Turbo C [Truta] +- Add info about the use of ASMV, ASMINF and ZLIB_WINAPI in + zlibCompileFlags [Truta] +- Cygwin has vsnprintf [Wilson] +- In Windows16, OS_CODE is 0, as in MSDOS [Truta] +- In Cygwin, OS_CODE is 3 (Unix), not 11 (Windows32) [Wilson] + +Changes in 1.2.0.4 (10 August 2003) +- Minor FAQ updates +- Be more strict when checking inflateInit2's windowBits parameter +- Change NO_GUNZIP compile option to NO_GZIP to cover deflate as well +- Add gzip wrapper option to deflateInit2 using windowBits +- Add updated QNX rule in configure and qnx directory [Bonnefoy] +- Make inflate distance-too-far checks more rigorous +- Clean up FAR usage in inflate +- Add casting to sizeof() in gzio.c and minigzip.c + +Changes in 1.2.0.3 (19 July 2003) +- Fix silly error in gzungetc() implementation [Vollant] +- Update contrib/minizip and contrib/vstudio [Vollant] +- Fix printf format in example.c +- Correct cdecl support in zconf.in.h [Anisimkov] +- Minor FAQ updates + +Changes in 1.2.0.2 (13 July 2003) +- Add ZLIB_VERNUM in zlib.h for numerical preprocessor comparisons +- Attempt to avoid warnings in crc32.c for pointer-int conversion +- Add AIX to configure, remove aix directory [Bakker] +- Add some casts to minigzip.c +- Improve checking after insecure sprintf() or vsprintf() calls +- Remove #elif's from crc32.c +- Change leave label to inf_leave in inflate.c and infback.c to avoid + library conflicts +- Remove inflate gzip decoding by default--only enable gzip decoding by + special request for stricter backward compatibility +- Add zlibCompileFlags() function to return compilation information +- More typecasting in deflate.c to avoid warnings +- Remove leading underscore from _Capital #defines [Truta] +- Fix configure to link shared library when testing +- Add some Windows CE target adjustments [Mai] +- Remove #define ZLIB_DLL in zconf.h [Vollant] +- Add zlib.3 [Rodgers] +- Update RFC URL in deflate.c and algorithm.txt [Mai] +- Add zlib_dll_FAQ.txt to contrib [Truta] +- Add UL to some constants [Truta] +- Update minizip and vstudio [Vollant] +- Remove vestigial NEED_DUMMY_RETURN from zconf.in.h +- Expand use of NO_DUMMY_DECL to avoid all dummy structures +- Added iostream3 to contrib [Schwardt] +- Replace rewind() with fseek() for WinCE [Truta] +- Improve setting of zlib format compression level flags + - Report 0 for huffman and rle strategies and for level == 0 or 1 + - Report 2 only for level == 6 +- Only deal with 64K limit when necessary at compile time [Truta] +- Allow TOO_FAR check to be turned off at compile time [Truta] +- Add gzclearerr() function [Souza] +- Add gzungetc() function + +Changes in 1.2.0.1 (17 March 2003) +- Add Z_RLE strategy for run-length encoding [Truta] + - When Z_RLE requested, restrict matches to distance one + - Update zlib.h, minigzip.c, gzopen(), gzdopen() for Z_RLE +- Correct FASTEST compilation to allow level == 0 +- Clean up what gets compiled for FASTEST +- Incorporate changes to zconf.in.h [Vollant] + - Refine detection of Turbo C need for dummy returns + - Refine ZLIB_DLL compilation + - Include additional header file on VMS for off_t typedef +- Try to use _vsnprintf where it supplants vsprintf [Vollant] +- Add some casts in inffast.c +- Enchance comments in zlib.h on what happens if gzprintf() tries to + write more than 4095 bytes before compression +- Remove unused state from inflateBackEnd() +- Remove exit(0) from minigzip.c, example.c +- Get rid of all those darn tabs +- Add "check" target to Makefile.in that does the same thing as "test" +- Add "mostlyclean" and "maintainer-clean" targets to Makefile.in +- Update contrib/inflate86 [Anderson] +- Update contrib/testzlib, contrib/vstudio, contrib/minizip [Vollant] +- Add msdos and win32 directories with makefiles [Truta] +- More additions and improvements to the FAQ + +Changes in 1.2.0 (9 March 2003) +- New and improved inflate code + - About 20% faster + - Does not allocate 32K window unless and until needed + - Automatically detects and decompresses gzip streams + - Raw inflate no longer needs an extra dummy byte at end + - Added inflateBack functions using a callback interface--even faster + than inflate, useful for file utilities (gzip, zip) + - Added inflateCopy() function to record state for random access on + externally generated deflate streams (e.g. in gzip files) + - More readable code (I hope) +- New and improved crc32() + - About 50% faster, thanks to suggestions from Rodney Brown +- Add deflateBound() and compressBound() functions +- Fix memory leak in deflateInit2() +- Permit setting dictionary for raw deflate (for parallel deflate) +- Fix const declaration for gzwrite() +- Check for some malloc() failures in gzio.c +- Fix bug in gzopen() on single-byte file 0x1f +- Fix bug in gzread() on concatenated file with 0x1f at end of buffer + and next buffer doesn't start with 0x8b +- Fix uncompress() to return Z_DATA_ERROR on truncated input +- Free memory at end of example.c +- Remove MAX #define in trees.c (conflicted with some libraries) +- Fix static const's in deflate.c, gzio.c, and zutil.[ch] +- Declare malloc() and free() in gzio.c if STDC not defined +- Use malloc() instead of calloc() in zutil.c if int big enough +- Define STDC for AIX +- Add aix/ with approach for compiling shared library on AIX +- Add HP-UX support for shared libraries in configure +- Add OpenUNIX support for shared libraries in configure +- Use $cc instead of gcc to build shared library +- Make prefix directory if needed when installing +- Correct Macintosh avoidance of typedef Byte in zconf.h +- Correct Turbo C memory allocation when under Linux +- Use libz.a instead of -lz in Makefile (assure use of compiled library) +- Update configure to check for snprintf or vsnprintf functions and their + return value, warn during make if using an insecure function +- Fix configure problem with compile-time knowledge of HAVE_UNISTD_H that + is lost when library is used--resolution is to build new zconf.h +- Documentation improvements (in zlib.h): + - Document raw deflate and inflate + - Update RFCs URL + - Point out that zlib and gzip formats are different + - Note that Z_BUF_ERROR is not fatal + - Document string limit for gzprintf() and possible buffer overflow + - Note requirement on avail_out when flushing + - Note permitted values of flush parameter of inflate() +- Add some FAQs (and even answers) to the FAQ +- Add contrib/inflate86/ for x86 faster inflate +- Add contrib/blast/ for PKWare Data Compression Library decompression +- Add contrib/puff/ simple inflate for deflate format description + +Changes in 1.1.4 (11 March 2002) +- ZFREE was repeated on same allocation on some error conditions. + This creates a security problem described in + http://www.zlib.org/advisory-2002-03-11.txt +- Returned incorrect error (Z_MEM_ERROR) on some invalid data +- Avoid accesses before window for invalid distances with inflate window + less than 32K. +- force windowBits > 8 to avoid a bug in the encoder for a window size + of 256 bytes. (A complete fix will be available in 1.1.5). + +Changes in 1.1.3 (9 July 1998) +- fix "an inflate input buffer bug that shows up on rare but persistent + occasions" (Mark) +- fix gzread and gztell for concatenated .gz files (Didier Le Botlan) +- fix gzseek(..., SEEK_SET) in write mode +- fix crc check after a gzeek (Frank Faubert) +- fix miniunzip when the last entry in a zip file is itself a zip file + (J Lillge) +- add contrib/asm586 and contrib/asm686 (Brian Raiter) + See http://www.muppetlabs.com/~breadbox/software/assembly.html +- add support for Delphi 3 in contrib/delphi (Bob Dellaca) +- add support for C++Builder 3 and Delphi 3 in contrib/delphi2 (Davide Moretti) +- do not exit prematurely in untgz if 0 at start of block (Magnus Holmgren) +- use macro EXTERN instead of extern to support DLL for BeOS (Sander Stoks) +- added a FAQ file + +- Support gzdopen on Mac with Metrowerks (Jason Linhart) +- Do not redefine Byte on Mac (Brad Pettit & Jason Linhart) +- define SEEK_END too if SEEK_SET is not defined (Albert Chin-A-Young) +- avoid some warnings with Borland C (Tom Tanner) +- fix a problem in contrib/minizip/zip.c for 16-bit MSDOS (Gilles Vollant) +- emulate utime() for WIN32 in contrib/untgz (Gilles Vollant) +- allow several arguments to configure (Tim Mooney, Frodo Looijaard) +- use libdir and includedir in Makefile.in (Tim Mooney) +- support shared libraries on OSF1 V4 (Tim Mooney) +- remove so_locations in "make clean" (Tim Mooney) +- fix maketree.c compilation error (Glenn, Mark) +- Python interface to zlib now in Python 1.5 (Jeremy Hylton) +- new Makefile.riscos (Rich Walker) +- initialize static descriptors in trees.c for embedded targets (Nick Smith) +- use "foo-gz" in example.c for RISCOS and VMS (Nick Smith) +- add the OS/2 files in Makefile.in too (Andrew Zabolotny) +- fix fdopen and halloc macros for Microsoft C 6.0 (Tom Lane) +- fix maketree.c to allow clean compilation of inffixed.h (Mark) +- fix parameter check in deflateCopy (Gunther Nikl) +- cleanup trees.c, use compressed_len only in debug mode (Christian Spieler) +- Many portability patches by Christian Spieler: + . zutil.c, zutil.h: added "const" for zmem* + . Make_vms.com: fixed some typos + . Make_vms.com: msdos/Makefile.*: removed zutil.h from some dependency lists + . msdos/Makefile.msc: remove "default rtl link library" info from obj files + . msdos/Makefile.*: use model-dependent name for the built zlib library + . msdos/Makefile.emx, nt/Makefile.emx, nt/Makefile.gcc: + new makefiles, for emx (DOS/OS2), emx&rsxnt and mingw32 (Windows 9x / NT) +- use define instead of typedef for Bytef also for MSC small/medium (Tom Lane) +- replace __far with _far for better portability (Christian Spieler, Tom Lane) +- fix test for errno.h in configure (Tim Newsham) + +Changes in 1.1.2 (19 March 98) +- added contrib/minzip, mini zip and unzip based on zlib (Gilles Vollant) + See http://www.winimage.com/zLibDll/unzip.html +- preinitialize the inflate tables for fixed codes, to make the code + completely thread safe (Mark) +- some simplifications and slight speed-up to the inflate code (Mark) +- fix gzeof on non-compressed files (Allan Schrum) +- add -std1 option in configure for OSF1 to fix gzprintf (Martin Mokrejs) +- use default value of 4K for Z_BUFSIZE for 16-bit MSDOS (Tim Wegner + Glenn) +- added os2/Makefile.def and os2/zlib.def (Andrew Zabolotny) +- add shared lib support for UNIX_SV4.2MP (MATSUURA Takanori) +- do not wrap extern "C" around system includes (Tom Lane) +- mention zlib binding for TCL in README (Andreas Kupries) +- added amiga/Makefile.pup for Amiga powerUP SAS/C PPC (Andreas Kleinert) +- allow "make install prefix=..." even after configure (Glenn Randers-Pehrson) +- allow "configure --prefix $HOME" (Tim Mooney) +- remove warnings in example.c and gzio.c (Glenn Randers-Pehrson) +- move Makefile.sas to amiga/Makefile.sas + +Changes in 1.1.1 (27 Feb 98) +- fix macros _tr_tally_* in deflate.h for debug mode (Glenn Randers-Pehrson) +- remove block truncation heuristic which had very marginal effect for zlib + (smaller lit_bufsize than in gzip 1.2.4) and degraded a little the + compression ratio on some files. This also allows inlining _tr_tally for + matches in deflate_slow. +- added msdos/Makefile.w32 for WIN32 Microsoft Visual C++ (Bob Frazier) + +Changes in 1.1.0 (24 Feb 98) +- do not return STREAM_END prematurely in inflate (John Bowler) +- revert to the zlib 1.0.8 inflate to avoid the gcc 2.8.0 bug (Jeremy Buhler) +- compile with -DFASTEST to get compression code optimized for speed only +- in minigzip, try mmap'ing the input file first (Miguel Albrecht) +- increase size of I/O buffers in minigzip.c and gzio.c (not a big gain + on Sun but significant on HP) + +- add a pointer to experimental unzip library in README (Gilles Vollant) +- initialize variable gcc in configure (Chris Herborth) + +Changes in 1.0.9 (17 Feb 1998) +- added gzputs and gzgets functions +- do not clear eof flag in gzseek (Mark Diekhans) +- fix gzseek for files in transparent mode (Mark Diekhans) +- do not assume that vsprintf returns the number of bytes written (Jens Krinke) +- replace EXPORT with ZEXPORT to avoid conflict with other programs +- added compress2 in zconf.h, zlib.def, zlib.dnt +- new asm code from Gilles Vollant in contrib/asm386 +- simplify the inflate code (Mark): + . Replace ZALLOC's in huft_build() with single ZALLOC in inflate_blocks_new() + . ZALLOC the length list in inflate_trees_fixed() instead of using stack + . ZALLOC the value area for huft_build() instead of using stack + . Simplify Z_FINISH check in inflate() + +- Avoid gcc 2.8.0 comparison bug a little differently than zlib 1.0.8 +- in inftrees.c, avoid cc -O bug on HP (Farshid Elahi) +- in zconf.h move the ZLIB_DLL stuff earlier to avoid problems with + the declaration of FAR (Gilles VOllant) +- install libz.so* with mode 755 (executable) instead of 644 (Marc Lehmann) +- read_buf buf parameter of type Bytef* instead of charf* +- zmemcpy parameters are of type Bytef*, not charf* (Joseph Strout) +- do not redeclare unlink in minigzip.c for WIN32 (John Bowler) +- fix check for presence of directories in "make install" (Ian Willis) + +Changes in 1.0.8 (27 Jan 1998) +- fixed offsets in contrib/asm386/gvmat32.asm (Gilles Vollant) +- fix gzgetc and gzputc for big endian systems (Markus Oberhumer) +- added compress2() to allow setting the compression level +- include sys/types.h to get off_t on some systems (Marc Lehmann & QingLong) +- use constant arrays for the static trees in trees.c instead of computing + them at run time (thanks to Ken Raeburn for this suggestion). To create + trees.h, compile with GEN_TREES_H and run "make test". +- check return code of example in "make test" and display result +- pass minigzip command line options to file_compress +- simplifying code of inflateSync to avoid gcc 2.8 bug + +- support CC="gcc -Wall" in configure -s (QingLong) +- avoid a flush caused by ftell in gzopen for write mode (Ken Raeburn) +- fix test for shared library support to avoid compiler warnings +- zlib.lib -> zlib.dll in msdos/zlib.rc (Gilles Vollant) +- check for TARGET_OS_MAC in addition to MACOS (Brad Pettit) +- do not use fdopen for Metrowerks on Mac (Brad Pettit)) +- add checks for gzputc and gzputc in example.c +- avoid warnings in gzio.c and deflate.c (Andreas Kleinert) +- use const for the CRC table (Ken Raeburn) +- fixed "make uninstall" for shared libraries +- use Tracev instead of Trace in infblock.c +- in example.c use correct compressed length for test_sync +- suppress +vnocompatwarnings in configure for HPUX (not always supported) + +Changes in 1.0.7 (20 Jan 1998) +- fix gzseek which was broken in write mode +- return error for gzseek to negative absolute position +- fix configure for Linux (Chun-Chung Chen) +- increase stack space for MSC (Tim Wegner) +- get_crc_table and inflateSyncPoint are EXPORTed (Gilles Vollant) +- define EXPORTVA for gzprintf (Gilles Vollant) +- added man page zlib.3 (Rick Rodgers) +- for contrib/untgz, fix makedir() and improve Makefile + +- check gzseek in write mode in example.c +- allocate extra buffer for seeks only if gzseek is actually called +- avoid signed/unsigned comparisons (Tim Wegner, Gilles Vollant) +- add inflateSyncPoint in zconf.h +- fix list of exported functions in nt/zlib.dnt and mdsos/zlib.def + +Changes in 1.0.6 (19 Jan 1998) +- add functions gzprintf, gzputc, gzgetc, gztell, gzeof, gzseek, gzrewind and + gzsetparams (thanks to Roland Giersig and Kevin Ruland for some of this code) +- Fix a deflate bug occurring only with compression level 0 (thanks to + Andy Buckler for finding this one). +- In minigzip, pass transparently also the first byte for .Z files. +- return Z_BUF_ERROR instead of Z_OK if output buffer full in uncompress() +- check Z_FINISH in inflate (thanks to Marc Schluper) +- Implement deflateCopy (thanks to Adam Costello) +- make static libraries by default in configure, add --shared option. +- move MSDOS or Windows specific files to directory msdos +- suppress the notion of partial flush to simplify the interface + (but the symbol Z_PARTIAL_FLUSH is kept for compatibility with 1.0.4) +- suppress history buffer provided by application to simplify the interface + (this feature was not implemented anyway in 1.0.4) +- next_in and avail_in must be initialized before calling inflateInit or + inflateInit2 +- add EXPORT in all exported functions (for Windows DLL) +- added Makefile.nt (thanks to Stephen Williams) +- added the unsupported "contrib" directory: + contrib/asm386/ by Gilles Vollant + 386 asm code replacing longest_match(). + contrib/iostream/ by Kevin Ruland + A C++ I/O streams interface to the zlib gz* functions + contrib/iostream2/ by Tyge Løvset + Another C++ I/O streams interface + contrib/untgz/ by "Pedro A. Aranda Guti\irrez" + A very simple tar.gz file extractor using zlib + contrib/visual-basic.txt by Carlos Rios + How to use compress(), uncompress() and the gz* functions from VB. +- pass params -f (filtered data), -h (huffman only), -1 to -9 (compression + level) in minigzip (thanks to Tom Lane) + +- use const for rommable constants in deflate +- added test for gzseek and gztell in example.c +- add undocumented function inflateSyncPoint() (hack for Paul Mackerras) +- add undocumented function zError to convert error code to string + (for Tim Smithers) +- Allow compilation of gzio with -DNO_DEFLATE to avoid the compression code. +- Use default memcpy for Symantec MSDOS compiler. +- Add EXPORT keyword for check_func (needed for Windows DLL) +- add current directory to LD_LIBRARY_PATH for "make test" +- create also a link for libz.so.1 +- added support for FUJITSU UXP/DS (thanks to Toshiaki Nomura) +- use $(SHAREDLIB) instead of libz.so in Makefile.in (for HPUX) +- added -soname for Linux in configure (Chun-Chung Chen, +- assign numbers to the exported functions in zlib.def (for Windows DLL) +- add advice in zlib.h for best usage of deflateSetDictionary +- work around compiler bug on Atari (cast Z_NULL in call of s->checkfn) +- allow compilation with ANSI keywords only enabled for TurboC in large model +- avoid "versionString"[0] (Borland bug) +- add NEED_DUMMY_RETURN for Borland +- use variable z_verbose for tracing in debug mode (L. Peter Deutsch). +- allow compilation with CC +- defined STDC for OS/2 (David Charlap) +- limit external names to 8 chars for MVS (Thomas Lund) +- in minigzip.c, use static buffers only for 16-bit systems +- fix suffix check for "minigzip -d foo.gz" +- do not return an error for the 2nd of two consecutive gzflush() (Felix Lee) +- use _fdopen instead of fdopen for MSC >= 6.0 (Thomas Fanslau) +- added makelcc.bat for lcc-win32 (Tom St Denis) +- in Makefile.dj2, use copy and del instead of install and rm (Frank Donahoe) +- Avoid expanded $Id$. Use "rcs -kb" or "cvs admin -kb" to avoid Id expansion. +- check for unistd.h in configure (for off_t) +- remove useless check parameter in inflate_blocks_free +- avoid useless assignment of s->check to itself in inflate_blocks_new +- do not flush twice in gzclose (thanks to Ken Raeburn) +- rename FOPEN as F_OPEN to avoid clash with /usr/include/sys/file.h +- use NO_ERRNO_H instead of enumeration of operating systems with errno.h +- work around buggy fclose on pipes for HP/UX +- support zlib DLL with BORLAND C++ 5.0 (thanks to Glenn Randers-Pehrson) +- fix configure if CC is already equal to gcc + +Changes in 1.0.5 (3 Jan 98) +- Fix inflate to terminate gracefully when fed corrupted or invalid data +- Use const for rommable constants in inflate +- Eliminate memory leaks on error conditions in inflate +- Removed some vestigial code in inflate +- Update web address in README + +Changes in 1.0.4 (24 Jul 96) +- In very rare conditions, deflate(s, Z_FINISH) could fail to produce an EOF + bit, so the decompressor could decompress all the correct data but went + on to attempt decompressing extra garbage data. This affected minigzip too. +- zlibVersion and gzerror return const char* (needed for DLL) +- port to RISCOS (no fdopen, no multiple dots, no unlink, no fileno) +- use z_error only for DEBUG (avoid problem with DLLs) + +Changes in 1.0.3 (2 Jul 96) +- use z_streamp instead of z_stream *, which is now a far pointer in MSDOS + small and medium models; this makes the library incompatible with previous + versions for these models. (No effect in large model or on other systems.) +- return OK instead of BUF_ERROR if previous deflate call returned with + avail_out as zero but there is nothing to do +- added memcmp for non STDC compilers +- define NO_DUMMY_DECL for more Mac compilers (.h files merged incorrectly) +- define __32BIT__ if __386__ or i386 is defined (pb. with Watcom and SCO) +- better check for 16-bit mode MSC (avoids problem with Symantec) + +Changes in 1.0.2 (23 May 96) +- added Windows DLL support +- added a function zlibVersion (for the DLL support) +- fixed declarations using Bytef in infutil.c (pb with MSDOS medium model) +- Bytef is define's instead of typedef'd only for Borland C +- avoid reading uninitialized memory in example.c +- mention in README that the zlib format is now RFC1950 +- updated Makefile.dj2 +- added algorithm.doc + +Changes in 1.0.1 (20 May 96) [1.0 skipped to avoid confusion] +- fix array overlay in deflate.c which sometimes caused bad compressed data +- fix inflate bug with empty stored block +- fix MSDOS medium model which was broken in 0.99 +- fix deflateParams() which could generate bad compressed data. +- Bytef is define'd instead of typedef'ed (work around Borland bug) +- added an INDEX file +- new makefiles for DJGPP (Makefile.dj2), 32-bit Borland (Makefile.b32), + Watcom (Makefile.wat), Amiga SAS/C (Makefile.sas) +- speed up adler32 for modern machines without auto-increment +- added -ansi for IRIX in configure +- static_init_done in trees.c is an int +- define unlink as delete for VMS +- fix configure for QNX +- add configure branch for SCO and HPUX +- avoid many warnings (unused variables, dead assignments, etc...) +- no fdopen for BeOS +- fix the Watcom fix for 32 bit mode (define FAR as empty) +- removed redefinition of Byte for MKWERKS +- work around an MWKERKS bug (incorrect merge of all .h files) + +Changes in 0.99 (27 Jan 96) +- allow preset dictionary shared between compressor and decompressor +- allow compression level 0 (no compression) +- add deflateParams in zlib.h: allow dynamic change of compression level + and compression strategy. +- test large buffers and deflateParams in example.c +- add optional "configure" to build zlib as a shared library +- suppress Makefile.qnx, use configure instead +- fixed deflate for 64-bit systems (detected on Cray) +- fixed inflate_blocks for 64-bit systems (detected on Alpha) +- declare Z_DEFLATED in zlib.h (possible parameter for deflateInit2) +- always return Z_BUF_ERROR when deflate() has nothing to do +- deflateInit and inflateInit are now macros to allow version checking +- prefix all global functions and types with z_ with -DZ_PREFIX +- make falloc completely reentrant (inftrees.c) +- fixed very unlikely race condition in ct_static_init +- free in reverse order of allocation to help memory manager +- use zlib-1.0/* instead of zlib/* inside the tar.gz +- make zlib warning-free with "gcc -O3 -Wall -Wwrite-strings -Wpointer-arith + -Wconversion -Wstrict-prototypes -Wmissing-prototypes" +- allow gzread on concatenated .gz files +- deflateEnd now returns Z_DATA_ERROR if it was premature +- deflate is finally (?) fully deterministic (no matches beyond end of input) +- Document Z_SYNC_FLUSH +- add uninstall in Makefile +- Check for __cpluplus in zlib.h +- Better test in ct_align for partial flush +- avoid harmless warnings for Borland C++ +- initialize hash_head in deflate.c +- avoid warning on fdopen (gzio.c) for HP cc -Aa +- include stdlib.h for STDC compilers +- include errno.h for Cray +- ignore error if ranlib doesn't exist +- call ranlib twice for NeXTSTEP +- use exec_prefix instead of prefix for libz.a +- renamed ct_* as _tr_* to avoid conflict with applications +- clear z->msg in inflateInit2 before any error return +- initialize opaque in example.c, gzio.c, deflate.c and inflate.c +- fixed typo in zconf.h (_GNUC__ => __GNUC__) +- check for WIN32 in zconf.h and zutil.c (avoid farmalloc in 32-bit mode) +- fix typo in Make_vms.com (f$trnlnm -> f$getsyi) +- in fcalloc, normalize pointer if size > 65520 bytes +- don't use special fcalloc for 32 bit Borland C++ +- use STDC instead of __GO32__ to avoid redeclaring exit, calloc, etc... +- use Z_BINARY instead of BINARY +- document that gzclose after gzdopen will close the file +- allow "a" as mode in gzopen. +- fix error checking in gzread +- allow skipping .gz extra-field on pipes +- added reference to Perl interface in README +- put the crc table in FAR data (I dislike more and more the medium model :) +- added get_crc_table +- added a dimension to all arrays (Borland C can't count). +- workaround Borland C bug in declaration of inflate_codes_new & inflate_fast +- guard against multiple inclusion of *.h (for precompiled header on Mac) +- Watcom C pretends to be Microsoft C small model even in 32 bit mode. +- don't use unsized arrays to avoid silly warnings by Visual C++: + warning C4746: 'inflate_mask' : unsized array treated as '__far' + (what's wrong with far data in far model?). +- define enum out of inflate_blocks_state to allow compilation with C++ + +Changes in 0.95 (16 Aug 95) +- fix MSDOS small and medium model (now easier to adapt to any compiler) +- inlined send_bits +- fix the final (:-) bug for deflate with flush (output was correct but + not completely flushed in rare occasions). +- default window size is same for compression and decompression + (it's now sufficient to set MAX_WBITS in zconf.h). +- voidp -> voidpf and voidnp -> voidp (for consistency with other + typedefs and because voidnp was not near in large model). + +Changes in 0.94 (13 Aug 95) +- support MSDOS medium model +- fix deflate with flush (could sometimes generate bad output) +- fix deflateReset (zlib header was incorrectly suppressed) +- added support for VMS +- allow a compression level in gzopen() +- gzflush now calls fflush +- For deflate with flush, flush even if no more input is provided. +- rename libgz.a as libz.a +- avoid complex expression in infcodes.c triggering Turbo C bug +- work around a problem with gcc on Alpha (in INSERT_STRING) +- don't use inline functions (problem with some gcc versions) +- allow renaming of Byte, uInt, etc... with #define. +- avoid warning about (unused) pointer before start of array in deflate.c +- avoid various warnings in gzio.c, example.c, infblock.c, adler32.c, zutil.c +- avoid reserved word 'new' in trees.c + +Changes in 0.93 (25 June 95) +- temporarily disable inline functions +- make deflate deterministic +- give enough lookahead for PARTIAL_FLUSH +- Set binary mode for stdin/stdout in minigzip.c for OS/2 +- don't even use signed char in inflate (not portable enough) +- fix inflate memory leak for segmented architectures + +Changes in 0.92 (3 May 95) +- don't assume that char is signed (problem on SGI) +- Clear bit buffer when starting a stored block +- no memcpy on Pyramid +- suppressed inftest.c +- optimized fill_window, put longest_match inline for gcc +- optimized inflate on stored blocks. +- untabify all sources to simplify patches + +Changes in 0.91 (2 May 95) +- Default MEM_LEVEL is 8 (not 9 for Unix) as documented in zlib.h +- Document the memory requirements in zconf.h +- added "make install" +- fix sync search logic in inflateSync +- deflate(Z_FULL_FLUSH) now works even if output buffer too short +- after inflateSync, don't scare people with just "lo world" +- added support for DJGPP + +Changes in 0.9 (1 May 95) +- don't assume that zalloc clears the allocated memory (the TurboC bug + was Mark's bug after all :) +- let again gzread copy uncompressed data unchanged (was working in 0.71) +- deflate(Z_FULL_FLUSH), inflateReset and inflateSync are now fully implemented +- added a test of inflateSync in example.c +- moved MAX_WBITS to zconf.h because users might want to change that. +- document explicitly that zalloc(64K) on MSDOS must return a normalized + pointer (zero offset) +- added Makefiles for Microsoft C, Turbo C, Borland C++ +- faster crc32() + +Changes in 0.8 (29 April 95) +- added fast inflate (inffast.c) +- deflate(Z_FINISH) now returns Z_STREAM_END when done. Warning: this + is incompatible with previous versions of zlib which returned Z_OK. +- work around a TurboC compiler bug (bad code for b << 0, see infutil.h) + (actually that was not a compiler bug, see 0.81 above) +- gzread no longer reads one extra byte in certain cases +- In gzio destroy(), don't reference a freed structure +- avoid many warnings for MSDOS +- avoid the ERROR symbol which is used by MS Windows + +Changes in 0.71 (14 April 95) +- Fixed more MSDOS compilation problems :( There is still a bug with + TurboC large model. + +Changes in 0.7 (14 April 95) +- Added full inflate support. +- Simplified the crc32() interface. The pre- and post-conditioning + (one's complement) is now done inside crc32(). WARNING: this is + incompatible with previous versions; see zlib.h for the new usage. + +Changes in 0.61 (12 April 95) +- workaround for a bug in TurboC. example and minigzip now work on MSDOS. + +Changes in 0.6 (11 April 95) +- added minigzip.c +- added gzdopen to reopen a file descriptor as gzFile +- added transparent reading of non-gziped files in gzread. +- fixed bug in gzread (don't read crc as data) +- fixed bug in destroy (gzio.c) (don't return Z_STREAM_END for gzclose). +- don't allocate big arrays in the stack (for MSDOS) +- fix some MSDOS compilation problems + +Changes in 0.5: +- do real compression in deflate.c. Z_PARTIAL_FLUSH is supported but + not yet Z_FULL_FLUSH. +- support decompression but only in a single step (forced Z_FINISH) +- added opaque object for zalloc and zfree. +- added deflateReset and inflateReset +- added a variable zlib_version for consistency checking. +- renamed the 'filter' parameter of deflateInit2 as 'strategy'. + Added Z_FILTERED and Z_HUFFMAN_ONLY constants. + +Changes in 0.4: +- avoid "zip" everywhere, use zlib instead of ziplib. +- suppress Z_BLOCK_FLUSH, interpret Z_PARTIAL_FLUSH as block flush + if compression method == 8. +- added adler32 and crc32 +- renamed deflateOptions as deflateInit2, call one or the other but not both +- added the method parameter for deflateInit2. +- added inflateInit2 +- simplied considerably deflateInit and inflateInit by not supporting + user-provided history buffer. This is supported only in deflateInit2 + and inflateInit2. + +Changes in 0.3: +- prefix all macro names with Z_ +- use Z_FINISH instead of deflateEnd to finish compression. +- added Z_HUFFMAN_ONLY +- added gzerror() diff --git a/MicroPython_BUILD/components/zlib/README b/MicroPython_BUILD/components/zlib/README new file mode 100644 index 0000000..51106de --- /dev/null +++ b/MicroPython_BUILD/components/zlib/README @@ -0,0 +1,115 @@ +ZLIB DATA COMPRESSION LIBRARY + +zlib 1.2.11 is a general purpose data compression library. All the code is +thread safe. The data format used by the zlib library is described by RFCs +(Request for Comments) 1950 to 1952 in the files +http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and +rfc1952 (gzip format). + +All functions of the compression library are documented in the file zlib.h +(volunteer to write man pages welcome, contact zlib@gzip.org). A usage example +of the library is given in the file test/example.c which also tests that +the library is working correctly. Another example is given in the file +test/minigzip.c. The compression library itself is composed of all source +files in the root directory. + +To compile all files and run the test program, follow the instructions given at +the top of Makefile.in. In short "./configure; make test", and if that goes +well, "make install" should work for most flavors of Unix. For Windows, use +one of the special makefiles in win32/ or contrib/vstudio/ . For VMS, use +make_vms.com. + +Questions about zlib should be sent to , or to Gilles Vollant + for the Windows DLL version. The zlib home page is +http://zlib.net/ . Before reporting a problem, please check this site to +verify that you have the latest version of zlib; otherwise get the latest +version and check whether the problem still exists or not. + +PLEASE read the zlib FAQ http://zlib.net/zlib_faq.html before asking for help. + +Mark Nelson wrote an article about zlib for the Jan. 1997 +issue of Dr. Dobb's Journal; a copy of the article is available at +http://marknelson.us/1997/01/01/zlib-engine/ . + +The changes made in version 1.2.11 are documented in the file ChangeLog. + +Unsupported third party contributions are provided in directory contrib/ . + +zlib is available in Java using the java.util.zip package, documented at +http://java.sun.com/developer/technicalArticles/Programming/compression/ . + +A Perl interface to zlib written by Paul Marquess is available +at CPAN (Comprehensive Perl Archive Network) sites, including +http://search.cpan.org/~pmqs/IO-Compress-Zlib/ . + +A Python interface to zlib written by A.M. Kuchling is +available in Python 1.5 and later versions, see +http://docs.python.org/library/zlib.html . + +zlib is built into tcl: http://wiki.tcl.tk/4610 . + +An experimental package to read and write files in .zip format, written on top +of zlib by Gilles Vollant , is available in the +contrib/minizip directory of zlib. + + +Notes for some targets: + +- For Windows DLL versions, please see win32/DLL_FAQ.txt + +- For 64-bit Irix, deflate.c must be compiled without any optimization. With + -O, one libpng test fails. The test works in 32 bit mode (with the -n32 + compiler flag). The compiler bug has been reported to SGI. + +- zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1 it works + when compiled with cc. + +- On Digital Unix 4.0D (formely OSF/1) on AlphaServer, the cc option -std1 is + necessary to get gzprintf working correctly. This is done by configure. + +- zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with + other compilers. Use "make test" to check your compiler. + +- gzdopen is not supported on RISCOS or BEOS. + +- For PalmOs, see http://palmzlib.sourceforge.net/ + + +Acknowledgments: + + The deflate format used by zlib was defined by Phil Katz. The deflate and + zlib specifications were written by L. Peter Deutsch. Thanks to all the + people who reported problems and suggested various improvements in zlib; they + are too numerous to cite here. + +Copyright notice: + + (C) 1995-2017 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu + +If you use the zlib library in a product, we would appreciate *not* receiving +lengthy legal documents to sign. The sources are provided for free but without +warranty of any kind. The library has been entirely written by Jean-loup +Gailly and Mark Adler; it does not include third-party code. + +If you redistribute modified sources, we would appreciate that you include in +the file ChangeLog history information documenting your changes. Please read +the FAQ for more information on the distribution of modified source versions. diff --git a/MicroPython_BUILD/firmware/MicroPython_LoBo_esp32.zip b/MicroPython_BUILD/firmware/MicroPython_LoBo_esp32.zip index a95b601..5d42489 100644 Binary files a/MicroPython_BUILD/firmware/MicroPython_LoBo_esp32.zip and b/MicroPython_BUILD/firmware/MicroPython_LoBo_esp32.zip differ diff --git a/MicroPython_BUILD/firmware/MicroPython_LoBo_esp32_all.zip b/MicroPython_BUILD/firmware/MicroPython_LoBo_esp32_all.zip index 1d1f8fa..2e59a70 100644 Binary files a/MicroPython_BUILD/firmware/MicroPython_LoBo_esp32_all.zip and b/MicroPython_BUILD/firmware/MicroPython_LoBo_esp32_all.zip differ diff --git a/MicroPython_BUILD/firmware/MicroPython_LoBo_esp32_ota.zip b/MicroPython_BUILD/firmware/MicroPython_LoBo_esp32_ota.zip index 42c5565..b65d8c2 100644 Binary files a/MicroPython_BUILD/firmware/MicroPython_LoBo_esp32_ota.zip and b/MicroPython_BUILD/firmware/MicroPython_LoBo_esp32_ota.zip differ diff --git a/MicroPython_BUILD/firmware/MicroPython_LoBo_esp32_psram.zip b/MicroPython_BUILD/firmware/MicroPython_LoBo_esp32_psram.zip index 64e8a68..773b38f 100644 Binary files a/MicroPython_BUILD/firmware/MicroPython_LoBo_esp32_psram.zip and b/MicroPython_BUILD/firmware/MicroPython_LoBo_esp32_psram.zip differ diff --git a/MicroPython_BUILD/firmware/MicroPython_LoBo_esp32_psram_all.zip b/MicroPython_BUILD/firmware/MicroPython_LoBo_esp32_psram_all.zip index 029804a..9ea404d 100644 Binary files a/MicroPython_BUILD/firmware/MicroPython_LoBo_esp32_psram_all.zip and b/MicroPython_BUILD/firmware/MicroPython_LoBo_esp32_psram_all.zip differ diff --git a/MicroPython_BUILD/firmware/MicroPython_LoBo_esp32_psram_ota.zip b/MicroPython_BUILD/firmware/MicroPython_LoBo_esp32_psram_ota.zip index b75ed29..899ba77 100644 Binary files a/MicroPython_BUILD/firmware/MicroPython_LoBo_esp32_psram_ota.zip and b/MicroPython_BUILD/firmware/MicroPython_LoBo_esp32_psram_ota.zip differ diff --git a/MicroPython_BUILD/firmware/esp32/MicroPython.bin b/MicroPython_BUILD/firmware/esp32/MicroPython.bin index 55802d2..1978563 100644 Binary files a/MicroPython_BUILD/firmware/esp32/MicroPython.bin and b/MicroPython_BUILD/firmware/esp32/MicroPython.bin differ diff --git a/MicroPython_BUILD/firmware/esp32/bootloader/bootloader.bin b/MicroPython_BUILD/firmware/esp32/bootloader/bootloader.bin index c5a760a..fe845b2 100644 Binary files a/MicroPython_BUILD/firmware/esp32/bootloader/bootloader.bin and b/MicroPython_BUILD/firmware/esp32/bootloader/bootloader.bin differ diff --git a/MicroPython_BUILD/firmware/esp32_all/MicroPython.bin b/MicroPython_BUILD/firmware/esp32_all/MicroPython.bin index 93ed540..84c65a4 100644 Binary files a/MicroPython_BUILD/firmware/esp32_all/MicroPython.bin and b/MicroPython_BUILD/firmware/esp32_all/MicroPython.bin differ diff --git a/MicroPython_BUILD/firmware/esp32_all/bootloader/bootloader.bin b/MicroPython_BUILD/firmware/esp32_all/bootloader/bootloader.bin index 510ab13..a647425 100644 Binary files a/MicroPython_BUILD/firmware/esp32_all/bootloader/bootloader.bin and b/MicroPython_BUILD/firmware/esp32_all/bootloader/bootloader.bin differ diff --git a/MicroPython_BUILD/firmware/esp32_ota/MicroPython.bin b/MicroPython_BUILD/firmware/esp32_ota/MicroPython.bin index f11e173..fb79026 100644 Binary files a/MicroPython_BUILD/firmware/esp32_ota/MicroPython.bin and b/MicroPython_BUILD/firmware/esp32_ota/MicroPython.bin differ diff --git a/MicroPython_BUILD/firmware/esp32_ota/bootloader/bootloader.bin b/MicroPython_BUILD/firmware/esp32_ota/bootloader/bootloader.bin index 77bcb0f..498de3a 100644 Binary files a/MicroPython_BUILD/firmware/esp32_ota/bootloader/bootloader.bin and b/MicroPython_BUILD/firmware/esp32_ota/bootloader/bootloader.bin differ diff --git a/MicroPython_BUILD/firmware/esp32_psram/MicroPython.bin b/MicroPython_BUILD/firmware/esp32_psram/MicroPython.bin index 34ddf66..6ecfddf 100644 Binary files a/MicroPython_BUILD/firmware/esp32_psram/MicroPython.bin and b/MicroPython_BUILD/firmware/esp32_psram/MicroPython.bin differ diff --git a/MicroPython_BUILD/firmware/esp32_psram/bootloader/bootloader.bin b/MicroPython_BUILD/firmware/esp32_psram/bootloader/bootloader.bin index b578d7c..30ac77d 100644 Binary files a/MicroPython_BUILD/firmware/esp32_psram/bootloader/bootloader.bin and b/MicroPython_BUILD/firmware/esp32_psram/bootloader/bootloader.bin differ diff --git a/MicroPython_BUILD/firmware/esp32_psram_all/MicroPython.bin b/MicroPython_BUILD/firmware/esp32_psram_all/MicroPython.bin index d5dcc5a..e70464d 100644 Binary files a/MicroPython_BUILD/firmware/esp32_psram_all/MicroPython.bin and b/MicroPython_BUILD/firmware/esp32_psram_all/MicroPython.bin differ diff --git a/MicroPython_BUILD/firmware/esp32_psram_all/bootloader/bootloader.bin b/MicroPython_BUILD/firmware/esp32_psram_all/bootloader/bootloader.bin index 619c972..16a986a 100644 Binary files a/MicroPython_BUILD/firmware/esp32_psram_all/bootloader/bootloader.bin and b/MicroPython_BUILD/firmware/esp32_psram_all/bootloader/bootloader.bin differ diff --git a/MicroPython_BUILD/firmware/esp32_psram_ota/MicroPython.bin b/MicroPython_BUILD/firmware/esp32_psram_ota/MicroPython.bin index 65a208f..02d5ac7 100644 Binary files a/MicroPython_BUILD/firmware/esp32_psram_ota/MicroPython.bin and b/MicroPython_BUILD/firmware/esp32_psram_ota/MicroPython.bin differ diff --git a/MicroPython_BUILD/firmware/esp32_psram_ota/bootloader/bootloader.bin b/MicroPython_BUILD/firmware/esp32_psram_ota/bootloader/bootloader.bin index 0ece3a2..0922150 100644 Binary files a/MicroPython_BUILD/firmware/esp32_psram_ota/bootloader/bootloader.bin and b/MicroPython_BUILD/firmware/esp32_psram_ota/bootloader/bootloader.bin differ