File: index.xml

package info (click to toggle)
cl-drakma 2.0.10-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 428 kB
  • sloc: lisp: 2,053; xml: 1,620; makefile: 8
file content (1678 lines) | stat: -rw-r--r-- 77,435 bytes parent folder | download | duplicates (5)
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="clixdoc.xsl" ?>

<clix:documentation xmlns='http://www.w3.org/1999/xhtml' xmlns:clix='http://bknr.net/clixdoc'>
  <clix:title>Drakma - A Common Lisp HTTP client</clix:title>
  <clix:short-description>
    Drakma is a full-featured HTTP client implemented in Common Lisp.
    It knows how to handle <a href="#chunked">HTTP/1.1 chunking</a>,
    <a href="#arg-keep-alive">persistent connections</a>, <a
    href="#ex-reuse-connection">re-usable sockets</a>, <a
    href="#ex-chunked-https">SSL</a>, <a
    href="#ex-assemble-request-content">continuable uploads</a>, <a
    href="#arg-parameters">file uploads</a>, <a
    href="#arg-cookie-jar">cookies</a>, and more.
  </clix:short-description>

  <h2>Drakma - A Common Lisp HTTP client</h2>

  <blockquote>
    <clix:chapter name='abstract' title='Abstract'>
      <p>
        Drakma is a full-featured HTTP client implemented in Common
        Lisp.  It knows how to handle <a href="#chunked">HTTP/1.1
        chunking</a>, <a href="#arg-keep-alive">persistent
        connections</a>, <a href="#ex-reuse-connection">re-usable
        sockets</a>, <a href="#ex-chunked-https">SSL</a>, <a
        href="#ex-assemble-request-content">continuable uploads</a>,
        <a href="#arg-parameters">file uploads</a>, <a
        href="#arg-cookie-jar">cookies</a>, and more.
      </p>
      <p>
        The code comes with a <a
        href="http://www.opensource.org/licenses/bsd-license.php">BSD-style
        license</a> so you can basically do with it whatever you want.
      </p>
    </clix:chapter>
  </blockquote>

  <clix:chapter name='contents' title='Contents'></clix:chapter>
  <clix:contents></clix:contents>
    
  <clix:chapter name='examples' title='Examples'>

    <style type="text/css">
      body { margin-left: 2em; }
      p, blockquote { max-width: 45em; }
      pre { margin-left: 3em; margin-right: 3em; word-wrap: break-word; overflow-x: auto; background: #eee; }
      .arglist-spacer { margin-left: 6em; max-width: 45em; }
      .repl-output { color: black; }
      .repl-input { font-weight: bold; }
      .headers-out { color: SteelBlue; }
      .headers-in { color: SeaGreen; }
    </style>

    <p>
      Here is a collection of example uses of Drakma to which
      demonstrate some of its features.  In the examples, text is
      color coded to indicate where it comes from (<tt><span
      class="repl-input">REPL input</span>, <span
      class="repl-output">REPL output</span>, <span
      class="headers-out">HTTP headers sent</span></tt> and <tt><span
      class="headers-in">HTTP headers received</span></tt>).  Headers
      particularly relevant to the example at hand are shown <tt><span
      class="headers-out"><b>in</b></span> <span
      class="headers-in"><b>bold</b></span></tt>.
    </p>

    <clix:subchapter name='ex-loading' title='Loading Drakma with Quicklisp'>
      <pre><span class="repl-output">? </span><span class="repl-input">(ql:quickload :drakma)</span>
<span class="repl-output">To load "drakma":
  Load 1 ASDF system:
    drakma
; Loading "drakma"
To load "cl+ssl":
  Load 1 ASDF system:
    flexi-streams
  Install 8 Quicklisp releases:
    alexandria babel bordeaux-threads cffi cl+ssl
    trivial-features trivial-garbage trivial-gray-streams
...
; Loading "drakma"

(:DRAKMA)
</span>
</pre>
    </clix:subchapter>
    <clix:subchapter name='ex-logging' title='Log headers to the REPL output stream'>
      <p>
        In some of the following examples, the headers exchanged
        between Drakma and the HTTP server should be shown, for
        illustration purposes.  This can be achieved like so:
      </p>
      <pre><span class="repl-output">? </span><span class="repl-input">(setf drakma:*header-stream* *standard-output*)</span>
<span class="repl-output">#&lt;SYNONYM-STREAM to *TERMINAL-IO* #x3020006AC7DD&gt;</span>
</pre>
    </clix:subchapter>
    <clix:subchapter name='ex-request-redirect' title='Requesting a page with redirection'>
      <p>
        Request a page.  Note how Drakma automatically follows the 301
        redirect and how the fourth return value shows the
        <em>new</em> URI.
      </p>
<pre><span class="repl-output">? </span><span class="repl-input">(<a href="#http-request">drakma:http-request</a> "http://lisp.org/")</span>
<span class="headers-out">GET / HTTP/1.1
Host: lisp.org
User-Agent: Drakma/1.3.0 (Clozure Common Lisp Version 1.8-r15286M  (DarwinX8664); Darwin; 12.2.0; http://weitz.de/drakma/)
Accept: */*
Connection: close
</span>
<span class="headers-in">HTTP/1.1 <b>307  Temporary Redirect</b>
Date: Sun, 09 Dec 2012 08:01:56 GMT
Connection: Close
Server: AllegroServe/1.2.65
Transfer-Encoding: chunked
<b>LOCATION: http://lisp.org/index.html</b>
</span>
<span class="headers-out"><b>GET /index.html HTTP/1.1</b>
Host: lisp.org
User-Agent: Drakma/1.3.0 (Clozure Common Lisp Version 1.8-r15286M  (DarwinX8664); Darwin; 12.2.0; http://weitz.de/drakma/)
Accept: */*
Connection: close
</span>
<span class="headers-in">HTTP/1.1 200  OK
Date: Sun, 09 Dec 2012 08:01:56 GMT
Connection: Close
Server: AllegroServe/1.2.65
Content-Type: text/html
Content-Length: 459
LAST-MODIFIED: Wed, 26 Oct 2011 02:26:26 GMT
</span>
<span class="repl-output">"&lt;HTML&gt;
&lt;HEAD&gt;
  &lt;title&gt;John McCarthy, 1927-2011&lt;/title&gt;
  &lt;STYLE type=\"text/css\"&gt;
    BODY {text-align: center}
  &lt;/STYLE&gt;
&lt;/HEAD&gt;
&lt;BODY&gt;
&lt;h1&gt;John McCarthy&lt;/h1&gt;
&lt;img src=\"jmccolor.jpg\" alt=\"a picture of John McCarthy, from his website\"/&gt;
&lt;h3&gt;1927-2011&lt;/h3&gt;
&lt;br&gt;&lt;br&gt;
&lt;a href=\"http://www-formal.stanford.edu/jmc/\"&gt;John McCarthy's Home Page&lt;/a&gt;&lt;br&gt;
&lt;a href=\"http://news.stanford.edu/news/2011/october/john-mccarthy-obit-102511.html\"&gt;Obituary&lt;/a&gt;
&lt;/BODY&gt;
&lt;/HTML&gt;
"
200
((:DATE . "Sun, 09 Dec 2012 08:01:56 GMT") (:CONNECTION . "Close") (:SERVER . "AllegroServe/1.2.65")
 (:CONTENT-TYPE . "text/html") (:CONTENT-LENGTH . "459") (:LAST-MODIFIED . "Wed, 26 Oct 2011 02:26:26 GMT"))
#&lt;URI http://lisp.org/index.html&gt;
#&lt;FLEXI-STREAMS:FLEXI-IO-STREAM #x30200155DB1D&gt;
T
" OK"</span>
</pre>
    </clix:subchapter>
    <clix:subchapter name='ex-charsets' title='Requesting a page containing non-ASCII characters'>
      <p>
        Drakma automatically interprets the 'charset=utf-8' part
        correctly.
      </p>
      <pre><span class="repl-output">? </span><span class="repl-input">(subseq (<a href="#http-request">drakma:http-request</a> "http://www.cl.cam.ac.uk/~mgk25/ucs/examples/digraphs.txt") 0 298)</span>
<span class="headers-out">GET /~mgk25/ucs/examples/digraphs.txt HTTP/1.1
Host: www.cl.cam.ac.uk
User-Agent: Drakma/1.3.0 (Clozure Common Lisp Version 1.8-r15286M  (DarwinX8664); Darwin; 12.2.0; http://weitz.de/drakma/)
Accept: */*
Connection: close
</span>
<span class="headers-in">HTTP/1.1 200 OK
Date: Sun, 09 Dec 2012 08:15:04 GMT
Server: Apache/2.2.3 (CentOS)
Last-Modified: Mon, 06 Apr 2009 18:13:43 GMT
ETag: "17cd62-298-466e6dbcd03c0"
Accept-Ranges: bytes
Content-Length: 664
X-UA-Compatible: IE=edge
Connection: close
<b>Content-Type: text/plain; charset=utf-8</b>
</span>
<span class="repl-output">"Latin Digraphs and Ligatures in ISO10646-1

A short table of ligatures and digraphs follows. Some of these may not be
ligatures/digraphs in the technical sense, (for example, æ is a seperate
letter in English), but visually they behave that way.

AÆE : U+00C6
aæe : U+00E6
ſßs : U+00DF
IIJJ : U+0132"</span>
</pre>
    </clix:subchapter>
    <clix:subchapter name='ex-binary-data' title='Requesting binary data'>
      <p>
        For non-textual content types, a vector of octets is returned.
      </p>
      <pre><span class="repl-output">? </span><span class="repl-input">(<a href="#http-request">drakma:http-request</a> "https://api.github.com/repos/edicl/drakma/git/tags/tag-does-not-exist")</span>
<span class="headers-out">GET /repos/edicl/drakma/git/tags/tag-does-not-exist HTTP/1.1
Host: api.github.com
User-Agent: Drakma/1.3.0 (SBCL 1.1.1.31.master.2-9fac43f-dirty; Darwin; 12.2.0; http://weitz.de/drakma/)
Accept: */*
Connection: close
</span>
<span class="headers-in">HTTP/1.1 404 Not Found
Server: nginx
Date: Fri, 28 Dec 2012 08:37:31 GMT
<b>Content-Type: application/json; charset=utf-8</b>
Connection: close
Status: 404 Not Found
X-GitHub-Media-Type: github.beta
X-RateLimit-Remaining: 48
X-RateLimit-Limit: 60
Content-Length: 23
X-Content-Type-Options: nosniff
Cache-Control: 
</span>
<span class="repl-output">#(123 34 109 101 115 115 97 103 101 34 58 34 78 111 116 32 70 111 117 110 100 34 125)
404
((:SERVER . "nginx") (:DATE . "Fri, 28 Dec 2012 08:37:31 GMT") (:CONTENT-TYPE . "application/json; charset=utf-8")
 (:CONNECTION . "close") (:STATUS . "404 Not Found") (:X-GITHUB-MEDIA-TYPE . "github.beta") (:X-RATELIMIT-REMAINING . "48")
 (:X-RATELIMIT-LIMIT . "60") (:CONTENT-LENGTH . "23") (:X-CONTENT-TYPE-OPTIONS . "nosniff") (:CACHE-CONTROL . ""))
#&lt;PURI:URI https://api.github.com/repos/edicl/drakma/git/tags/tag-does-not-exist&gt;
#&lt;FLEXI-STREAMS:FLEXI-IO-STREAM {101C40C043}&gt;
T
"Not Found"</span>
<span class="repl-output">? </span><span class="repl-input">(<a href="http://weitz.de/flexi-streams/#octets-to-string" target="_new">flexi-streams:octets-to-string</a> *)</span>
<span class="repl-output">"{\"message\":\"Not Found\"}"</span></pre>
    </clix:subchapter>
    <clix:subchapter name='ex-chunked-https' title='Chunked transfers and HTTPS'>
      <p>
        Request a page using the HTTPS protocol.  Also note that the
        server uses <a name="chunked"
        href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.6.1">chunked
        transfer encoding</a> for its reply
      </p>
      <pre><span class="repl-output">? </span><span class="repl-input">(ql:quickload :cl-ppcre)</span>
<span class="repl-output">? </span><span class="repl-input">(cl-ppcre:scan-to-strings "(?s)You have.*your data."
                            (<a href="#http-request">drakma:http-request</a> "https://www.fortify.net/cgi/ssl_2.pl"))</span>
<span class="headers-out">GET /cgi/ssl_2.pl HTTP/1.1
Host: www.fortify.net
User-Agent: Drakma/1.3.0 (Clozure Common Lisp Version 1.8-r15286M  (DarwinX8664); Darwin; 12.2.0; http://weitz.de/drakma/)
Accept: */*
Connection: close
</span>
<span class="headers-in">HTTP/1.1 200 OK
Date: Sun, 09 Dec 2012 08:15:31 GMT
Server: Apache
Connection: close
<b>Transfer-Encoding: chunked</b>
Content-Type: text/html
</span>
<span class="repl-output">"You have connected to this web server using the RC4-SHA encryption cipher
 with a key length of 128 bits.
 &lt;p&gt;
 This is a high-grade encryption connection, regarded by most experts as being suitable
 for sending or receiving even the most sensitive or valuable information
 across a network.
 &lt;p&gt;
 In a crude analogy, using this cipher is similar to sending or storing your data inside
 a high quality safe - compared to an export-grade cipher which is similar to using
 a paper envelope to protect your data."
#()</span>
</pre>
    </clix:subchapter>
    <clix:subchapter name='ex-fake-ua' title='Faking a user agent header'>
      <p>
        Some servers adapt their behavior according to the Browser
        that is used.  Drakma can claim to be i.e. MS Internet
        Explorer.
      </p>
      <pre><span class="repl-output">? </span><span class="repl-input">(cl-ppcre:scan-to-strings "&lt;h4&gt;.*" (<a href="#http-request">drakma:http-request</a> "http://whatsmyuseragent.com/" <a href="#arg-user-agent">:user-agent :explorer</a>))</span>
<span class="headers-out">GET / HTTP/1.1
Host: whatsmyuseragent.com
<b>User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)</b>
Accept: */*
Connection: close
</span>
<span class="headers-in">HTTP/1.1 200 OK
Date: Sun, 09 Dec 2012 08:23:50 GMT
Server: Apache
X-Powered-By: PHP/5.2.17
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html
</span>
<span class="repl-output">"&lt;h4&gt;Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)&lt;/h4&gt;"
#()</span>
</pre>
    </clix:subchapter>
    <clix:subchapter name='ex-post-and-cookie' title='Posting data and using cookies'>
      <p>
        Drakma can send parameters in a POST request and knows how to
        deal with <a href="#cookie">cookies</a>.  Note how Drakma
        sends the cookie back in the second request.
      </p>
      <pre><span class="repl-output">? </span><span class="repl-input">(let ((cookie-jar (make-instance <a href="#cookie-jar">'drakma:cookie-jar</a>)))
    (<a href="#http-request">drakma:http-request</a> "http://www.phpsecurepages.com/test/test.php"
                         <a href="#arg-method">:method :post</a>
                         <a href="#arg-parameters">:parameters '(("entered_login" . "test")
                                       ("entered_password" . "test"))</a>
                         <a href="#arg-cookie-jar">:cookie-jar cookie-jar</a>)
    (<a href="#http-request">drakma:http-request</a> "http://www.phpsecurepages.com/test/test2.php"
                         <a href="#arg-cookie-jar">:cookie-jar cookie-jar</a>)
    (<a href="#cookie-jar-cookies">drakma:cookie-jar-cookies</a> cookie-jar))</span>
<span class="headers-out">POST /test/test.php HTTP/1.1
Host: www.phpsecurepages.com
User-Agent: Drakma/1.3.0 (Clozure Common Lisp Version 1.8-r15286M  (DarwinX8664); Darwin; 12.2.0; http://weitz.de/drakma/)
Accept: */*
Connection: close
Content-Type: application/x-www-form-urlencoded
Content-Length: 40
</span>
<span class="headers-in">HTTP/1.1 200 OK
Date: Sun, 09 Dec 2012 08:25:13 GMT
Server:  
X-Powered-By: PHP/5.2.17
<b>Set-Cookie: PHPSESSID=vijk3706eojs7n8u5cdpi3ju05; path=/</b>
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
X-Powered-By: PleskLin
Content-Length: 4479
Connection: close
Content-Type: text/html
</span>
<span class="headers-out">GET /test/test2.php HTTP/1.1
Host: www.phpsecurepages.com
User-Agent: Drakma/1.3.0 (Clozure Common Lisp Version 1.8-r15286M  (DarwinX8664); Darwin; 12.2.0; http://weitz.de/drakma/)
Accept: */*
<b>Cookie: PHPSESSID=vijk3706eojs7n8u5cdpi3ju05</b>
Connection: close
</span>
<span class="headers-in">HTTP/1.1 200 OK
Date: Sun, 09 Dec 2012 08:25:16 GMT
Server:  
X-Powered-By: PHP/5.2.17
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
X-Powered-By: PleskLin
Content-Length: 4479
Connection: close
Content-Type: text/html
</span>
<span class="repl-output">(#&lt;COOKIE PHPSESSID=vijk3706eojs7n8u5cdpi3ju05; path=/; domain=www.phpsecurepages.com&gt;)</span>
</pre>
    </clix:subchapter>
    <clix:subchapter name='ex-reuse-connection' title='Reusing a connection to a server'>
      <p>
        Drakma can <a name="re-use">use</a> a connection to a server for multiple requests.
      </p>
      <pre><span class="repl-output">? </span><span class="repl-input">(let ((stream (nth-value 4 (<a href="#http-request">drakma:http-request</a> "http://www.lispworks.com/" <a href="#arg-close">:close nil</a>))))
    (nth-value 2 (<a href="#http-request">drakma:http-request</a> "http://www.lispworks.com/success-stories/index.html"
                                      <a href="#arg-stream">:stream stream</a>)))</span>
<span class="headers-out">GET / HTTP/1.1
Host: www.lispworks.com
User-Agent: Drakma/1.3.0 (Clozure Common Lisp Version 1.8-r15286M  (DarwinX8664); Darwin; 12.2.0; http://weitz.de/drakma/)
Accept: */*
</span>
<span class="headers-in">HTTP/1.1 200 OK
Date: Sun, 09 Dec 2012 08:25:56 GMT
Server: Apache/2.2.22 (Unix) mod_ssl/2.2.22 OpenSSL/1.0.1c mod_apreq2-20051231/2.6.0 mod_perl/2.0.5 Perl/v5.8.9
Last-Modified: Tue, 20 Nov 2012 12:27:40 GMT
ETag: "336280-28eb-4ceec5c1f4700"
Accept-Ranges: bytes
Content-Length: 10475
Content-Type: text/html
</span>
<span class="headers-out">GET /success-stories/index.html HTTP/1.1
Host: www.lispworks.com
User-Agent: Drakma/1.3.0 (Clozure Common Lisp Version 1.8-r15286M  (DarwinX8664); Darwin; 12.2.0; http://weitz.de/drakma/)
Accept: */*
<b>Connection: close</b>
</span>
<span class="headers-in">HTTP/1.1 200 OK
Date: Sun, 09 Dec 2012 08:25:56 GMT
Server: Apache/2.2.22 (Unix) mod_ssl/2.2.22 OpenSSL/1.0.1c mod_apreq2-20051231/2.6.0 mod_perl/2.0.5 Perl/v5.8.9
Last-Modified: Tue, 20 Nov 2012 12:28:52 GMT
ETag: "336386-2940-4ceec6069e900"
Accept-Ranges: bytes
Content-Length: 10560
<b>Connection: close</b>
Content-Type: text/html
</span>
<span class="repl-output">((:DATE . "Sun, 09 Dec 2012 08:25:56 GMT")
 (:SERVER . "Apache/2.2.22 (Unix) mod_ssl/2.2.22 OpenSSL/1.0.1c mod_apreq2-20051231/2.6.0 mod_perl/2.0.5 Perl/v5.8.9")
 (:LAST-MODIFIED . "Tue, 20 Nov 2012 12:28:52 GMT") (:ETAG . "\"336386-2940-4ceec6069e900\"") (:ACCEPT-RANGES . "bytes")
 (:CONTENT-LENGTH . "10560") (:CONNECTION . "close") (:CONTENT-TYPE . "text/html"))</span>
</pre>
    </clix:subchapter>
    <clix:subchapter name='ex-basic-auth' title='Basic Authorization'>
      <p>
        Drakma supports basic authorization.  In this example, we use
        a locally running <a
        href="http://weitz.de/hunchentoot">Hunchentoot</a> server.
      </p>
      <pre><span class="repl-output">? </span><span class="repl-input">(ql:quickload :hunchentoot-test)</span>
<span class="repl-output">To load "hunchentoot-test":
  Load 4 ASDF systems:
    cl-ppcre cl-who drakma hunchentoot
  Install 1 Quicklisp release:
    hunchentoot
...
; Loading "hunchentoot-test"

(:HUNCHENTOOT-TEST)
? </span><span class="repl-input">(hunchentoot:start (make-instance 'hunchentoot:easy-acceptor :port 4242))</span>
<span class="repl-output">#&lt;EASY-ACCEPTOR (host *, port 4242)&gt;
? </span><span class="repl-input">(nth-value 1 (<a href="#http-request">drakma:http-request</a> "http://localhost:4242/hunchentoot/test/authorization.html"))</span>
<span class="headers-out">GET /hunchentoot/test/authorization.html HTTP/1.1
Host: localhost:4242
User-Agent: Drakma/1.3.0 (Clozure Common Lisp Version 1.8-r15286M  (DarwinX8664); Darwin; 12.2.0; http://weitz.de/drakma/)
Accept: */*
Connection: close
</span>
<span class="repl-output">127.0.0.1 - [2012-12-09 09:27:40] "GET /hunchentoot/test/authorization.html HTTP/1.1" 401 543 "-" "Drakma/1.3.0 (Clozure Common Lisp Version 1.8-r15286M  (DarwinX8664); Darwin; 12.2.0; http://weitz.de/drakma/)"</span>
<span class="headers-in">HTTP/1.1 <b>401 Authorization Required</b>
Content-Length: 543
Date: Sun, 09 Dec 2012 08:27:40 GMT
Server: Hunchentoot 1.2.5
Connection: Close
Www-Authenticate: Basic realm="Hunchentoot"
Content-Type: text/html; charset=iso-8859-1
</span>
<span class="repl-output">401
? </span><span class="repl-input">(nth-value 1 (<a href="#http-request">drakma:http-request</a> "http://localhost:4242/hunchentoot/test/authorization.html"
                                    <a href="#arg-basic-authorization">:basic-authorization '("nanook" "igloo")</a>))</span>
<span class="headers-out">GET /hunchentoot/test/authorization.html HTTP/1.1
Host: localhost:4242
User-Agent: Drakma/1.3.0 (Clozure Common Lisp Version 1.8-r15286M  (DarwinX8664); Darwin; 12.2.0; http://weitz.de/drakma/)
<b>Authorization: Basic bmFub29rOmlnbG9v</b>
Accept: */*
Connection: close
</span>
<span class="repl-output">127.0.0.1 nanook [2012-12-09 09:28:15] "GET /hunchentoot/test/authorization.html HTTP/1.1" 200 907 "-" "Drakma/1.3.0 (Clozure Common Lisp Version 1.8-r15286M  (DarwinX8664); Darwin; 12.2.0; http://weitz.de/drakma/)"</span>
<span class="headers-in">HTTP/1.1 200 OK
Content-Length: 907
Date: Sun, 09 Dec 2012 08:28:15 GMT
Server: Hunchentoot 1.2.5
Connection: Close
Content-Type: text/html; charset=utf-8
</span>
<span class="repl-output">200</span>
</pre>
    </clix:subchapter>
    <clix:subchapter name='ex-response-stream' title='Reading the response from a stream'>
      <p>
        Drakma can return a stream to the application so that the
        reply is not completely buffered in memory first.
      </p>
      <pre><span class="repl-output">? </span><span class="repl-input">(let ((stream (<a href="#http-request">drakma:http-request</a> "https://api.github.com/orgs/edicl/public_members"
                                      <b>:want-stream t</b>)))
    (setf (<a href="http://weitz.de/flexi-streams/#flexi-stream-external-format" target="_new">flexi-streams:flexi-stream-external-format</a> stream) :utf-8)
    (<a href="http://common-lisp.net/project/yason/#parse" target="_new">yason:parse</a> stream :object-as :plist))</span>
<span class="headers-out">GET /orgs/edicl/public_members HTTP/1.1
Host: api.github.com
User-Agent: Drakma/1.3.0 (SBCL 1.1.1.31.master.2-9fac43f-dirty; Darwin; 12.2.0; http://weitz.de/drakma/)
Accept: */*
Connection: close
</span>
<span class="headers-in">HTTP/1.1 200 OK
Server: nginx
Date: Fri, 28 Dec 2012 10:27:34 GMT
Content-Type: application/json; charset=utf-8
Connection: close
Status: 200 OK
Last-Modified: Sat, 22 Dec 2012 18:39:14 GMT
X-Content-Type-Options: nosniff
X-RateLimit-Limit: 60
X-GitHub-Media-Type: github.beta
Vary: Accept
Content-Length: 1899
Cache-Control: public, max-age=60, s-maxage=60
ETag: "66a5dd35e79146a53029a1807293f9d3"
X-RateLimit-Remaining: 56
</span>
<span class="repl-output">(("type" "User" "repos_url" "https://api.github.com/users/hanshuebner/repos" "followers_url"
  "https://api.github.com/users/hanshuebner/followers" "login" "hanshuebner" "gists_url"
  "https://api.github.com/users/hanshuebner/gists{/gist_id}" "following_url"
  "https://api.github.com/users/hanshuebner/following" "events_url"
  "https://api.github.com/users/hanshuebner/events{/privacy}" "organizations_url"
  "https://api.github.com/users/hanshuebner/orgs" "received_events_url"
  "https://api.github.com/users/hanshuebner/received_events" "url"
  "https://api.github.com/users/hanshuebner" "avatar_url"
  "https://secure.gravatar.com/avatar/280d76aa82179ae04550534649de1e6e?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png"
  "subscriptions_url" "https://api.github.com/users/hanshuebner/subscriptions" "starred_url"
  "https://api.github.com/users/hanshuebner/starred{/owner}{/repo}" "id" 108751 "gravatar_id"
  "280d76aa82179ae04550534649de1e6e")
 ("type" "User" "repos_url" "https://api.github.com/users/nhabedi/repos" "followers_url"
  "https://api.github.com/users/nhabedi/followers" "login" "nhabedi" "gists_url"
  "https://api.github.com/users/nhabedi/gists{/gist_id}" "following_url"
  "https://api.github.com/users/nhabedi/following" "events_url"
  "https://api.github.com/users/nhabedi/events{/privacy}" "organizations_url"
  "https://api.github.com/users/nhabedi/orgs" "received_events_url"
  "https://api.github.com/users/nhabedi/received_events" "url"
  "https://api.github.com/users/nhabedi" "avatar_url"
  "https://secure.gravatar.com/avatar/24c09c7b0b2c0481283d854bacdd7926?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png"
  "subscriptions_url" "https://api.github.com/users/nhabedi/subscriptions" "starred_url"
  "https://api.github.com/users/nhabedi/starred{/owner}{/repo}" "id" 537618 "gravatar_id"
  "24c09c7b0b2c0481283d854bacdd7926"))</span>
</pre>
    </clix:subchapter>
    <clix:subchapter name='ex-assemble-request-content' title='Piecemeal assembly of request contents'>
      <p>
        Request contents can be assembled from various sources, and
        chunked encoding can be used by request bodies.  Many servers
        do not support chunked encoding for request bodies, though.
      </p>
      <pre><span class="repl-output">? </span><span class="repl-input">(let ((temp-file (ensure-directories-exist #p"/tmp/quux.txt"))
        (continuation (<a href="#http-request">drakma:http-request</a> "http://localhost:4242/hunchentoot/test/parameter_latin1_post.html"
                                           <a href="#arg-method">:method :post</a>
                                           <a href="#arg-content">:content :continuation</a>)))
    (funcall continuation "foo=" t)
    (funcall continuation (list (char-code #\z) (char-code #\a)) t)
    (funcall continuation (lambda (stream)
                            (write-char #\p stream)) t)
    (with-open-file (out temp-file
                         :direction :output
                         :if-does-not-exist :create
                         :if-exists :supersede)
      (write-string "p" out))
    (funcall continuation temp-file t)
    (cl-ppcre:scan-to-strings "zappzerapp" (funcall continuation "zerapp")))</span>
<span class="headers-out">POST /hunchentoot/test/parameter_latin1_post.html HTTP/1.1
Host: localhost:4242
User-Agent: Drakma/1.3.0 (Clozure Common Lisp Version 1.8-r15286M  (DarwinX8664); Darwin; 12.2.0; http://weitz.de/drakma/)
Accept: */*
Connection: close
Content-Type: application/x-www-form-urlencoded
<b>Transfer-Encoding: chunked</b>
</span>
<span class="repl-output">127.0.0.1 - [2012-12-09 10:06:44] "POST /hunchentoot/test/parameter_latin1_post.html HTTP/1.1" 200 1312 "-" "Drakma/1.3.0 (Clozure Common Lisp Version 1.8-r15286M  (DarwinX8664); Darwin; 12.2.0; http://weitz.de/drakma/)"</span>
<span class="headers-in">HTTP/1.1 200 OK
Content-Length: 1312
Date: Sun, 09 Dec 2012 09:06:44 GMT
Server: Hunchentoot 1.2.5
Connection: Close
Last-Modified: Sun, 09 Dec 2012 09:06:44 GMT
Pragma: no-cache
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Expires: Mon, 26 Jul 1997 05:00:00 GMT
Content-Type: text/html; charset=ISO-8859-1
</span>
<span class="repl-output">"zappzerapp"
#()</span>
</pre>
    </clix:subchapter>
    <clix:subchapter name='ex-partial-transfers' title='Partial transfers'>
      <p>
        <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35"
           target="_new">Partial transfers</a> of resources are possible.
      </p>
      <pre><span class="repl-output">? </span><span class="repl-input">(cl-ppcre:regex-replace-all
   "&lt;.*?&gt;"
   (format nil "~A~%~A"
           (<a href="#http-request">drakma:http-request</a> "http://members.shaw.ca/mitb/hunchentoot.html"
                                <a href="#arg-range">:range '(998 1034)</a>)
           (<a href="#http-request">drakma:http-request</a> "http://members.shaw.ca/mitb/hunchentoot.html"
                                <a href="#arg-range">:range '(1213 1249)</a>))
   "")</span>
<span class="headers-out">GET /mitb/hunchentoot.html HTTP/1.1
Host: members.shaw.ca
User-Agent: Drakma/1.3.0 (Clozure Common Lisp Version 1.8-r15286M  (DarwinX8664); Darwin; 12.2.0; http://weitz.de/drakma/)
Accept: */*
Connection: close
<b>Range: bytes=998-1034</b>
</span>
<span class="headers-in">HTTP/1.1 206 Partial Content
Date: Sun, 09 Dec 2012 09:16:16 GMT
Server: Apache/2.2.20 (Unix) mod_ldap_userdir/1.1.17
Last-Modified: Wed, 14 Mar 2012 23:22:04 GMT
ETag: "3b7eed-3238-4bb3c3e453f00"
Accept-Ranges: bytes
Content-Length: 37
<b>Content-Range: bytes 998-1034/12856</b>
Content-Type: text/html
Connection: close
</span>
<span class="headers-out">GET /mitb/hunchentoot.html HTTP/1.1
Host: members.shaw.ca
User-Agent: Drakma/1.3.0 (Clozure Common Lisp Version 1.8-r15286M  (DarwinX8664); Darwin; 12.2.0; http://weitz.de/drakma/)
Accept: */*
Connection: close
<b>Range: bytes=1213-1249</b>
</span>
<span class="headers-in">HTTP/1.1 206 Partial Content
Date: Sun, 09 Dec 2012 09:16:16 GMT
Server: Apache/2.2.20 (Unix) mod_ldap_userdir/1.1.17
Last-Modified: Wed, 14 Mar 2012 23:22:04 GMT
ETag: "3b7eed-3238-4bb3c3e453f00"
Accept-Ranges: bytes
Content-Length: 37
<b>Content-Range: bytes 1213-1249/12856</b>
Content-Type: text/html
</span>
<span class="repl-output">"DRAKMA (Queen of Cosmic Greed)
HUNCHENTOOT (The Giant Spider)"
T</span>
</pre>
    </clix:subchapter>
  </clix:chapter>

  <clix:chapter name="install" title="Download and Installation">
    <p>
      Drakma depends on a number of open source libraries, so the
      preferred method to download, compile and load it is via <a
      href="http://www.quicklisp.org/">Quicklisp</a>.  Drakma's
      current version number is <clix:library-version/>.
    </p>
    <p>
      The canonical location for the latest version of Drakma is <a
      href="http://weitz.de/files/drakma.tar.gz">http://weitz.de/files/drakma.tar.gz</a>.
    </p>
  </clix:chapter>

  <clix:chapter name="patches" title="Development and patches">
    <p>
      The development version of Drakma can be found <a
      href="https://github.com/edicl/drakma" target="_new">on
      github</a>.  Please use the github issue tracking system to
      submit bug reports.  Patches are welcome, please use <a
      href="https://github.com/edicl/drakma/pulls">GitHub pull
      requests</a>.  If you want to make a change, please <a
      href="http://weitz.de/patches.html" target="_new">read this
      first</a>.
    </p>
  </clix:chapter>

  <clix:chapter name="dictionary" title="The Drakma dictionary">

    <clix:subchapter name="dict-request" title="Requests">

      <p>
        The <clix:ref>HTTP-REQUEST</clix:ref> function is the heart of
        Drakma.  It is used to send requests to web servers and will
        either return the message body of the server's reply or (if
        the user so wishes) a stream one can read from.  The wealth of
        keyword parameters might look a bit intimidating first, but
        you will rarely need more than two or three of them - the
        default behavior of Drakma is (hopefully) designed to do The
        Right Thing[TM] in most cases.
      </p>
      <p>
        You can use the <clix:ref>*HEADER-STREAM*</clix:ref> variable
        to debug requests handled by Drakma in a way similar to <a
        href="http://livehttpheaders.mozdev.org/">LiveHTTPHeaders</a>.
      </p>

      <clix:function name="http-request">
        <clix:special-definition>
          [Function]<br/>
          <b>http-request</b> <i>uri</i><div class="arglist-spacer">&amp;rest args</div>
          <div class="arglist-spacer">&amp;key
            <a href="#arg-protocol">protocol</a>
            <a href="#arg-method">method</a>
            <a href="#arg-force-ssl">force-ssl</a>
            <a href="#arg-certificate">certificate</a>
            <a href="#arg-key">key</a>
            <a href="#arg-certificate-password">certificate-password</a>
            <a href="#arg-verify">verify</a>
            <a href="#arg-max-depth">max-depth</a>
            <a href="#arg-ca-file">ca-file</a>
            <a href="#arg-ca-directory">ca-directory</a>
            <a href="#arg-parameters">parameters</a>
            <a href="#arg-url-encoder">url-encoder</a>
            <a href="#arg-content">content</a>
            <a href="#arg-content-type">content-type</a>
            <a href="#arg-content-length">content-length</a>
            <a href="#arg-form-data">form-data</a>
            <a href="#arg-cookie-jar">cookie-jar</a>
            <a href="#arg-basic-authorization">basic-authorization</a>
            <a href="#arg-user-agent">user-agent</a>
            <a href="#arg-accept">accept</a>
            <a href="#arg-range">range</a>
            <a href="#arg-proxy">proxy</a>
            <a href="#arg-proxy-basic-authorization">proxy-basic-authorization</a>
            <a href="#arg-real-host">real-host</a>
            <a href="#arg-additional-headers">additional-headers</a>
            <a href="#arg-redirect">redirect</a>
            <a href="#arg-auto-referer">auto-referer</a>
            <a href="#arg-keep-alive">keep-alive</a>
            <a href="#arg-close">close</a>
            <a href="#arg-external-format-out">external-format-out</a>
            <a href="#arg-external-format-in">external-format-in</a>
            <a href="#arg-force-binary">force-binary</a>
            <a href="#arg-want-stream">want-stream</a>
            <a href="#arg-stream">stream</a>
            <a href="#arg-preserve-uri">preserve-uri</a>
            <a href="#arg-connection-timeout">connection-timeout</a>
            <a href="#arg-deadline">deadline</a>
          </div>
          <div class="arglist-spacer">
            =&gt; body-or-stream<sup>0</sup>, status-code<sup>1</sup>,
            headers<sup>2</sup>, uri<sup>3</sup>, stream<sup>4</sup>,
            <a href="#arg-want-stream">must-close<sup>5</sup></a>,
            reason-phrase<sup>6</sup>
          </div>
        </clix:special-definition>
        <clix:description>
          <p>
            Sends an <a
            href="http://www.w3.org/Protocols/rfc2616/rfc2616.html">HTTP</a>
            request to a web server and returns its reply.
            <clix:arg>uri</clix:arg> is where the request is sent to,
            and it is either a string denoting a uniform resource
            identifier or a <code>PURI:URI</code> object.  The scheme
            of <clix:arg>uri</clix:arg> must be `http' or `https'.
            The function returns SEVEN values - the body of the
            reply<sup>0</sup> (but see below), the status
            code<sup>1</sup> as an integer, an alist of the
            headers<sup>2</sup> sent by the server where for each
            element the car (the name of the header) is a keyword and
            the cdr (the value of the header) is a string, the
            uri<sup>3</sup> the reply comes from (which might be
            different from the <clix:arg>uri</clix:arg> the request
            was sent to in case of redirects), the stream<sup>4</sup>
            the reply was read from, a generalized boolean<sup>5</sup>
            which denotes whether the stream should be closed (and
            which you can usually ignore), and finally the reason
            phrase<sup>6</sup> from the status line as a string.
          </p>
          <p>
            <a name="arg-protocol"/>
            <clix:arg>protocol</clix:arg> is the HTTP protocol version
            which is going to be used in the request line.  It must be
            one of the keywords <code>:HTTP/1.0</code> or
            <code>:HTTP/1.1</code>.
          </p>
          <p>
            <a name="arg-method"/>
            <clix:arg>method</clix:arg> is the method used in the
            request line, a keyword (like <code>:GET</code> or
            <code>:HEAD</code>) denoting a valid HTTP/1.1 or WebDAV
            request method, or <code>:REPORT</code>, as described in
            the Versioning Extensions to WebDAV.  Additionally, you
            can also use the pseudo method <code>:OPTIONS*</code>
            which is like <code>:OPTIONS</code> but means that an
            "OPTIONS *" request line will be sent, i.e. the
            <clix:arg>uri</clix:arg>'s path and query parts will be
            ignored.
          </p>
          <p><a name="arg-force-ssl"/>
            If <clix:arg>force-ssl</clix:arg> is true, SSL will be
            attached to the socket stream which connects Drakma with
            the web server.  Usually, you don't have to provide this
            argument, as SSL will be attached anyway if the scheme of
            <clix:arg>uri</clix:arg> is `https'.
          </p>
          <p><a name="arg-certificate"/><a
          name="arg-certificate-password"/><a name="arg-key"/>
          <clix:arg>certificate</clix:arg> is the file name of the PEM
          encoded client certificate to present to the server when
          making a SSL connection.  <clix:arg>key</clix:arg> specifies
          the file name of the PEM encoded private key matching the
          certificate.  <clix:arg>certificate-password</clix:arg>
          specifies the pass phrase to use to decrypt the private key.
          </p>
          <p>
            <a name="arg-verify"/>
            <clix:arg>verify</clix:arg> can be specified to force
            verification of the certificate that is presented by the
            server in an SSL connection.  It can be specified either
            as <code>NIL</code> if no check should be performed,
            <code>:OPTIONAL</code> to verify the server's certificate
            if it presented one or <code>:REQUIRED</code> to verify
            the server's certificate and fail if an invalid or no
            certificate was presented.
          </p>
          <p>
            <a name="arg-max-depth"/>
            <clix:arg>max-depth</clix:arg> can be specified to change
            the maximum allowed certificate signing depth that is
            accepted.  The default is 10.
          </p>
          <p>
            <a name="arg-ca-file"/>
            <a name="arg-ca-directory"/>
            <clix:arg>ca-file</clix:arg> and
            <clix:arg>ca-directory</clix:arg> can be specified to set
            the certificate authority bundle file or directory to use
            for certificate validation.
          </p>
          <p>
            The <clix:arg>certificate</clix:arg>,
            <clix:arg>key</clix:arg>,
            <clix:arg>certificate-password</clix:arg>,
            <clix:arg>verify</clix:arg>,
            <clix:arg>max-depth</clix:arg>,
            <clix:arg>ca-file</clix:arg> and
            <clix:arg>ca-directory</clix:arg> parameters are ignored
            for non-SSL requests.  They are also ignored on LispWorks.
          </p>
          <p>
            <a name="arg-parameters"/>
            <a name="arg-form-data"/>
            <clix:arg>parameters</clix:arg> is an alist of name/value
            pairs (the car and the cdr each being a string) which
            denotes the parameters which are added to the query part
            of the URL or (in the case of a POST request) comprise the
            body of the request.  (But see
            <clix:arg>content</clix:arg> below.)  The values can also
            be <code>NIL</code> in which case only the name (without
            an equal sign) is used in the query string.  The
            name/value pairs are URL-encoded using the FLEXI-STREAMS
            external format <clix:arg>external-format-out</clix:arg>
            before they are sent to the server unless
            <clix:arg>form-data</clix:arg> is true in which case the
            POST request body is sent as `multipart/form-data' using
            <clix:arg>external-format-out</clix:arg>.  The values of
            the <clix:arg>parameters</clix:arg> alist can also be
            pathnames, open binary input streams, unary functions, or
            lists where the first element is of one of the former
            types.  These values denote files which should be sent as
            part of the request body.  If files are present in
            <clix:arg>parameters</clix:arg>, the content type of the
            request is always `multipart/form-data'.  If the value is
            a list, the part of the list behind the first element is
            treated as a plist which can be used to specify a content
            type and/or a filename for the file, i.e. such a value
            could look like, e.g., <tt>(#p"/tmp/my_file.doc"
            :content-type "application/msword" :filename
            "upload.doc")</tt>.
          </p>
          <p>
            <a name="arg-url-encoder"/>
            <clix:arg>url-encoder</clix:arg> specifies a custom URL
            encoder function which will be used by drakma to
            URL-encode parameter names and values.  It needs to be a
            function of two arguments.  The arguments are the string
            to encode and the external format to use (as accepted by
            FLEXI-STREAMS:STRING-TO-OCTETS).  The return value must be
            the URL-encoded string.  This can be used if specific
            encoding rules are required.
          </p>
          <p>
            <a name="arg-content"/>
            <a name="arg-external-format-out"/>
            <clix:arg>content</clix:arg>, if not <code>NIL</code>, is
            used as the request body - <clix:arg>parameters</clix:arg>
            is ignored in this case.  <clix:arg>content</clix:arg> can
            be a string, a sequence of octets, a pathname, an open
            binary input stream, or a function designator.  If
            <clix:arg>content</clix:arg> is a sequence, it will be
            directly sent to the server (using
            <clix:arg>external-format-out</clix:arg> in the case of
            strings).  If <clix:arg>content</clix:arg> is a pathname,
            the binary contents of the corresponding file will be sent
            to the server.  If <clix:arg>content</clix:arg> is a
            stream, everything that can be read from the stream until
            EOF will be sent to the server.  If
            <clix:arg>content</clix:arg> is a function designator, the
            corresponding function will be called with one argument,
            the stream to the server, to which it should send data.
          </p>
          <p>
            Finally, <clix:arg>content</clix:arg> can also be the
            keyword <code>:CONTINUATION</code> in which case
            <clix:ref>HTTP-REQUEST</clix:ref> returns only one value -
            a `continuation' function.  This function has one required
            argument and one optional argument.  The first argument
            will be interpreted like <clix:arg>content</clix:arg>
            above (but it cannot be a keyword), i.e. it will be sent
            to the server according to its type.  If the second
            argument is true, the continuation function can be called
            again to send more content, if it is <code>NIL</code> the
            continuation function returns what
            <clix:ref>HTTP-REQUEST</clix:ref> would have returned.
          </p>
          <p>
            If <clix:arg>content</clix:arg> is a sequence, Drakma will
            use LENGTH to determine its length and will use the result
            for the `Content-Length' header sent to the server.  You
            can overwrite this with the
            <clix:arg>content-length</clix:arg> parameter (a
            non-negative integer) which you can also use for the cases
            where Drakma can't or won't determine the content length
            itself.  You can also explicitly provide a
            <clix:arg>content-length</clix:arg> argument of
            <code>NIL</code> which will imply that no `Content-Length'
            header will be sent in any case.  If no `Content-Length'
            header is sent, Drakma will use chunked encoding to send
            the content body.  Note that this will not work with older
            web servers.
          </p>
          <p>
            <a name="arg-content-length"/>
            Providing a true <clix:arg>content-length</clix:arg>
            argument which is not a non-negative integer means that
            Drakma /must/ build the request body in RAM and compute
            the content length even if it would have otherwise used
            chunked encoding, for example in the case of file uploads.
          </p>
          <p>
            <a name="arg-content-type"/>
            <clix:arg>content-type</clix:arg> is the corresponding
            `Content-Type' header to be sent and will be ignored
            unless <clix:arg>content</clix:arg> is provided as well.
          </p>
          <p>
            Note that a query already contained in
            <clix:arg>uri</clix:arg> will always be sent with the
            request line anyway in addition to other parameters sent
            by Drakma.
          </p>
          <p>
            <a name="arg-cookie-jar"/>
            <clix:arg>cookie-jar</clix:arg> is a cookie jar containing
            cookies which will potentially be sent to the server (if
            the domain matches, if they haven't expired, etc.) - this
            cookie jar will be modified according to the `Set-Cookie'
            header(s) sent back by the server.
          </p>
          <p>
            <a name="arg-basic-authorization"/>
            <clix:arg>basic-authorization</clix:arg>, if not
            <code>NIL</code>, should be a list of two strings
            (username and password) which will be sent to the server
            for basic authorization.
          </p>
          <p>
            <a name="arg-user-agent"/>
            <clix:arg>user-agent</clix:arg>, if not <code>NIL</code>,
            denotes which `User-Agent' header will be sent with the
            request.  It can be one of the keywords
            <code>:DRAKMA</code>, <code>:FIREFOX</code>,
            <code>:EXPLORER</code>, <code>:OPERA</code>, or
            <code>:SAFARI</code> which denote the current version of
            Drakma or, in the latter four cases, a fixed string
            corresponding to a more or less recent (as of August 2006)
            version of the corresponding browser.  Or it can be a
            string which is used directly.
          </p>
          <p>
            <a name="arg-accept"/>
            <clix:arg>accept</clix:arg>, if not <code>NIL</code>,
            specifies the contents of the `Accept' header sent.
          </p>
          <p>
            <a name="arg-range"/>
            <clix:arg>range</clix:arg> optionally specifies a subrange
            of the resource to be requested.  It must be specified as
            a list of two integers which indicate the start and
            (inclusive) end offset of the requested range, in bytes
            (i.e. octets).
          </p>
          <p>
            <a name="arg-proxy"/>
            <a name="arg-proxy-basic-authorization"/>
            If <clix:arg>proxy</clix:arg> is not <code>NIL</code>, it
            should be a string denoting a proxy server through which
            the request should be sent.  Or it can be a list of two
            values - a string denoting the proxy server and an integer
            denoting the port to use (which will default to 80
            otherwise).  Defaults to
            <clix:arg>*default-http-proxy*</clix:arg>.
            <clix:arg>proxy-basic-authorization</clix:arg> is used
            like <clix:arg>basic-authorization</clix:arg>, but for the
            proxy, and only if <clix:arg>proxy</clix:arg> is true.  If
            the host portion of the uri is present in the
            <clix:ref>*NO-PROXY-DOMAINS*</clix:ref> or the
            <clix:arg>NO-PROXY-DOMAINS</clix:arg> list then the proxy
            setting will be ignored for this request.
          </p>
          <p>
            If <clix:arg>NO-PROXY-DOMAINS</clix:arg> is set then it
            will supersede the <clix:ref>*NO-PROXY-DOMAINS*</clix:ref>
            variable. Inserting domains into this list will allow them
            to ignore the proxy setting.
          </p>
          <p>
            <a name="arg-real-host"/>
            If <clix:arg>real-host</clix:arg> is not <code>NIL</code>,
            request is sent to the denoted host instead of the
            <clix:arg>uri</clix:arg> host.  When specified,
            <clix:arg>real-host</clix:arg> supersedes
            <clix:arg>proxy</clix:arg>.
          </p>
          <p>
            <a name="arg-additional-headers"/>
            <clix:arg>additional-headers</clix:arg> is a name/value
            alist of additional HTTP headers which should be sent with
            the request.  Unlike in <clix:arg>parameters</clix:arg>,
            the cdrs can not only be strings but also designators for
            unary functions (which should in turn return a string) in
            which case the function is called each time the header is
            written.
          </p>
          <p>
            <a name="arg-redirect"/>
            <a name="arg-auto-referer"/>
            If <clix:arg>redirect</clix:arg> is not <code>NIL</code>,
            it must be a non-negative integer or T.  If
            <clix:arg>redirect</clix:arg> is true, Drakma will follow
            redirects (return codes 301, 302, 303, or 307) unless
            <clix:arg>redirect</clix:arg> is 0.  If
            <clix:arg>redirect</clix:arg> is an integer, it will be
            decreased by 1 with each redirect.  Furthermore, if
            <clix:arg>auto-referer</clix:arg> is true when following
            redirects, Drakma will populate the `Referer' header with
            the <clix:arg>uri</clix:arg> that triggered the
            redirection, overwriting an existing `Referer' header (in
            <clix:arg>additional-headers</clix:arg>) if necessary.
          </p>
          <p>
            <a name="arg-keep-alive"/>
            <a name="arg-close"/>
            If <clix:arg>keep-alive</clix:arg> is T, the server will
            be asked to keep the connection alive, i.e. not to close
            it after the reply has been sent.  (Note that this not
            necessary if both the client and the server use HTTP 1.1.)
            If <clix:arg>close</clix:arg> is T, the server is
            explicitly asked to close the connection after the reply
            has been sent.  <clix:arg>keep-alive</clix:arg> and
            <clix:arg>close</clix:arg> are obviously mutually
            exclusive.
          </p>
          <p>
            <a name="arg-external-format-in"/>
            <a name="arg-force-binary"/>
            If the message body sent by the server has a text content
            type, Drakma will try to return it as a Lisp string.
            It'll first check if the `Content-Type' header denotes an
            encoding to be used, or otherwise it will use the
            <clix:arg>external-format-in</clix:arg> argument.  The
            body is decoded using FLEXI-STREAMS.  If FLEXI-STREAMS
            doesn't know the external format, the body is returned as
            an array of octets.  If the body is empty, Drakma will
            return <code>NIL</code>.
          </p>
          <p>
            If the message body doesn't have a text content type or if
            <clix:arg>force-binary</clix:arg> is true, the body is
            always returned as an array of octets.
          </p>
          <p>
            <a name="arg-want-stream"/>
            If <clix:arg>want-stream</clix:arg> is true, the message
            body is NOT read and instead the (open) socket stream is
            returned as the first return value.  If the sixth value of
            <clix:ref>HTTP-REQUEST</clix:ref> is true, the stream
            should be closed (and not be re-used) after the body has
            been read.  The stream returned is a <a
            href="http://weitz.de/flexi-streams/">flexi-stream</a>
            with a <a href="http://weitz.de/chunga/"
            target="_new">chunked stream</a> as its underlying stream.
            If you want to read binary data from this stream, read
            from the underlying stream which you can get with
            FLEXI-STREAM-STREAM.
          </p>
          <p>
            <a name="arg-stream"/>
            Drakma will usually create a new socket connection for
            each HTTP request.  However, you can use the
            <clix:arg>stream</clix:arg> argument to provide an open
            socket stream which should be re-used.
            <clix:arg>stream</clix:arg> MUST be a stream returned by a
            previous invocation of <clix:ref>HTTP-REQUEST</clix:ref>
            where the sixth return value wasn't true.  Obviously, it
            must also be connected to the correct server and at the
            right position (i.e. the message body, if any, must have
            been read).  Drakma will NEVER attach SSL to a stream
            provided as the <clix:arg>stream</clix:arg> argument.
          </p>
          <p>
            <a name="arg-connection-timeout"/>
            <clix:arg>connection-timeout</clix:arg> is the time (in
            seconds) Drakma will wait until it considers an attempt to
            connect to a server as a failure. It is supported only on
            some platforms (currently abcl, clisp, LispWorks, mcl,
            openmcl and sbcl). READ-TIMEOUT and WRITE-TIMEOUT are the
            read and write timeouts (in seconds) for the socket stream
            to the server.  All three timeout arguments can also be
            <code>NIL</code> (meaning no timeout), and they don't
            apply if an existing stream is re-used.  READ-TIMEOUT
            argument is only available for LispWorks, WRITE-TIMEOUT is
            only available for LispWorks 5.0 or higher.
          </p>
          <p>
            <a name="arg-deadline"/>
            <clix:arg>deadline</clix:arg>, a time in the future,
            specifies the time until which the request should be
            finished.  The deadline is specified in internal time
            units.  If the server fails to respond until that time, a
            COMMUNICATION-DEADLINE-EXPIRED condition is signalled.
            <clix:arg>deadline</clix:arg> is only available on CCL 1.2
            and later.
          </p>
          <p>
            <a name="arg-preserve-uri"/>
            If <clix:arg>preserve-uri</clix:arg> is not
            <code>NIL</code>, the given <clix:arg>uri</clix:arg> will
            not be processed. This means that the
            <clix:arg>uri</clix:arg> will be sent as-is to the remote
            server and it is the responsibility of the client to make
            sure that all parameters are encoded properly. Note that
            if this parameter is given, and the request is not a POST
            with a content-type of `multipart/form-data',
            <clix:arg>parameters</clix:arg> will not be used.
          </p>
          <p>
            If <clix:arg>decode-content</clix:arg> is not
            <code>NIL</code>, then the content will automatically be
            decoded according to any encodings specified in the
            Content-Encoding header. The actual decoding is done by
            the <clix:ref>decode-stream</clix:ref> generic function,
            and you can implement new methods to support additional
            encodings.  Any encodings in Transfer-Encoding, such as
            chunking, are always performed.
          </p>
        </clix:description>
      </clix:function>

      <clix:function name="parameter-present-p">
        <clix:lambda-list>name parameters</clix:lambda-list>
        <clix:returns>boolean</clix:returns>
        <clix:description>
          <p>
            If <clix:arg>parameters</clix:arg> is an alist of
            parameters as returned by, for example,
            READ-TOKENS-AND-PARAMETERS and <clix:arg>name</clix:arg>
            is a string naming a parameter, this function returns the
            full parameter (name and value) - or <code>NIL</code> if
            it's not in <clix:arg>parameters</clix:arg>.
          </p>
        </clix:description>
      </clix:function>

      <clix:function name="parameter-value">
        <clix:lambda-list>name parameters</clix:lambda-list>
        <clix:returns>(or string null)</clix:returns>
        <clix:description>
          <p>
            If <clix:arg>parameters</clix:arg> is an alist of
            parameters as returned by, for example,
            READ-TOKENS-AND-PARAMETERS and <clix:arg>name</clix:arg>
            is a string naming a parameter, this function returns the
            value of this parameter - or <code>NIL</code> if it's not
            in <clix:arg>parameters</clix:arg>.
          </p>
        </clix:description>
      </clix:function>

      <clix:function name="url-encode">
        <clix:lambda-list>string external-format</clix:lambda-list>
        <clix:returns>string</clix:returns>
        <clix:description>
          <p>
            Returns a URL-encoded version of the string
            <clix:arg>string</clix:arg> using the external format
            <clix:arg>external-format</clix:arg>.
          </p>
        </clix:description>
      </clix:function>

      <clix:function name="decode-stream">
        <clix:lambda-list>encoding-type stream</clix:lambda-list>
        <clix:returns>stream</clix:returns>
        <clix:description>
          <p>
            Generic function to decode a stream.  This is a generic
            function which decodes the stream based on the
            encoding-type.  If a response contains one or more
            transfer or content encodings, then decode-stream is
            called for each encoding type in the correct order to
            properly decode the stream to its original content.
          </p>
          <p>
            <clix:arg>encoding-type</clix:arg> will be a keyword
            created by upcasing and interning the encoding type from
            the header.  <clix:arg>stream</clix:arg> will be the
            stream that needs to be
            decoded. <clix:ref>decode-stream</clix:ref> returns a new
            stream from which you can read the decoded data.
          </p>
        </clix:description>
      </clix:function>

      <clix:special-variable name="*body-format-function*">
        <clix:description>
          <p>
            A function which determines whether the content body
            returned by the server is text and should be treated as
            such or not.  The function is called after the request
            <clix:ref>headers</clix:ref> have been read and it must
            accept two arguments, <code><i>headers</i></code> and
            <code><i>external-format-in</i></code>, where
            <code><i>headers</i></code> is like the third return value
            of <clix:ref>HTTP-REQUEST</clix:ref> while
            <code><i>external-format-in</i></code> is the
            <clix:ref>HTTP-REQUEST</clix:ref> argument of the same
            name.  It should return <code>NIL</code> if the body
            should be regarded as binary content, or a <a
            href="http://weitz.de/flexi-streams/">FLEXI-STREAMS</a>
            external format (which will be used to read the body)
            otherwise.
          </p>
          <p>
            This function will only be called if the <a
            href="#arg-force-binary"><code><i>force-binary</i></code></a>
            argument to <clix:ref>HTTP-REQUEST</clix:ref> is
            <code>NIL</code>.
          </p>
          <p>
            The initial value of this variable is a function which
            uses <clix:ref>*TEXT-CONTENT-TYPES*</clix:ref> to
            determine whether the body is text and then proceeds as
            described in the <clix:ref>HTTP-REQUEST</clix:ref>
            documentation entry.
          </p>
        </clix:description>
      </clix:special-variable>

      <clix:special-variable name="*default-http-proxy*">
        <clix:description>
          <p>
	    HTTP proxy to be used as default for the proxy keyword
	    argument of <clix:ref>HTTP-REQUEST</clix:ref>. If not
	    <code>NIL</code>, it should be a string denoting a proxy
	    server through which the request should be sent.  Or it
	    can be a list of two values - a string denoting the proxy
	    server and an integer denoting the port to use (which
	    will default to 80 otherwise).
          </p>
        </clix:description>
      </clix:special-variable>

      <clix:special-variable name="*no-proxy-domains*">
        <clix:description>
          <p>
            A list of domains for which a proxy should not be used.
          </p>
        </clix:description>
      </clix:special-variable>

      <clix:special-variable name="*drakma-default-external-format*">
        <clix:description>
          <p>
            The default value for the external format keyword
            arguments of <clix:ref>HTTP-REQUEST</clix:ref>.  The value
            of this variable will be interpreted by <a
            href="http://weitz.de/flexi-streams/">FLEXI-STREAMS</a>.
            The initial value is the keyword <code>:LATIN-1</code>.
            (Note that Drakma binds <a
            href="http://weitz.de/flexi-streams/#*default-eol-style*"><code>*DEFAULT-EOL-STYLE*</code></a>
            to <code>:LF</code>).
          </p>
        </clix:description>
      </clix:special-variable>

      <clix:special-variable name="*header-stream*">
        <clix:description>
          <p>
            If this variable is not <code>NIL</code>, it should be
            bound to a stream to which incoming and outgoing headers
            will be written for debugging purposes.
          </p>
        </clix:description>
      </clix:special-variable>

      <clix:special-variable name="*text-content-types*">
        <clix:description>
          <p>
            A list of conses which are used by the default value of
            <clix:ref>*BODY-FORMAT-FUNCTION*</clix:ref> to decide
            whether a 'Content-Type' header denotes text content.  The
            car and cdr of each cons should each be a string or
            <code>NIL</code>.  A content type matches one of these
            entries (and thus denotes text) if the type part is <a
            href="http://www.lispworks.com/documentation/HyperSpec/Body/f_stgeq_.htm"><code>STRING-EQUAL</code></a>
            to the car or if the car is <code>NIL</code> and if the
            subtype part is <a
            href="http://www.lispworks.com/documentation/HyperSpec/Body/f_stgeq_.htm"><code>STRING-EQUAL</code></a>
            to the cdr or if the cdr is <code>NIL</code>.
          </p>
          <p>
            The initial value of this variable is the list
            <pre>(("text" . nil))</pre> which means that every content
            type that starts with "text/" is regarded as text, no
            matter what the subtype is.
          </p>
        </clix:description>
      </clix:special-variable>

    </clix:subchapter>

    <clix:subchapter name="headers" title="Headers">
      <p>
        This section assembles a couple of convenience functions which
        can be used to access information returned as the third value
        (<code><i>headers</i></code>) of
        <clix:ref>HTTP-REQUEST</clix:ref>.
      </p>
      <p>
        Note that if the server sends <a
        href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2">multiple
        headers with the same name</a>, these are comprised into one
        entry by <clix:ref>HTTP-REQUEST</clix:ref>.  The values are
        separated by commas.
      </p>

      <clix:function name="get-content-type">
        <clix:lambda-list>headers</clix:lambda-list>
        <clix:returns>list</clix:returns>
        <clix:description>
          <p>
            Reads and parses a `Content-Type' header and returns it as
            three values - the type, the subtype, and an alist
            (possibly empty) of name/value pairs for the optional
            parameters.  <clix:arg>headers</clix:arg> is supposed to
            be an alist of headers as returned by
            <clix:ref>HTTP-REQUEST</clix:ref>.  Returns
            <code>NIL</code> if there is no such header amongst
            <clix:arg>headers</clix:arg>.
          </p>
        </clix:description>
      </clix:function>

      <clix:function name="header-value">
        <clix:lambda-list>name headers</clix:lambda-list>
        <clix:returns>(or string null)</clix:returns>
        <clix:description>
          <p>
            If <clix:arg>headers</clix:arg> is an alist of headers as
            returned by <clix:ref>HTTP-REQUEST</clix:ref> and
            <clix:arg>name</clix:arg> is a keyword naming a header,
            this function returns the corresponding value of this
            header (or <code>NIL</code> if it's not in
            <clix:arg>headers</clix:arg>).
          </p>
        </clix:description>
      </clix:function>

      <clix:function name="read-tokens-and-parameters">
        <clix:lambda-list>string &amp;key value-required-p</clix:lambda-list>
        <clix:returns>list</clix:returns>
        <clix:description>
          <p>
            Reads a comma-separated list of tokens from the string
            <clix:arg>string</clix:arg>.  Each token can be followed
            by an optional, semicolon-separated list of
            attribute/value pairs where the attributes are tokens
            followed by a #\= character and a token or a quoted
            string.  Returned is a list where each element is either a
            string (for a simple token) or a cons of a string (the
            token) and an alist (the attribute/value pairs).  If
            <clix:arg>value-required-p</clix:arg> is <code>NIL</code>,
            the value part (including the #\= character) of each
            attribute/value pair is optional.
          </p>
        </clix:description>
      </clix:function>

      <clix:function name="split-tokens">
        <clix:lambda-list>string</clix:lambda-list>
        <clix:returns>list</clix:returns>
        <clix:description>
          <p>
            Splits the string <clix:arg>string</clix:arg> into a list
            of substrings separated by commas and optional whitespace.
            Empty substrings are ignored.
          </p>
        </clix:description>
      </clix:function>

    </clix:subchapter>

    <clix:subchapter name="cookies" title="Cookies">
      <p>
        <clix:ref>HTTP-REQUEST</clix:ref> can deal with <a
        href="http://en.wikipedia.org/wiki/HTTP_cookie">HTTP
        cookies</a> if it gets a <a href="#cookie-jar">cookie jar</a>,
        a collection of <clix:ref>COOKIE</clix:ref> objects, as its <a
        href="#arg-cookie-jar">cookie-jar</a> argument.  Cookies sent
        by the web server will be added to the cookie jar (or updated)
        if appropriate and cookies already in the cookie jar will be
        sent to the server together with the request.
      </p>
      <p>
        Drakma will never remove cookies from a cookie jar
        automatically.  You have to do it manually using
        <clix:ref>DELETE-OLD-COOKIES</clix:ref>.
      </p>

      <clix:class name="cookie">
        <clix:description>
          <p>
            Instances of this class represent <a
            href="http://en.wikipedia.org/wiki/HTTP_cookie">HTTP
            cookies</a>.  If you need to create your own cookies, you
            should use <a
            href="http://www.lispworks.com/documentation/HyperSpec/Body/f_mk_ins.htm"><code>MAKE-INSTANCE</code></a>
            with the initargs <code>:NAME</code>, <code>:DOMAIN</code>,
            <code>:VALUE</code>, <code>:PATH</code>,
            <code>:EXPIRES</code>, <code>:SECUREP</code>, and
            <code>:HTTP-ONLY-P</code> all of which are optional except
            for the first two.  The meaning of these initargs and <a
            href="#cookie-name">the corresponding accessors</a> should
            be pretty clear if one looks at the <a
            href="http://curl.haxx.se/rfc/cookie_spec.html">original
            cookie specification</a> (and at <a
            href="http://msdn2.microsoft.com/en-us/library/ms533046.aspx">this
            page</a> for the <code>HttpOnly</code> extension).
          </p>
          <pre><span class="repl-output">? </span><span class="repl-input">(make-instance 'drakma:cookie
                 :name "Foo" 
                 :value "Bar"
                 :expires (+ (get-universal-time) 3600)
                 :domain ".weitz.de")</span>
<span class="repl-output">#&lt;COOKIE Foo=Bar; expires=Sun, 09-12-2012 20:37:42 GMT; path=/; domain=.weitz.de&gt;</span>
</pre>
        </clix:description>
      </clix:class>

      <clix:function name="parse-cookie-date">
        <clix:lambda-list>string</clix:lambda-list>
        <clix:returns>universal-time</clix:returns>
        <clix:description>
          <p>
            Parses a cookie expiry date and returns it as a Lisp <a
            href="http://www.lispworks.com/documentation/HyperSpec/Body/25_adb.htm">universal
            time</a>.  Currently understands the following formats:
          </p>
          <pre>"Wed, 06-Feb-2008 21:01:38 GMT"
"Wed, 06-Feb-08 21:01:38 GMT"
"Tue Feb 13 08:00:00 2007 GMT"
"Wednesday, 07-February-2027 08:55:23 GMT"
"Wed, 07-02-2017 10:34:45 GMT"</pre>
          <p>
            Instead of "GMT" time zone abbreviations like "CEST" and UTC
            offsets like "GMT-01:30" are also allowed.
          </p>
          <p>
            While this function has "cookie" in its name, it might
            come in handy in other situations as well and it is thus
            exported as a convenience function.
          </p>
        </clix:description>
      </clix:function>

      <clix:function name="cookie=">
        <clix:lambda-list>cookie1 cookie2</clix:lambda-list>
        <clix:returns>boolean</clix:returns>
        <clix:description>
          Returns a true value if the cookies
          <clix:arg>cookie1</clix:arg> and
          <clix:arg>cookie2</clix:arg> are equal.  Two cookies are
          considered to be equal if name and path are equal.
        </clix:description>
      </clix:function>

      <clix:accessors generic='true'>
        <clix:listed-accessor generic='true' name='cookie-name'>
          <clix:lambda-list>cookie</clix:lambda-list>
          <clix:returns>string</clix:returns>
        </clix:listed-accessor>
        <clix:listed-accessor generic='true' name='cookie-value'>
          <clix:lambda-list>cookie</clix:lambda-list>
          <clix:returns>(or string null)</clix:returns>
        </clix:listed-accessor>
        <clix:listed-accessor generic='true' name='cookie-domain'>
          <clix:lambda-list>cookie</clix:lambda-list>
          <clix:returns>string</clix:returns>
        </clix:listed-accessor>
        <clix:listed-accessor generic='true' name='cookie-path'>
          <clix:lambda-list>cookie</clix:lambda-list>
          <clix:returns>(or string null)</clix:returns>
        </clix:listed-accessor>
        <clix:listed-accessor generic='true' name='cookie-expires'>
          <clix:lambda-list>cookie</clix:lambda-list>
          <clix:returns>(or integer null)</clix:returns>
        </clix:listed-accessor>
        <clix:listed-accessor generic='true' name='cookie-http-only-p'>
          <clix:lambda-list>cookie</clix:lambda-list>
          <clix:returns>boolean</clix:returns>
        </clix:listed-accessor>
        <clix:listed-accessor generic='true' name='cookie-securep'>
          <clix:lambda-list>cookie</clix:lambda-list>
          <clix:returns>boolean</clix:returns>
        </clix:listed-accessor>
      </clix:accessors>

      <clix:class name="cookie-jar">
        <clix:description>
          <p>
            An object of this class encapsulates a collection (a list,
            actually) of <code>COOKIE</code> objects. You create a new
            cookie jar with <code>(MAKE-INSTANCE 'COOKIE-JAR)</code>
            where you can optionally provide a list of
            <clix:ref>COOKIE</clix:ref> objects with the
            <code>:COOKIES</code> initarg. The cookies in a cookie jar
            are accessed with <clix:ref>COOKIE-JAR-COOKIES</clix:ref>.
          </p>
        </clix:description>
      </clix:class>

      <clix:accessors generic='true'>
        <clix:listed-accessor generic='true' name='cookie-jar-cookies'>
          <clix:lambda-list>cookie-jar</clix:lambda-list>
          <clix:returns>list</clix:returns>
        </clix:listed-accessor>
      </clix:accessors>

      <clix:function name="delete-old-cookies">
        <clix:lambda-list>cookie-jar</clix:lambda-list>
        <clix:returns>cookie-jar</clix:returns>
        <clix:description>
          <p>
            Removes all cookies from <clix:arg>cookie-jar</clix:arg>
            which have either expired or which don't have an expiry
            date.
          </p>
        </clix:description>
      </clix:function>

      <clix:special-variable name="*allow-dotless-cookie-domains-p*">
        <clix:description>
          <p>
            When this variable is not <code>NIL</code>, cookie domains
            containing no dots are considered valid.  The default is
            <code>NIL</code>, meaning to disallow such domains except
            for "localhost".
          </p>
        </clix:description>
      </clix:special-variable>

      <clix:special-variable name="*ignore-unparseable-cookie-dates-p*">
        <clix:description>
          <p>
            Whether Drakma is allowed to treat `Expires' dates in
            cookie headers as non-existent if it can't parse them.  If
            the value of this variable is <code>NIL</code> (which is
            the default), an error will be signalled instead.
          </p>
        </clix:description>
      </clix:special-variable>

      <clix:special-variable name="*remove-duplicate-cookies-p*">
        <clix:description>
          <p>
            Determines how duplicate cookies in the response are
            handled, defaults to <code>T</code>.  Cookies are
            considered duplicate using <a
            href="#cookie="><code>COOKIE=</code></a>.
          </p>
          <p>
            Valid values are:
            <ul>
              <li><code>NIL</code> - duplicates will not be
              removed,</li>
              <li><code>T</code> or <code>:KEEP-LAST</code> - for
              duplicates, only the last cookie value will be kept,
              based on the order of the response header,</li>
              <li><code>:KEEP-FIRST</code> - for duplicates, only the
              first cookie value will be kept, based on the order of
              the response header.</li>
            </ul>
          </p>
          <p>
            Misbehaving servers may send duplicate cookies back in the
            same <code>Set-Cookie</code> header:
          </p>
<pre>HTTP/1.1 200  OK
Server: My-hand-rolled-server
Date: Wed, 07 Apr 2010 15:12:30 GMT
Connection: Close
Content-Type: text/html
Content-Length: 82
Set-Cookie: a=1; Path=/; Secure, a=2; Path=/; Secure
</pre>
          <p>
            In this case Drakma has to choose whether cookie "a" has
            the value "1" or "2".  By default, Drakma will choose the
            last value specified, in this case "2".
          </p>
          <p>
            By default, Drakma conforms to <a
            href="http://www.w3.org/Protocols/rfc2109/rfc2109">RFC2109
            HTTP State Management Mechanism</a>, section 4.3.3 Cookie
            Management:

            <blockquote>
              <em>
                If a user agent receives a Set-Cookie response header
                whose NAME is the same as a pre-existing cookie, and
                whose Domain and Path attribute values exactly
                (string) match those of a pre-existing cookie, the new
                cookie supersedes the old.
              </em>
            </blockquote>
          </p>
        </clix:description>
      </clix:special-variable>
    </clix:subchapter>

    <clix:subchapter name="conditions" title="Conditions">
      <p>
        This section lists all the condition types that are defined by
        Drakma.
      </p>

      <clix:condition name="cookie-date-parse-error">
        <clix:description>
          <p>
            Signalled if Drakma tries to parse the date of an incoming
            cookie header and can't interpret it.
          </p>
        </clix:description>
      </clix:condition>

      <clix:condition name="cookie-error">
        <clix:description>
          <p>
            Signalled if someone tries to create a COOKIE object
            that's not valid.
          </p>
        </clix:description>
      </clix:condition>

      <clix:function name="cookie-error-cookie" generic="true">
        <clix:lambda-list>cookie-error</clix:lambda-list>
        <clix:returns>(or cookie null)</clix:returns>
        <clix:description>
          <p>
            The <code>COOKIE</code> object that caused this error.
            Can be <code>NIL</code> in case such an object couldn't be
            initialized.
          </p>
        </clix:description>
      </clix:function>

      <clix:condition name="parameter-error">
        <clix:description>
          <p>
            Signalled if a function was called with inconsistent or
            illegal parameters.
          </p>
        </clix:description>
      </clix:condition>

      <clix:condition name="syntax-error">
        <clix:description>
          <p>
            Signalled if Drakma encounters wrong or unknown syntax
            when reading the reply from the server.
          </p>
        </clix:description>
      </clix:condition>

      <clix:condition name="drakma-condition">
        <clix:description>
          <p>
            Superclass for all conditions related to Drakma.
          </p>
        </clix:description>
      </clix:condition>

      <clix:condition name="drakma-error">
        <clix:description>
          <p>
            Superclass for all errors related to Drakma.
          </p>
        </clix:description>
      </clix:condition>

      <clix:condition name="drakma-warning">
        <clix:description>
          <p>
            Superclass for all warnings related to Drakma.
          </p>
        </clix:description>
      </clix:condition>
    </clix:subchapter>
  </clix:chapter>

  <clix:chapter name="index" title="Symbol index">
    <clix:index/>
  </clix:chapter>

</clix:documentation>