D3356: wsgicgi: un-do some prior porting work that is now wrong

2018-04-16 Thread durin42 (Augie Fackler)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG2d5b5bcc3b9f: wsgicgi: un-do some prior porting work that 
is now wrong (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3356?vs=8315=8350

REVISION DETAIL
  https://phab.mercurial-scm.org/D3356

AFFECTED FILES
  contrib/python3-whitelist
  mercurial/hgweb/wsgicgi.py

CHANGE DETAILS

diff --git a/mercurial/hgweb/wsgicgi.py b/mercurial/hgweb/wsgicgi.py
--- a/mercurial/hgweb/wsgicgi.py
+++ b/mercurial/hgweb/wsgicgi.py
@@ -10,8 +10,10 @@
 
 from __future__ import absolute_import
 
+import os
+
 from .. import (
-encoding,
+pycompat,
 )
 
 from ..utils import (
@@ -26,7 +28,7 @@
 procutil.setbinary(procutil.stdin)
 procutil.setbinary(procutil.stdout)
 
-environ = dict(encoding.environ.iteritems())
+environ = dict(os.environ.iteritems()) # re-exports
 environ.setdefault(r'PATH_INFO', '')
 if environ.get(r'SERVER_SOFTWARE', r'').startswith(r'Microsoft-IIS'):
 # IIS includes script_name in PATH_INFO
@@ -61,9 +63,10 @@
 elif not headers_sent:
 # Before the first output, send the stored headers
 status, response_headers = headers_sent[:] = headers_set
-out.write('Status: %s\r\n' % status)
-for header in response_headers:
-out.write('%s: %s\r\n' % header)
+out.write('Status: %s\r\n' % pycompat.bytesurl(status))
+for hk, hv in response_headers:
+out.write('%s: %s\r\n' % (pycompat.bytesurl(hk),
+  pycompat.bytesurl(hv)))
 out.write('\r\n')
 
 out.write(data)
diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
--- a/contrib/python3-whitelist
+++ b/contrib/python3-whitelist
@@ -45,6 +45,7 @@
 test-check-pylint.t
 test-check-shbang.t
 test-children.t
+test-clone-cgi.t
 test-clone-pull-corruption.t
 test-clone-r.t
 test-clone-update-order.t



To: durin42, pulkit, #hg-reviewers, indygreg
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3356: wsgicgi: un-do some prior porting work that is now wrong

2018-04-16 Thread durin42 (Augie Fackler)
durin42 updated this revision to Diff 8315.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3356?vs=8271=8315

REVISION DETAIL
  https://phab.mercurial-scm.org/D3356

AFFECTED FILES
  contrib/python3-whitelist
  mercurial/hgweb/wsgicgi.py

CHANGE DETAILS

diff --git a/mercurial/hgweb/wsgicgi.py b/mercurial/hgweb/wsgicgi.py
--- a/mercurial/hgweb/wsgicgi.py
+++ b/mercurial/hgweb/wsgicgi.py
@@ -10,8 +10,10 @@
 
 from __future__ import absolute_import
 
+import os
+
 from .. import (
-encoding,
+pycompat,
 )
 
 from ..utils import (
@@ -26,7 +28,7 @@
 procutil.setbinary(procutil.stdin)
 procutil.setbinary(procutil.stdout)
 
-environ = dict(encoding.environ.iteritems())
+environ = dict(os.environ.iteritems()) # re-exports
 environ.setdefault(r'PATH_INFO', '')
 if environ.get(r'SERVER_SOFTWARE', r'').startswith(r'Microsoft-IIS'):
 # IIS includes script_name in PATH_INFO
@@ -61,9 +63,10 @@
 elif not headers_sent:
 # Before the first output, send the stored headers
 status, response_headers = headers_sent[:] = headers_set
-out.write('Status: %s\r\n' % status)
-for header in response_headers:
-out.write('%s: %s\r\n' % header)
+out.write('Status: %s\r\n' % pycompat.bytesurl(status))
+for hk, hv in response_headers:
+out.write('%s: %s\r\n' % (pycompat.bytesurl(hk),
+  pycompat.bytesurl(hv)))
 out.write('\r\n')
 
 out.write(data)
diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
--- a/contrib/python3-whitelist
+++ b/contrib/python3-whitelist
@@ -45,6 +45,7 @@
 test-check-pylint.t
 test-check-shbang.t
 test-children.t
+test-clone-cgi.t
 test-clone-pull-corruption.t
 test-clone-r.t
 test-clone-update-order.t



To: durin42, pulkit, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3356: wsgicgi: un-do some prior porting work that is now wrong

2018-04-14 Thread durin42 (Augie Fackler)
durin42 updated this revision to Diff 8271.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3356?vs=8233=8271

REVISION DETAIL
  https://phab.mercurial-scm.org/D3356

AFFECTED FILES
  contrib/python3-whitelist
  mercurial/hgweb/wsgicgi.py

CHANGE DETAILS

diff --git a/mercurial/hgweb/wsgicgi.py b/mercurial/hgweb/wsgicgi.py
--- a/mercurial/hgweb/wsgicgi.py
+++ b/mercurial/hgweb/wsgicgi.py
@@ -10,8 +10,10 @@
 
 from __future__ import absolute_import
 
+import os
+
 from .. import (
-encoding,
+pycompat,
 )
 
 from ..utils import (
@@ -26,7 +28,7 @@
 procutil.setbinary(procutil.stdin)
 procutil.setbinary(procutil.stdout)
 
-environ = dict(encoding.environ.iteritems())
+environ = dict(os.environ.iteritems()) # re-exports
 environ.setdefault(r'PATH_INFO', '')
 if environ.get(r'SERVER_SOFTWARE', r'').startswith(r'Microsoft-IIS'):
 # IIS includes script_name in PATH_INFO
@@ -61,9 +63,10 @@
 elif not headers_sent:
 # Before the first output, send the stored headers
 status, response_headers = headers_sent[:] = headers_set
-out.write('Status: %s\r\n' % status)
-for header in response_headers:
-out.write('%s: %s\r\n' % header)
+out.write('Status: %s\r\n' % pycompat.bytesurl(status))
+for hk, hv in response_headers:
+out.write('%s: %s\r\n' % (pycompat.bytesurl(hk),
+  pycompat.bytesurl(hv)))
 out.write('\r\n')
 
 out.write(data)
diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
--- a/contrib/python3-whitelist
+++ b/contrib/python3-whitelist
@@ -45,6 +45,7 @@
 test-check-pylint.t
 test-check-shbang.t
 test-children.t
+test-clone-cgi.t
 test-clone-pull-corruption.t
 test-clone-r.t
 test-clone-update-order.t



To: durin42, pulkit, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3356: wsgicgi: un-do some prior porting work that is now wrong

2018-04-13 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: pulkit.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The Python 3 WSGI behavior is that the environ dict should be full of
  unicodes. We previously tried Too Hard here, so we unwind that bit of porting.
  
  Also add some bytesurl() encodes on status and headers.
  
  test-clone-cgi.t now passes.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3356

AFFECTED FILES
  contrib/python3-whitelist
  mercurial/hgweb/wsgicgi.py

CHANGE DETAILS

diff --git a/mercurial/hgweb/wsgicgi.py b/mercurial/hgweb/wsgicgi.py
--- a/mercurial/hgweb/wsgicgi.py
+++ b/mercurial/hgweb/wsgicgi.py
@@ -10,8 +10,10 @@
 
 from __future__ import absolute_import
 
+import os
+
 from .. import (
-encoding,
+pycompat,
 )
 
 from ..utils import (
@@ -26,7 +28,7 @@
 procutil.setbinary(procutil.stdin)
 procutil.setbinary(procutil.stdout)
 
-environ = dict(encoding.environ.iteritems())
+environ = dict(os.environ.iteritems()) # re-exports
 environ.setdefault(r'PATH_INFO', '')
 if environ.get(r'SERVER_SOFTWARE', r'').startswith(r'Microsoft-IIS'):
 # IIS includes script_name in PATH_INFO
@@ -61,9 +63,10 @@
 elif not headers_sent:
 # Before the first output, send the stored headers
 status, response_headers = headers_sent[:] = headers_set
-out.write('Status: %s\r\n' % status)
-for header in response_headers:
-out.write('%s: %s\r\n' % header)
+out.write('Status: %s\r\n' % pycompat.bytesurl(status))
+for hk, hv in response_headers:
+out.write('%s: %s\r\n' % (pycompat.bytesurl(hk),
+  pycompat.bytesurl(hv)))
 out.write('\r\n')
 
 out.write(data)
diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
--- a/contrib/python3-whitelist
+++ b/contrib/python3-whitelist
@@ -45,6 +45,7 @@
 test-check-pylint.t
 test-check-shbang.t
 test-children.t
+test-clone-cgi.t
 test-clone-pull-corruption.t
 test-clone-r.t
 test-clone-update-order.t



To: durin42, pulkit, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel