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

Side by Side Diff: sdk/lib/io/http_utils.dart

Issue 14660009: Implement support for application/x-www-form-urlencoded' form data in HttpBodyHandler. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Cleanup Created 7 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « sdk/lib/io/http_multipart_form_data_impl.dart ('k') | tests/standalone/io/http_body_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of dart.io; 5 part of dart.io;
6 6
7 class _HttpUtils { 7 class _HttpUtils {
8 static String decodeUrlEncodedString(String urlEncoded) { 8 static String decodeUrlEncodedString(String urlEncoded) {
9 // First check the string for any encoding. 9 // First check the string for any encoding.
10 int index = 0; 10 int index = 0;
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 int hour = toInt(timeList[0]); 352 int hour = toInt(timeList[0]);
353 int minute = toInt(timeList[1]); 353 int minute = toInt(timeList[1]);
354 int second = toInt(timeList[2]); 354 int second = toInt(timeList[2]);
355 if (hour > 23) error(); 355 if (hour > 23) error();
356 if (minute > 59) error(); 356 if (minute > 59) error();
357 if (second > 59) error(); 357 if (second > 59) error();
358 358
359 return new DateTime.utc(year, month, dayOfMonth, hour, minute, second, 0); 359 return new DateTime.utc(year, month, dayOfMonth, hour, minute, second, 0);
360 } 360 }
361 361
362 // Parse a string with HTTP entities. Returns null if the string ends in the 362 // Decode a string with HTTP entities. Returns null if the string ends in the
363 // middle of a http entity. 363 // middle of a http entity.
364 static String parseHttpEntityString(String input) { 364 static String decodeHttpEntityString(String input) {
365 int amp = input.lastIndexOf('&'); 365 int amp = input.lastIndexOf('&');
366 if (amp < 0) return input; 366 if (amp < 0) return input;
367 int end = input.lastIndexOf(';'); 367 int end = input.lastIndexOf(';');
368 if (end < amp) return null; 368 if (end < amp) return null;
369 369
370 var buffer = new StringBuffer(); 370 var buffer = new StringBuffer();
371 int offset = 0; 371 int offset = 0;
372 372
373 parse(amp, end) { 373 parse(amp, end) {
374 switch (input[amp + 1]) { 374 switch (input[amp + 1]) {
(...skipping 14 matching lines...) Expand all
389 while ((amp = input.indexOf('&', offset)) >= 0) { 389 while ((amp = input.indexOf('&', offset)) >= 0) {
390 buffer.write(input.substring(offset, amp)); 390 buffer.write(input.substring(offset, amp));
391 int end = input.indexOf(';', amp); 391 int end = input.indexOf(';', amp);
392 parse(amp, end); 392 parse(amp, end);
393 offset = end + 1; 393 offset = end + 1;
394 } 394 }
395 buffer.write(input.substring(offset)); 395 buffer.write(input.substring(offset));
396 return buffer.toString(); 396 return buffer.toString();
397 } 397 }
398 } 398 }
OLDNEW
« no previous file with comments | « sdk/lib/io/http_multipart_form_data_impl.dart ('k') | tests/standalone/io/http_body_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698