Gitweb links:
...log
http://git.netsurf-browser.org/netsurf-test.git/shortlog/063e65d860b82bd006b5df52efd241edb4e4ca54
...commit
http://git.netsurf-browser.org/netsurf-test.git/commit/063e65d860b82bd006b5df52efd241edb4e4ca54
...tree
http://git.netsurf-browser.org/netsurf-test.git/tree/063e65d860b82bd006b5df52efd241edb4e4ca54
The branch, master has been updated
via 063e65d860b82bd006b5df52efd241edb4e4ca54 (commit)
from c24921952a69e28b3786e61e1869cff136846bbf (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff
http://git.netsurf-browser.org/netsurf-test.git/commit/?id=063e65d860b82bd006b5df52efd241edb4e4ca54
commit 063e65d860b82bd006b5df52efd241edb4e4ca54
Author: Daniel Silverstone <[email protected]>
Commit: Daniel Silverstone <[email protected]>
Buffer the icon save
diff --git a/cgi-bin/image.cgi b/cgi-bin/image.cgi
index 3f58abc..edcca1e 100755
--- a/cgi-bin/image.cgi
+++ b/cgi-bin/image.cgi
@@ -6,7 +6,7 @@ import sys
cgitb.enable()
import os
-from base64 import b64decode
+from io import BytesIO
auth = os.getenv("HTTP_AUTHORIZATION")
query = os.getenv("QUERY_STRING") or ""
@@ -30,6 +30,9 @@ except:
width = width if width > 0 else 100
height = height if height > 0 else 100
+width = width if width < 4000 else 4000
+height = height if height < 4000 else 4000
+
FORMATS = {
"png": { "ctype": "image/png", "ptype": "png" },
"jpeg": { "ctype": "image/jpeg", "ptype": "jpeg" },
@@ -52,4 +55,8 @@ im.putdata([(255,0,0)] * (width * height))
print("Content-Type: {}".format(fmt["ctype"]))
print("")
sys.stdout.flush()
-im.save(fp=sys.stdout.buffer, format=fmt["ptype"])
+
+imgbytes = BytesIO()
+im.save(fp=imgbytes, format=fmt["ptype"])
+
+sys.stdout.buffer.write(imgbytes.getvalue())
-----------------------------------------------------------------------
Summary of changes:
cgi-bin/image.cgi | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/cgi-bin/image.cgi b/cgi-bin/image.cgi
index 3f58abc..edcca1e 100755
--- a/cgi-bin/image.cgi
+++ b/cgi-bin/image.cgi
@@ -6,7 +6,7 @@ import sys
cgitb.enable()
import os
-from base64 import b64decode
+from io import BytesIO
auth = os.getenv("HTTP_AUTHORIZATION")
query = os.getenv("QUERY_STRING") or ""
@@ -30,6 +30,9 @@ except:
width = width if width > 0 else 100
height = height if height > 0 else 100
+width = width if width < 4000 else 4000
+height = height if height < 4000 else 4000
+
FORMATS = {
"png": { "ctype": "image/png", "ptype": "png" },
"jpeg": { "ctype": "image/jpeg", "ptype": "jpeg" },
@@ -52,4 +55,8 @@ im.putdata([(255,0,0)] * (width * height))
print("Content-Type: {}".format(fmt["ctype"]))
print("")
sys.stdout.flush()
-im.save(fp=sys.stdout.buffer, format=fmt["ptype"])
+
+imgbytes = BytesIO()
+im.save(fp=imgbytes, format=fmt["ptype"])
+
+sys.stdout.buffer.write(imgbytes.getvalue())
--
NetSurf test cases
_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org