~clint-fewbar/ubuntu/precise/erlang/merge-15b

« back to all changes in this revision

Viewing changes to lib/inets/test/httpd_1_1.erl

  • Committer: Package Import Robot
  • Author(s): Sergei Golovan
  • Date: 2011-12-15 19:20:10 UTC
  • mfrom: (1.1.18) (3.5.15 sid)
  • mto: (3.5.16 sid)
  • mto: This revision was merged to the branch mainline in revision 33.
  • Revision ID: package-import@ubuntu.com-20111215192010-jnxcfe3tbrpp0big
Tags: 1:15.b-dfsg-1
* New upstream release.
* Upload to experimental because this release breaks external drivers
  API along with ABI, so several applications are to be fixed.
* Removed SSL patch because the old SSL implementation is removed from
  the upstream distribution.
* Removed never used patch which added native code to erlang beam files.
* Removed the erlang-docbuilder binary package because the docbuilder
  application was dropped by upstream.
* Documented dropping ${erlang-docbuilder:Depends} substvar in
  erlang-depends(1) manpage.
* Made erlang-base and erlang-base-hipe provide virtual package
  erlang-abi-15.b (the number means the first erlang version, which
  provides current ABI).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
%%
2
2
%% %CopyrightBegin%
3
3
%% 
4
 
%% Copyright Ericsson AB 2005-2009. All Rights Reserved.
 
4
%% Copyright Ericsson AB 2005-2011. All Rights Reserved.
5
5
%% 
6
6
%% The contents of this file are subject to the Erlang Public License,
7
7
%% Version 1.1, (the "License"); you may not use this file except in
19
19
%%
20
20
 
21
21
-module(httpd_1_1).
22
 
-author('ingela@erix.ericsson.se').
23
22
 
24
23
-include("test_server.hrl").
25
24
-include("test_server_line.hrl").
159
158
        calendar:datetime_to_gregorian_seconds(FileInfo#file_info.mtime),
160
159
    
161
160
    Mod = httpd_util:rfc1123_date(calendar:gregorian_seconds_to_datetime(
162
 
                                      CreatedSec-1)),
163
 
 
 
161
                                      CreatedSec-1)),
 
162
    
164
163
    %% Test that we get the data when the file is modified
165
164
    ok = httpd_test_lib:verify_request(Type, Host, Port, Node, 
166
 
                                          "GET / HTTP/1.1\r\nHost:" ++ Host ++
167
 
                                          "\r\nIf-Modified-Since:" ++
168
 
                                          Mod ++ "\r\n\r\n",
169
 
                                          [{statuscode, 200}]),
170
 
     Mod1 = httpd_util:rfc1123_date(calendar:gregorian_seconds_to_datetime(
171
 
                                     CreatedSec+100)),
172
 
     ok = httpd_test_lib:verify_request(Type,Host,Port,Node, 
173
 
                                       "GET / HTTP/1.1\r\nHost:"
174
 
                                       ++ Host ++"\r\nIf-Modified-Since:"
175
 
                                       ++ Mod1 ++"\r\n\r\n",
176
 
                                       [{statuscode, 304}]),
 
165
                                       "GET / HTTP/1.1\r\nHost:" ++ Host ++
 
166
                                       "\r\nIf-Modified-Since:" ++
 
167
                                       Mod ++ "\r\n\r\n",
 
168
                                       [{statuscode, 200}]),
 
169
    Mod1 = httpd_util:rfc1123_date(calendar:gregorian_seconds_to_datetime(
 
170
                                     CreatedSec+100)),
 
171
    ok = httpd_test_lib:verify_request(Type,Host,Port,Node, 
 
172
                                       "GET / HTTP/1.1\r\nHost:"
 
173
                                       ++ Host ++"\r\nIf-Modified-Since:"
 
174
                                       ++ Mod1 ++"\r\n\r\n",
 
175
                                       [{statuscode, 304}]),
177
176
    
 
177
 
 
178
    ok = httpd_test_lib:verify_request(Type, Host, Port, Node, 
 
179
                                       "GET / HTTP/1.1\r\nHost:" ++ Host ++
 
180
                                       "\r\nIf-Modified-Since:" ++
 
181
                                       "AAA[...]AAAA" ++ "\r\n\r\n",
 
182
                                       [{statuscode, 400}]),
 
183
 
 
184
 
178
185
     Mod2 =  httpd_util:rfc1123_date(calendar:gregorian_seconds_to_datetime(
179
 
                                      CreatedSec+1)),
 
186
                                      CreatedSec+1)),
180
187
     %% Control that the If-Unmodified-Header lmits the response
