Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 939f70f

Browse files
SNOW-612517 reimplement how gzip compression is applied (snowflakedb#1200)
1 parent c6ffe2d commit 939f70f

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

DESCRIPTION.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ Source code is also available at: https://github.com/snowflakedb/snowflake-conne
1414
- Release wheels are now built on manylinux2014
1515
- Bumped supported pyarrow version to >=8.0.0,<8.1.0
1616
- Added overwrite option to write_pandas
17+
- Fixed a bug where gzip compressed http requests might be garbled by an unflushed buffer
18+
1719

1820

1921
- v2.7.9(June 26,2022)

src/snowflake/connector/network.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import time
1515
import traceback
1616
import uuid
17-
from io import BytesIO
1817
from threading import Lock
1918
from typing import TYPE_CHECKING
2019

@@ -1007,11 +1006,8 @@ def _request_exec(
10071006
logger.debug("socket timeout: %s", socket_timeout)
10081007
try:
10091008
if not catch_okta_unauthorized_error and data and len(data) > 0:
1010-
gzdata = BytesIO()
1011-
gzip.GzipFile(fileobj=gzdata, mode="wb").write(data.encode("utf-8"))
1012-
gzdata.seek(0, 0)
10131009
headers["Content-Encoding"] = "gzip"
1014-
input_data = gzdata
1010+
input_data = gzip.compress(data.encode("utf-8"))
10151011
else:
10161012
input_data = data
10171013

0 commit comments

Comments
 (0)