-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhttp_request.e
132 lines (110 loc) · 2.16 KB
/
http_request.e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
note
description: "Summary description for {HTTP_HEADER}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
HTTP_REQUEST
inherit
ANY
redefine
out,
default_create
end
create
make, default_create
feature
default_create
do
create general_headers.make (10)
create request_headers.make (10)
complete := False
end
make (meth: HTTP_METHOD)
do
set_method (meth)
end
major_version: INTEGER
minor_version: INTEGER
method: HTTP_METHOD
uri: REQUEST_URI
set_version (major, minor: INTEGER)
do
major_version := major
minor_version := minor
end
set_method (meth: HTTP_METHOD)
do
method := meth
end
set_uri (a_uri: REQUEST_URI)
require
a_uri /= Void
do
uri := a_uri
end
add_range (int: INTEGER_INTERVAL)
do
create range.make (int)
request_headers.extend (range)
end
add_accept (list: LIST [TUPLE [STRING, STRING]])
do
create accept.make (list)
request_headers.extend (accept)
end
add_accept_language (list: LIST [STRING])
do
create accept_language.make (list)
request_headers.extend (accept_language)
end
add_accept_charset (list: LIST [STRING])
do
create accept_charset.make (list)
request_headers.extend (accept_charset)
end
add_accept_encoding (list: LIST [STRING])
do
create accept_encoding.make (list)
request_headers.extend (accept_encoding)
end
add_user_agent (a_str: STRING)
do
create user_agent.make (a_str)
request_headers.extend (user_agent)
end
add_host (a_str: STRING)
do
create host.make (a_str)
request_headers.extend (host)
end
range: RANGE
accept: ACCEPT
accept_language: ACCEPT_LANGUAGE
accept_charset: ACCEPT_CHARSET
accept_encoding: ACCEPT_ENCODING
user_agent: USER_AGENT
host: HOST
general_headers: ARRAYED_LIST [GENERAL_HEADER]
request_headers: ARRAYED_LIST [REQUEST_HEADER]
set_complete
do
complete := True
end
complete: BOOLEAN
feature
out: STRING
do
Result := method.out + " " + uri.out + " HTTP/1.1%N"
across
general_headers as gc
loop
Result := Result + gc.item.out + "%N"
end
across
request_headers as rc
loop
Result := Result + rc.item.out + "%N"
end
end
end