Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/resources/post-and-verify-hybrid.cgi

Issue 2147633002: Remove nonstandard 'endings' option for Blob/File constructor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 #!/usr/bin/perl -wT 1 #!/usr/bin/perl -wT
2 2
3 use Config; 3 use Config;
4 4
5 print "Content-type: text/plain\n\n"; 5 print "Content-type: text/plain\n\n";
6 6
7 if ($ENV{'REQUEST_METHOD'} eq "POST") { 7 if ($ENV{'REQUEST_METHOD'} eq "POST") {
8 if ($ENV{'CONTENT_LENGTH'}) { 8 if ($ENV{'CONTENT_LENGTH'}) {
9 read(STDIN, $postData, $ENV{'CONTENT_LENGTH'}) || die "Could not get pos t data\n"; 9 read(STDIN, $postData, $ENV{'CONTENT_LENGTH'}) || die "Could not get pos t data\n";
10 } else { 10 } else {
11 $postData = ""; 11 $postData = "";
12 } 12 }
13 13
14 @list = split(/&/, $ENV{'QUERY_STRING'}); 14 @list = split(/&/, $ENV{'QUERY_STRING'});
15 @values; 15 @values;
16 $values{'start'} = 0; 16 $values{'start'} = 0;
17 $values{'length'} = -1; 17 $values{'length'} = -1;
18 $values{'convert_newlines'} = 0;
19 foreach $element (@list) { 18 foreach $element (@list) {
20 ($key, $value) = split(/=/, $element); 19 ($key, $value) = split(/=/, $element);
21 $values{$key} = $value; 20 $values{$key} = $value;
22 } 21 }
23 22
24 # 'items' parameter would look like: 23 # 'items' parameter would look like:
25 # <items> := <item>(','<item>)* 24 # <items> := <item>(','<item>)*
26 # <item> := <file> | <data> 25 # <item> := <file> | <data>
27 # <file> := "file":<file-path> 26 # <file> := "file":<file-path>
28 # <data> := "data":<data-string> 27 # <data> := "data":<data-string>
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 close(FILE); 63 close(FILE);
65 } 64 }
66 $readPos -= $size; 65 $readPos -= $size;
67 $expectedData .= $data; 66 $expectedData .= $data;
68 if ($remainingLength > 0) { 67 if ($remainingLength > 0) {
69 $remainingLength -= length($data); 68 $remainingLength -= length($data);
70 last if $remainingLength <= 0; 69 last if $remainingLength <= 0;
71 } 70 }
72 } 71 }
73 72
74 if ($values{'convert_newlines'}) {
75 $nativeEnding = ($Config{osname} =~ /(MSWin|cygwin)/) ? "\r\n" : "\n";
76 $postData =~ s/$nativeEnding/[NL]/g;
77 }
78
79 if ($postData eq $expectedData) { 73 if ($postData eq $expectedData) {
80 print "OK"; 74 print "OK";
81 } else { 75 } else {
82 print "FAILED"; 76 print "FAILED";
83 } 77 }
84 } else { 78 } else {
85 print "Wrong method: " . $ENV{'REQUEST_METHOD'} . "\n"; 79 print "Wrong method: " . $ENV{'REQUEST_METHOD'} . "\n";
86 } 80 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698