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

Side by Side Diff: runtime/bin/http.dart

Issue 10803033: Add the ability to get info of a Http connection, e.g. host and port. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Simplify wrapper function and fix a type. Created 8 years, 5 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 | « no previous file | runtime/bin/http_impl.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 /** 5 /**
6 * HTTP status codes. 6 * HTTP status codes.
7 */ 7 */
8 interface HttpStatus { 8 interface HttpStatus {
9 static final int CONTINUE = 100; 9 static final int CONTINUE = 100;
10 static final int SWITCHING_PROTOCOLS = 101; 10 static final int SWITCHING_PROTOCOLS = 101;
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 * Returns the input stream for the request. This is used to read 548 * Returns the input stream for the request. This is used to read
549 * the request data. 549 * the request data.
550 */ 550 */
551 InputStream get inputStream(); 551 InputStream get inputStream();
552 552
553 /** 553 /**
554 * Returns the HTTP protocol version used in the request. This will 554 * Returns the HTTP protocol version used in the request. This will
555 * be "1.0" or "1.1". 555 * be "1.0" or "1.1".
556 */ 556 */
557 String get protocolVersion(); 557 String get protocolVersion();
558
559 /**
560 * Get information about the client connection. Returns [null] if the socket
561 * isn't available.
562 */
563 HttpConnectionInfo get connectionInfo();
558 } 564 }
559 565
560 566
561 /** 567 /**
562 * HTTP response to be send back to the client. 568 * HTTP response to be send back to the client.
563 */ 569 */
564 interface HttpResponse default _HttpResponse { 570 interface HttpResponse default _HttpResponse {
565 /** 571 /**
566 * Gets and sets the content length of the response. If the size of 572 * Gets and sets the content length of the response. If the size of
567 * the response is not known in advance set the content length to 573 * the response is not known in advance set the content length to
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 618
613 /** 619 /**
614 * Detach the underlying socket from the HTTP server. When the 620 * Detach the underlying socket from the HTTP server. When the
615 * socket is detached the HTTP server will no longer perform any 621 * socket is detached the HTTP server will no longer perform any
616 * operations on it. 622 * operations on it.
617 * 623 *
618 * This is normally used when a HTTP upgrade request is received 624 * This is normally used when a HTTP upgrade request is received
619 * and the communication should continue with a different protocol. 625 * and the communication should continue with a different protocol.
620 */ 626 */
621 DetachedSocket detachSocket(); 627 DetachedSocket detachSocket();
628
629 /**
630 * Get information about the client connection. Returns [null] if the socket
631 * isn't available.
632 */
633 HttpConnectionInfo get connectionInfo();
622 } 634 }
623 635
624 636
625 /** 637 /**
626 * HTTP client factory. The [HttpClient] handles all the sockets associated 638 * HTTP client factory. The [HttpClient] handles all the sockets associated
627 * with the [HttpClientConnection]s and when the endpoint supports it, it will 639 * with the [HttpClientConnection]s and when the endpoint supports it, it will
628 * try to reuse opened sockets for several requests to support HTTP 1.1 640 * try to reuse opened sockets for several requests to support HTTP 1.1
629 * persistent connections. This means that sockets will be kept open for some 641 * persistent connections. This means that sockets will be kept open for some
630 * time after a requests have completed, unless HTTP procedures indicate that it 642 * time after a requests have completed, unless HTTP procedures indicate that it
631 * must be closed as part of completing the request. Use [:HttpClient.shutdown:] 643 * must be closed as part of completing the request. Use [:HttpClient.shutdown:]
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 761
750 /** 762 /**
751 * Detach the underlying socket from the HTTP client. When the 763 * Detach the underlying socket from the HTTP client. When the
752 * socket is detached the HTTP client will no longer perform any 764 * socket is detached the HTTP client will no longer perform any
753 * operations on it. 765 * operations on it.
754 * 766 *
755 * This is normally used when a HTTP upgrade is negotiated and the 767 * This is normally used when a HTTP upgrade is negotiated and the
756 * communication should continue with a different protocol. 768 * communication should continue with a different protocol.
757 */ 769 */
758 DetachedSocket detachSocket(); 770 DetachedSocket detachSocket();
771
772 /**
773 * Get information about the client connection. Returns [null] if the socket
774 * isn't available.
775 */
776 HttpConnectionInfo get connectionInfo();
759 } 777 }
760 778
761 779
762 /** 780 /**
763 * HTTP request for a client connection. 781 * HTTP request for a client connection.
764 */ 782 */
765 interface HttpClientRequest default _HttpClientRequest { 783 interface HttpClientRequest default _HttpClientRequest {
766 /** 784 /**
767 * Gets and sets the content length of the request. If the size of 785 * Gets and sets the content length of the request. If the size of
768 * the request is not known in advance set content length to -1, 786 * the request is not known in advance set content length to -1,
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
842 */ 860 */
843 List<Cookie> get cookies(); 861 List<Cookie> get cookies();
844 862
845 /** 863 /**
846 * Returns the input stream for the response. This is used to read 864 * Returns the input stream for the response. This is used to read
847 * the response data. 865 * the response data.
848 */ 866 */
849 InputStream get inputStream(); 867 InputStream get inputStream();
850 } 868 }
851 869
870 /**
871 * Connection information.
872 */
873 interface HttpConnectionInfo {
874 String get remoteHost();
875 int get remotePort();
876 int get localPort();
877 }
878
852 879
853 /** 880 /**
854 * Redirect information. 881 * Redirect information.
855 */ 882 */
856 interface RedirectInfo { 883 interface RedirectInfo {
857 /** 884 /**
858 * Returns the status code used for the redirect. 885 * Returns the status code used for the redirect.
859 */ 886 */
860 int get statusCode(); 887 int get statusCode();
861 888
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 class RedirectLimitExceededException extends RedirectException { 928 class RedirectLimitExceededException extends RedirectException {
902 const RedirectLimitExceededException(List<RedirectInfo> redirects) 929 const RedirectLimitExceededException(List<RedirectInfo> redirects)
903 : super("Redirect limit exceeded", redirects); 930 : super("Redirect limit exceeded", redirects);
904 } 931 }
905 932
906 933
907 class RedirectLoopException extends RedirectException { 934 class RedirectLoopException extends RedirectException {
908 const RedirectLoopException(List<RedirectInfo> redirects) 935 const RedirectLoopException(List<RedirectInfo> redirects)
909 : super("Redirect loop detected", redirects); 936 : super("Redirect loop detected", redirects);
910 } 937 }
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/http_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698