181
188
     ok = httpd_test_lib:verify_request(Type,Host,Port,Node, 
182
 
                                          "GET / HTTP/1.1\r\nHost:"
183
 
                                          ++ Host ++ 
184
 
                                          "\r\nIf-Unmodified-Since:" ++ Mod2 
185
 
                                          ++ "\r\n\r\n",
186
 
                                          [{statuscode, 200}]),
 
189
                                          "GET / HTTP/1.1\r\nHost:"
 
190
                                          ++ Host ++ 
 
191
                                          "\r\nIf-Unmodified-Since:" ++ Mod2 
 
192
                                          ++ "\r\n\r\n",
 
193
                                          [{statuscode, 200}]),
187
194
     Mod3 = httpd_util:rfc1123_date(calendar:gregorian_seconds_to_datetime(
188
 
                                     CreatedSec-1)),
 
195
                                     CreatedSec-1)),
189
196
    
190
197
     ok = httpd_test_lib:verify_request(Type, Host, Port, Node, 
191
 
                                          "GET / HTTP/1.1\r\nHost:"
192
 
                                          ++ Host ++ 
193
 
                                          "\r\nIf-Unmodified-Since:"++ Mod3 
194
 
                                          ++"\r\n\r\n",
195
 
                                          [{statuscode, 412}]),
196
 
 
 
198
                                          "GET / HTTP/1.1\r\nHost:"
 
199
                                          ++ Host ++ 
 
200
                                          "\r\nIf-Unmodified-Since:"++ Mod3 
 
201
                                          ++"\r\n\r\n",
 
202
                                          [{statuscode, 412}]),
 
203
    
197
204
     %% Control that we get the body when the etag match
198
205
     ok = httpd_test_lib:verify_request(Type, Host, Port, Node, 
199
 
                                          "GET / HTTP/1.1\r\nHost:" ++ Host 
200
 
                                          ++"\r\n"++
201
 
                                          "If-Match:"++ 
202
 
                                          httpd_util:create_etag(FileInfo)++
203
 
                                          "\r\n\r\n",
204
 
                                          [{statuscode, 200}]),
 
206
                                          "GET / HTTP/1.1\r\nHost:" ++ Host 
 
207
                                          ++"\r\n"++
 
208
                                          "If-Match:"++ 
 
209
                                          httpd_util:create_etag(FileInfo)++
 
210
                                          "\r\n\r\n",
 
211
                                          [{statuscode, 200}]),
205
212
     ok = httpd_test_lib:verify_request(Type, Host, Port, Node, 
206
 
                                          "GET / HTTP/1.1\r\nHost:" ++ 
207
 
                                          Host ++ "\r\n"++
208
 
                                          "If-Match:NotEtag\r\n\r\n",
209
 
                                          [{statuscode, 412}]),
 
213
                                          "GET / HTTP/1.1\r\nHost:" ++ 
 
214
                                          Host ++ "\r\n"++
 
215
                                          "If-Match:NotEtag\r\n\r\n",
 
216
                                          [{statuscode, 412}]),
210
217
    
211
218
     %% Control the response when the if-none-match header is there
212
219
     ok = httpd_test_lib:verify_request(Type, Host, Port, Node, 
213
 
                                          "GET / HTTP/1.1\r\nHost:"
214
 
                                          ++ Host ++"\r\n"++
215
 
                                          "If-None-Match:NoTaag," ++ 
216
 
                                          httpd_util:create_etag(FileInfo) ++
217
 
                                          "\r\n\r\n",
218
 
                                          [{statuscode, 304}]),
219
 
  
 
220
                                          "GET / HTTP/1.1\r\nHost:"
 
221
                                          ++ Host ++"\r\n"++
 
222
                                          "If-None-Match:NoTaag," ++ 
 
223
                                          httpd_util:create_etag(FileInfo) ++
 
224
                                          "\r\n\r\n",
 
225
                                          [{statuscode, 304}]),
 
226
    
220
227
    ok = httpd_test_lib:verify_request(Type, Host, Port, Node, 
221
 
                                          "GET / HTTP/1.1\r\nHost:"
222
 
                                          ++ Host ++ "\r\n"++
223
 
                                          "If-None-Match:NotEtag,"
224
 
                                          "NeihterEtag\r\n\r\n",
225
 
                                          [{statuscode,200}]).
 
228
                                          "GET / HTTP/1.1\r\nHost:"
 
229
                                          ++ Host ++ "\r\n"++
 
230
                                          "If-None-Match:NotEtag,"
 
231
                                          "NeihterEtag\r\n\r\n",
 
232
                                          [{statuscode,200}]),
 
233
    ok.
226
234
    
227
235
http_trace(Type, Port, Host, Node)->
228
236
    ok = httpd_test_lib:verify_request(Type, Host, Port, Node,