RESOLVED FIXED 221940
[LayoutTests] Convert http/tests/eventsource convert PHP to Python
https://bugs.webkit.org/show_bug.cgi?id=221940
Summary [LayoutTests] Convert http/tests/eventsource convert PHP to Python
Chris Gambrell
Reported 2021-02-15 17:27:21 PST
Replacing PHP with equivalent Python CGI scripts
Attachments
Patch (33.35 KB, patch)
2021-02-15 17:45 PST, Chris Gambrell
no flags
Patch (33.40 KB, patch)
2021-02-16 10:27 PST, Chris Gambrell
no flags
Radar WebKit Bug Importer
Comment 1 2021-02-15 17:27:45 PST
Chris Gambrell
Comment 2 2021-02-15 17:45:13 PST
Jonathan Bedard
Comment 3 2021-02-16 09:36:46 PST
Comment on attachment 420407 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=420407&action=review > LayoutTests/http/tests/eventsource/resources/es-cors-basic.py:8 > +request_method = os.environ.get('REQUEST_METHOD') I think we should do the request_method bit first. > LayoutTests/http/tests/eventsource/resources/es-cors-basic.py:11 > + sys.exit('Got unexpected preflight request') Python's sys.exit() prints to stderr, PHP's die prints to stdout. So we really want this to be: sys.stdout.write('Content-Type: text/html\r\n\r\n') sys.stdout.write('Got unexpected preflight request\n') sys.exit(0) > LayoutTests/http/tests/eventsource/resources/es-cors-basic.py:24 > + If the count is 0 or 1, we aren't ending the header > LayoutTests/http/tests/eventsource/resources/es-cors-credentials.py:9 > + sys.exit('Got unexpected preflight request') Ditto on the sys.exit() vs die() > LayoutTests/http/tests/eventsource/resources/es-cors-credentials.py:17 > +returned_from_header = False Unused variable > LayoutTests/http/tests/eventsource/resources/es-eof.py:11 > + 'id: {}\n' I think we want to use named variables in this string, gets to be a bit tough to follow > LayoutTests/http/tests/eventsource/resources/infinite-event-stream.py:15 > + data = {"time": curDate} Nit: Should use single quotes > LayoutTests/http/tests/eventsource/resources/status-codes.py:18 > +elif status_code == 301 or status_code == 302 or status_code == 303 or status_code == 307: Should probably do: status_code in [301, 302, 303, 307] instead
Chris Gambrell
Comment 4 2021-02-16 10:27:02 PST
Chris Gambrell
Comment 5 2021-02-16 10:30:11 PST
(In reply to Jonathan Bedard from comment #3) > Comment on attachment 420407 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=420407&action=review > > > LayoutTests/http/tests/eventsource/resources/es-cors-basic.py:8 > > +request_method = os.environ.get('REQUEST_METHOD') > > I think we should do the request_method bit first. > > > LayoutTests/http/tests/eventsource/resources/es-cors-basic.py:11 > > + sys.exit('Got unexpected preflight request') > > Python's sys.exit() prints to stderr, PHP's die prints to stdout. So we > really want this to be: > > sys.stdout.write('Content-Type: text/html\r\n\r\n') > sys.stdout.write('Got unexpected preflight request\n') > sys.exit(0) > > > LayoutTests/http/tests/eventsource/resources/es-cors-basic.py:24 > > + > > If the count is 0 or 1, we aren't ending the header > > > LayoutTests/http/tests/eventsource/resources/es-cors-credentials.py:9 > > + sys.exit('Got unexpected preflight request') > > Ditto on the sys.exit() vs die() > > > LayoutTests/http/tests/eventsource/resources/es-cors-credentials.py:17 > > +returned_from_header = False > > Unused variable > > > LayoutTests/http/tests/eventsource/resources/es-eof.py:11 > > + 'id: {}\n' > > I think we want to use named variables in this string, gets to be a bit > tough to follow > > > LayoutTests/http/tests/eventsource/resources/infinite-event-stream.py:15 > > + data = {"time": curDate} > > Nit: Should use single quotes > > > LayoutTests/http/tests/eventsource/resources/status-codes.py:18 > > +elif status_code == 301 or status_code == 302 or status_code == 303 or status_code == 307: > > Should probably do: status_code in [301, 302, 303, 307] instead Fixed all of these in comment 4
EWS
Comment 6 2021-02-16 13:46:07 PST
Committed r272926: <https://commits.webkit.org/r272926> All reviewed patches have been landed. Closing bug and clearing flags on attachment 420494 [details].
Note You need to log in before you can comment on or make changes to this bug.