Skip to content

Commit 7616e32

Browse files
bmwiedemannoalders
authored andcommitted
Make tests for line-endings happy
1 parent ac5f8a2 commit 7616e32

File tree

3 files changed

+62
-62
lines changed

3 files changed

+62
-62
lines changed

lib/HTTP/Cookies.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,7 @@ $key, $val, $domain, $port and $path arguments are strings. The
774774
$path_spec, $secure, $discard arguments are boolean values. The $maxage
775775
value is a number indicating number of seconds that this cookie will
776776
live. A value of $maxage <= 0 will delete this cookie. The $version argument
777-
sets the version of the cookie; the default value is 0 ( original Netscape
777+
sets the version of the cookie; the default value is 0 ( original Netscape
778778
spec ). Setting $version to another value indicates the RFC to which the
779779
cookie conforms (e.g. version 1 for RFC 2109). %rest defines various other
780780
attributes like "Comment" and "CommentURL".

t/cookies.t

Lines changed: 60 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -12,33 +12,33 @@ use HTTP::Response;
1212
# http://curl.haxx.se/rfc/cookie_spec.html
1313

1414
# Client requests a document, and receives in the response:
15-
#
15+
#
1616
# Set-Cookie: CUSTOMER=WILE_E_COYOTE; path=/; expires=Wednesday, 09-Nov-99 23:12:40 GMT
17-
#
17+
#
1818
# When client requests a URL in path "/" on this server, it sends:
19-
#
19+
#
2020
# Cookie: CUSTOMER=WILE_E_COYOTE
21-
#
21+
#
2222
# Client requests a document, and receives in the response:
23-
#
23+
#
2424
# Set-Cookie: PART_NUMBER=ROCKET_LAUNCHER_0001; path=/
25-
#
25+
#
2626
# When client requests a URL in path "/" on this server, it sends:
27-
#
27+
#
2828
# Cookie: CUSTOMER=WILE_E_COYOTE; PART_NUMBER=ROCKET_LAUNCHER_0001
29-
#
29+
#
3030
# Client receives:
31-
#
31+
#
3232
# Set-Cookie: SHIPPING=FEDEX; path=/fo
33-
#
33+
#
3434
# When client requests a URL in path "/" on this server, it sends:
35-
#
35+
#
3636
# Cookie: CUSTOMER=WILE_E_COYOTE; PART_NUMBER=ROCKET_LAUNCHER_0001
37-
#
37+
#
3838
# When client requests a URL in path "/foo" on this server, it sends:
39-
#
39+
#
4040
# Cookie: CUSTOMER=WILE_E_COYOTE; PART_NUMBER=ROCKET_LAUNCHER_0001; SHIPPING=FEDEX
41-
#
41+
#
4242
# The last Cookie is buggy, because both specifications says that the
4343
# most specific cookie must be sent first. SHIPPING=FEDEX is the
4444
# most specific and should thus be first.
@@ -98,27 +98,27 @@ print $c->as_string;
9898

9999

100100
# Second Example transaction sequence:
101-
#
101+
#
102102
# Assume all mappings from above have been cleared.
103-
#
103+
#
104104
# Client receives:
105-
#
105+
#
106106
# Set-Cookie: PART_NUMBER=ROCKET_LAUNCHER_0001; path=/
107-
#
107+
#
108108
# When client requests a URL in path "/" on this server, it sends:
109-
#
109+
#
110110
# Cookie: PART_NUMBER=ROCKET_LAUNCHER_0001
111-
#
111+
#
112112
# Client receives:
113-
#
113+
#
114114
# Set-Cookie: PART_NUMBER=RIDING_ROCKET_0023; path=/ammo
115-
#
115+
#
116116
# When client requests a URL in path "/ammo" on this server, it sends:
117-
#
117+
#
118118
# Cookie: PART_NUMBER=RIDING_ROCKET_0023; PART_NUMBER=ROCKET_LAUNCHER_0001
119-
#
119+
#
120120
# NOTE: There are two name/value pairs named "PART_NUMBER" due to
121-
# the inheritance of the "/" mapping in addition to the "/ammo" mapping.
121+
# the inheritance of the "/" mapping in addition to the "/ammo" mapping.
122122

123123
$c = HTTP::Cookies->new; # clear it
124124

@@ -164,67 +164,67 @@ ok(count_cookies($c), 0);
164164

165165
$c = HTTP::Cookies->new;
166166

167-
#
167+
#
168168
# 5.1 Example 1
169-
#
169+
#
170170
# Most detail of request and response headers has been omitted. Assume
171171
# the user agent has no stored cookies.
172-
#
172+
#
173173
# 1. User Agent -> Server
174-
#
174+
#
175175
# POST /acme/login HTTP/1.1
176176
# [form data]
177-
#
177+
#
178178
# User identifies self via a form.
179-
#
179+
#
180180
# 2. Server -> User Agent
181-
#
181+
#
182182
# HTTP/1.1 200 OK
183183
# Set-Cookie2: Customer="WILE_E_COYOTE"; Version="1"; Path="/acme"
184-
#
184+
#
185185
# Cookie reflects user's identity.
186186

187187
$cookie = interact($c, 'http://www.acme.com/acme/login',
188188
'Customer="WILE_E_COYOTE"; Version="1"; Path="/acme"');
189189
ok(!$cookie);
190190

191-
#
191+
#
192192
# 3. User Agent -> Server
193-
#
193+
#
194194
# POST /acme/pickitem HTTP/1.1
195195
# Cookie: $Version="1"; Customer="WILE_E_COYOTE"; $Path="/acme"
196196
# [form data]
197-
#
197+
#
198198
# User selects an item for ``shopping basket.''
199-
#
199+
#
200200
# 4. Server -> User Agent
201-
#
201+
#
202202
# HTTP/1.1 200 OK
203203
# Set-Cookie2: Part_Number="Rocket_Launcher_0001"; Version="1";
204204
# Path="/acme"
205-
#
205+
#
206206
# Shopping basket contains an item.
207207

208208
$cookie = interact($c, 'http://www.acme.com/acme/pickitem',
209209
'Part_Number="Rocket_Launcher_0001"; Version="1"; Path="/acme"');
210210
ok($cookie =~ m(^\$Version="?1"?; Customer="?WILE_E_COYOTE"?; \$Path="/acme"$));
211211

212-
#
212+
#
213213
# 5. User Agent -> Server
214-
#
214+
#
215215
# POST /acme/shipping HTTP/1.1
216216
# Cookie: $Version="1";
217217
# Customer="WILE_E_COYOTE"; $Path="/acme";
218218
# Part_Number="Rocket_Launcher_0001"; $Path="/acme"
219219
# [form data]
220-
#
220+
#
221221
# User selects shipping method from form.
222-
#
222+
#
223223
# 6. Server -> User Agent
224-
#
224+
#
225225
# HTTP/1.1 200 OK
226226
# Set-Cookie2: Shipping="FedEx"; Version="1"; Path="/acme"
227-
#
227+
#
228228
# New cookie reflects shipping method.
229229

230230
$cookie = interact($c, "http://www.acme.com/acme/shipping",
@@ -234,30 +234,30 @@ ok($cookie =~ /^\$Version="?1"?;/);
234234
ok($cookie =~ /Part_Number="?Rocket_Launcher_0001"?;\s*\$Path="\/acme"/);
235235
ok($cookie =~ /Customer="?WILE_E_COYOTE"?;\s*\$Path="\/acme"/);
236236

237-
#
237+
#
238238
# 7. User Agent -> Server
239-
#
239+
#
240240
# POST /acme/process HTTP/1.1
241241
# Cookie: $Version="1";
242242
# Customer="WILE_E_COYOTE"; $Path="/acme";
243243
# Part_Number="Rocket_Launcher_0001"; $Path="/acme";
244244
# Shipping="FedEx"; $Path="/acme"
245245
# [form data]
246-
#
246+
#
247247
# User chooses to process order.
248-
#
248+
#
249249
# 8. Server -> User Agent
250-
#
250+
#
251251
# HTTP/1.1 200 OK
252-
#
252+
#
253253
# Transaction is complete.
254254

255255
$cookie = interact($c, "http://www.acme.com/acme/process");
256256
print "FINAL COOKIE: $cookie\n";
257257
ok($cookie =~ /Shipping="?FedEx"?;\s*\$Path="\/acme"/);
258258
ok($cookie =~ /WILE_E_COYOTE/);
259259

260-
#
260+
#
261261
# The user agent makes a series of requests on the origin server, after
262262
# each of which it receives a new cookie. All the cookies have the same
263263
# Path attribute and (default) domain. Because the request URLs all have
@@ -268,7 +268,7 @@ print $c->as_string;
268268

269269

270270
# 5.2 Example 2
271-
#
271+
#
272272
# This example illustrates the effect of the Path attribute. All detail
273273
# of request and response headers has been omitted. Assume the user agent
274274
# has no stored cookies.
@@ -277,12 +277,12 @@ $c = HTTP::Cookies->new;
277277

278278
# Imagine the user agent has received, in response to earlier requests,
279279
# the response headers
280-
#
280+
#
281281
# Set-Cookie2: Part_Number="Rocket_Launcher_0001"; Version="1";
282282
# Path="/acme"
283-
#
283+
#
284284
# and
285-
#
285+
#
286286
# Set-Cookie2: Part_Number="Riding_Rocket_0023"; Version="1";
287287
# Path="/acme/ammo"
288288

@@ -292,11 +292,11 @@ interact($c, "http://www.acme.com/acme/ammo/specific",
292292

293293
# A subsequent request by the user agent to the (same) server for URLs of
294294
# the form /acme/ammo/... would include the following request header:
295-
#
295+
#
296296
# Cookie: $Version="1";
297297
# Part_Number="Riding_Rocket_0023"; $Path="/acme/ammo";
298298
# Part_Number="Rocket_Launcher_0001"; $Path="/acme"
299-
#
299+
#
300300
# Note that the NAME=VALUE pair for the cookie with the more specific Path
301301
# attribute, /acme/ammo, comes before the one with the less specific Path
302302
# attribute, /acme. Further note that the same cookie name appears more
@@ -307,9 +307,9 @@ ok($cookie =~ /Riding_Rocket_0023.*Rocket_Launcher_0001/);
307307

308308
# A subsequent request by the user agent to the (same) server for a URL of
309309
# the form /acme/parts/ would include the following request header:
310-
#
310+
#
311311
# Cookie: $Version="1"; Part_Number="Rocket_Launcher_0001"; $Path="/acme"
312-
#
312+
#
313313
# Here, the second cookie's Path attribute /acme/ammo is not a prefix of
314314
# the request URL, /acme/parts/, so the cookie does not get forwarded to
315315
# the server.

t/issue26.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ my $cookie_jar = HTTP::Cookies->new();
1010

1111
my $request = HTTP::Request->new(GET => 'http://www.en.com/');
1212

13-
my $response = HTTP::Response->parse
13+
my $response = HTTP::Response->parse
1414
("HTTP/1.1 302 Moved" . $CRLF . "Set-Cookie: expires=10101$CRLF$CRLF");
1515

1616
$response->request($request);

0 commit comments

Comments
 (0)