1 /*******************************************************************************
2 
3         copyright:      Copyright (c) 2004 Kris Bell. All rights reserved
4 
5         license:        BSD style: $(LICENSE)
6         
7         version:        Initial release: April 2004      
8         
9         author:         Kris
10 
11 *******************************************************************************/
12 
13 module tango.net.http.model.HttpParamsView;
14 
15 private import  tango.time.Time;
16 
17 /******************************************************************************
18 
19         Maintains a set of query parameters, parsed from an HTTP request.
20         Use HttpParams instead for output parameters.
21 
22         Note that these input params may have been encoded by the user-
23         agent. Unfortunately there has been little consensus on what that
24         encoding should be (especially regarding GET query-params). With
25         luck, that will change to a consistent usage of UTF-8 within the 
26         near future.
27 
28 ******************************************************************************/
29 
30 interface HttpParamsView 
31 {
32         /**********************************************************************
33 
34                 Return the number of headers
35 
36         **********************************************************************/
37 
38         uint size ();
39 
40         /**********************************************************************
41                 
42                 Return the value of the provided header, or null if the
43                 header does not exist
44 
45         **********************************************************************/
46 
47         const(char)[] get (const(char)[] name, const(char)[] ret = null);
48 
49         /**********************************************************************
50                 
51                 Return the integer value of the provided header, or the 
52                 provided default-value if the header does not exist
53 
54         **********************************************************************/
55 
56         int getInt (const(char)[] name, int ret = -1);
57 
58         /**********************************************************************
59                 
60                 Return the date value of the provided header, or the 
61                 provided default-value if the header does not exist
62 
63         **********************************************************************/
64 
65         Time getDate (const(char)[] name, Time ret = Time.epoch);
66 
67         /**********************************************************************
68 
69                 Output the param list to the provided consumer
70 
71         **********************************************************************/
72 
73         void produce (scope size_t delegate(const(void)[]) consume, const(char)[] eol=null);
74 }