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
|
.TH "event2/http.h" 3 "Tue Jan 31 2017" "libevent" \" -*- nroff -*-
.ad l
.nh
.SH NAME
event2/http.h \- Basic support for HTTP serving\&.
.SH SYNOPSIS
.br
.PP
\fC#include <event2/util\&.h>\fP
.br
\fC#include <event2/visibility\&.h>\fP
.br
.SS "Macros"
.in +1c
.ti -1c
.RI "#define \fBEVHTTP_CON_LINGERING_CLOSE\fP 0x0020"
.br
.ti -1c
.RI "#define \fBEVHTTP_CON_PUBLIC_FLAGS_END\fP 0x100000"
.br
.ti -1c
.RI "#define \fBEVHTTP_CON_READ_ON_WRITE_ERROR\fP 0x0010"
.br
.ti -1c
.RI "#define \fBEVHTTP_CON_REUSE_CONNECTED_ADDR\fP 0x0008"
.br
.ti -1c
.RI "#define \fBEVHTTP_SERVER_LINGERING_CLOSE\fP 0x0001"
.br
.ti -1c
.RI "#define \fBEVHTTP_URI_NONCONFORMANT\fP 0x01"
.br
.RI "\fITolerate URIs that do not conform to RFC3986\&. \fP"
.ti -1c
.RI "#define \fBHTTP_BADMETHOD\fP 405"
.br
.RI "\fImethod not allowed for this uri \fP"
.ti -1c
.RI "#define \fBHTTP_BADREQUEST\fP 400"
.br
.RI "\fIinvalid http request was made \fP"
.ti -1c
.RI "#define \fBHTTP_ENTITYTOOLARGE\fP 413"
.br
.ti -1c
.RI "#define \fBHTTP_EXPECTATIONFAILED\fP 417"
.br
.RI "\fIwe can't handle this expectation \fP"
.ti -1c
.RI "#define \fBHTTP_INTERNAL\fP 500"
.br
.RI "\fIinternal error \fP"
.ti -1c
.RI "#define \fBHTTP_MOVEPERM\fP 301"
.br
.RI "\fIthe uri moved permanently \fP"
.ti -1c
.RI "#define \fBHTTP_MOVETEMP\fP 302"
.br
.RI "\fIthe uri moved temporarily \fP"
.ti -1c
.RI "#define \fBHTTP_NOCONTENT\fP 204"
.br
.RI "\fIrequest does not have content \fP"
.ti -1c
.RI "#define \fBHTTP_NOTFOUND\fP 404"
.br
.RI "\fIcould not find content for uri \fP"
.ti -1c
.RI "#define \fBHTTP_NOTIMPLEMENTED\fP 501"
.br
.RI "\fInot implemented \fP"
.ti -1c
.RI "#define \fBHTTP_NOTMODIFIED\fP 304"
.br
.RI "\fIpage was not modified from last \fP"
.ti -1c
.RI "#define \fBHTTP_OK\fP 200"
.br
.RI "\fIrequest completed ok \fP"
.ti -1c
.RI "#define \fBHTTP_SERVUNAVAIL\fP 503"
.br
.RI "\fIthe server is not available \fP"
.in -1c
.SS "Typedefs"
.in +1c
.ti -1c
.RI "typedef void \fBevhttp_bound_socket_foreach_fn\fP(struct evhttp_bound_socket *, void *)"
.br
.in -1c
.SS "Enumerations"
.in +1c
.ti -1c
.RI "enum \fBevhttp_cmd_type\fP { \fBEVHTTP_REQ_GET\fP = 1 << 0, \fBEVHTTP_REQ_POST\fP = 1 << 1, \fBEVHTTP_REQ_HEAD\fP = 1 << 2, \fBEVHTTP_REQ_PUT\fP = 1 << 3, \fBEVHTTP_REQ_DELETE\fP = 1 << 4, \fBEVHTTP_REQ_OPTIONS\fP = 1 << 5, \fBEVHTTP_REQ_TRACE\fP = 1 << 6, \fBEVHTTP_REQ_CONNECT\fP = 1 << 7, \fBEVHTTP_REQ_PATCH\fP = 1 << 8 }
.RI "\fIThe different request types supported by evhttp\&. \fP""
.br
.ti -1c
.RI "enum \fBevhttp_request_error\fP { \fBEVREQ_HTTP_TIMEOUT\fP, \fBEVREQ_HTTP_EOF\fP, \fBEVREQ_HTTP_INVALID_HEADER\fP, \fBEVREQ_HTTP_BUFFER_ERROR\fP, \fBEVREQ_HTTP_REQUEST_CANCEL\fP, \fBEVREQ_HTTP_DATA_TOO_LONG\fP }
.RI "\fIThe different error types supported by evhttp\&. \fP""
.br
.ti -1c
.RI "enum \fBevhttp_request_kind\fP { \fBEVHTTP_REQUEST\fP, \fBEVHTTP_RESPONSE\fP }
.RI "\fIa request object can represent either a request or a reply \fP""
.br
.in -1c
.SS "Functions"
.in +1c
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL int \fBevhttp_accept_socket\fP (struct evhttp *http, \fBevutil_socket_t\fP fd)"
.br
.RI "\fIMakes an HTTP server accept connections on the specified socket\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL struct evhttp_bound_socket * \fBevhttp_accept_socket_with_handle\fP (struct evhttp *http, \fBevutil_socket_t\fP fd)"
.br
.RI "\fILike \fBevhttp_accept_socket()\fP, but returns a handle for referencing the socket\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL int \fBevhttp_add_header\fP (struct evkeyvalq *headers, const char *key, const char *value)"
.br
.RI "\fIAdds a header to a list of existing headers\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL int \fBevhttp_add_server_alias\fP (struct evhttp *http, const char *alias)"
.br
.RI "\fIAdd a server alias to an http object\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL int \fBevhttp_add_virtual_host\fP (struct evhttp *http, const char *pattern, struct evhttp *vhost)"
.br
.RI "\fIAdds a virtual host to the http server\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL struct evhttp_bound_socket * \fBevhttp_bind_listener\fP (struct evhttp *http, struct evconnlistener *listener)"
.br
.RI "\fIThe most low-level evhttp_bind/accept method: takes an evconnlistener, and returns an evhttp_bound_socket\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL int \fBevhttp_bind_socket\fP (struct evhttp *http, const char *address, ev_uint16_t port)"
.br
.RI "\fIBinds an HTTP server on the specified address and port\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL struct evhttp_bound_socket * \fBevhttp_bind_socket_with_handle\fP (struct evhttp *http, const char *address, ev_uint16_t port)"
.br
.RI "\fILike \fBevhttp_bind_socket()\fP, but returns a handle for referencing the socket\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL \fBevutil_socket_t\fP \fBevhttp_bound_socket_get_fd\fP (struct evhttp_bound_socket *bound_socket)"
.br
.RI "\fIGet the raw file descriptor referenced by an evhttp_bound_socket\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL struct evconnlistener * \fBevhttp_bound_socket_get_listener\fP (struct evhttp_bound_socket *bound)"
.br
.RI "\fIReturn the listener used to implement a bound socket\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL void \fBevhttp_cancel_request\fP (struct evhttp_request *req)"
.br
.RI "\fICancels a pending HTTP request\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL void \fBevhttp_clear_headers\fP (struct evkeyvalq *headers)"
.br
.RI "\fIRemoves all headers from the header list\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL struct evhttp_connection * \fBevhttp_connection_base_bufferevent_new\fP (struct \fBevent_base\fP *base, struct evdns_base *dnsbase, struct \fBbufferevent\fP *bev, const char *address, ev_uint16_t port)"
.br
.RI "\fICreate and return a connection object that can be used to for making HTTP requests\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL struct evhttp_connection * \fBevhttp_connection_base_new\fP (struct \fBevent_base\fP *base, struct evdns_base *dnsbase, const char *address, ev_uint16_t port)"
.br
.RI "\fICreate and return a connection object that can be used to for making HTTP requests\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL void \fBevhttp_connection_free\fP (struct evhttp_connection *evcon)"
.br
.RI "\fIFrees an http connection\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL void \fBevhttp_connection_free_on_completion\fP (struct evhttp_connection *evcon)"
.br
.RI "\fIDisowns a given connection object\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL const struct sockaddr * \fBevhttp_connection_get_addr\fP (struct evhttp_connection *evcon)"
.br
.RI "\fIGet the remote address associated with this connection\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL struct \fBevent_base\fP * \fBevhttp_connection_get_base\fP (struct evhttp_connection *req)"
.br
.RI "\fIReturns the underlying \fBevent_base\fP for this connection\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL struct \fBbufferevent\fP * \fBevhttp_connection_get_bufferevent\fP (struct evhttp_connection *evcon)"
.br
.RI "\fIReturn the bufferevent that an evhttp_connection is using\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL void \fBevhttp_connection_get_peer\fP (struct evhttp_connection *evcon, char **address, ev_uint16_t *port)"
.br
.RI "\fIGet the remote address and port associated with this connection\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL struct evhttp * \fBevhttp_connection_get_server\fP (struct evhttp_connection *evcon)"
.br
.RI "\fIReturn the HTTP server associated with this connection, or NULL\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL void \fBevhttp_connection_set_closecb\fP (struct evhttp_connection *evcon, void(*)(struct evhttp_connection *, void *), void *)"
.br
.RI "\fISet a callback for connection close\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL void \fBevhttp_connection_set_family\fP (struct evhttp_connection *evcon, int family)"
.br
.RI "\fISet family hint for DNS requests\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL int \fBevhttp_connection_set_flags\fP (struct evhttp_connection *evcon, int flags)"
.br
.RI "\fISet connection flags\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL void \fBevhttp_connection_set_initial_retry_tv\fP (struct evhttp_connection *evcon, const struct timeval *tv)"
.br
.RI "\fISets the delay before retrying requests on this connection\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL void \fBevhttp_connection_set_local_address\fP (struct evhttp_connection *evcon, const char *address)"
.br
.RI "\fIsets the ip address from which http connections are made \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL void \fBevhttp_connection_set_local_port\fP (struct evhttp_connection *evcon, ev_uint16_t port)"
.br
.RI "\fIsets the local port from which http connections are made \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL void \fBevhttp_connection_set_max_body_size\fP (struct evhttp_connection *evcon, ev_ssize_t new_max_body_size)"
.br
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL void \fBevhttp_connection_set_max_headers_size\fP (struct evhttp_connection *evcon, ev_ssize_t new_max_headers_size)"
.br
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL void \fBevhttp_connection_set_retries\fP (struct evhttp_connection *evcon, int retry_max)"
.br
.RI "\fISets the retry limit for this connection - -1 repeats indefinitely\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL void \fBevhttp_connection_set_timeout\fP (struct evhttp_connection *evcon, int timeout_in_secs)"
.br
.RI "\fISets the timeout in seconds for events related to this connection\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL void \fBevhttp_connection_set_timeout_tv\fP (struct evhttp_connection *evcon, const struct timeval *tv)"
.br
.RI "\fISets the timeout for events related to this connection\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL char * \fBevhttp_decode_uri\fP (const char *uri)"
.br
.RI "\fIHelper function to sort of decode a URI-encoded string\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL void \fBevhttp_del_accept_socket\fP (struct evhttp *http, struct evhttp_bound_socket *bound_socket)"
.br
.RI "\fIMakes an HTTP server stop accepting connections on the specified socket\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL int \fBevhttp_del_cb\fP (struct evhttp *, const char *)"
.br
.RI "\fIRemoves the callback for a specified URI\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL char * \fBevhttp_encode_uri\fP (const char *str)"
.br
.RI "\fIHelper function to encode a string for inclusion in a URI\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL const char * \fBevhttp_find_header\fP (const struct evkeyvalq *headers, const char *key)"
.br
.RI "\fIFinds the value belonging to a header\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL void \fBevhttp_foreach_bound_socket\fP (struct evhttp *http, evhttp_bound_socket_foreach_fn *function, void *argument)"
.br
.RI "\fIApplies the function specified in the first argument to all evhttp_bound_sockets associated with 'http'\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL void \fBevhttp_free\fP (struct evhttp *http)"
.br
.RI "\fIFree the previously created HTTP server\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL char * \fBevhttp_htmlescape\fP (const char *html)"
.br
.RI "\fIEscape HTML character entities in a string\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL int \fBevhttp_make_request\fP (struct evhttp_connection *evcon, struct evhttp_request *req, enum \fBevhttp_cmd_type\fP type, const char *uri)"
.br
.RI "\fIMake an HTTP request over the specified connection\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL struct evhttp * \fBevhttp_new\fP (struct \fBevent_base\fP *base)"
.br
.RI "\fICreate a new HTTP server\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL int \fBevhttp_parse_query\fP (const char *uri, struct evkeyvalq *headers)"
.br
.RI "\fIHelper function to parse out arguments in a query\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL int \fBevhttp_parse_query_str\fP (const char *uri, struct evkeyvalq *headers)"
.br
.RI "\fIHelper function to parse out arguments from the query portion of an HTTP URI\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL int \fBevhttp_remove_header\fP (struct evkeyvalq *headers, const char *key)"
.br
.RI "\fIRemoves a header from a list of existing headers\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL int \fBevhttp_remove_server_alias\fP (struct evhttp *http, const char *alias)"
.br
.RI "\fIRemove a server alias from an http object\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL int \fBevhttp_remove_virtual_host\fP (struct evhttp *http, struct evhttp *vhost)"
.br
.RI "\fIRemoves a virtual host from the http server\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL void \fBevhttp_request_free\fP (struct evhttp_request *req)"
.br
.RI "\fIFrees the request object and removes associated events\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL enum \fBevhttp_cmd_type\fP \fBevhttp_request_get_command\fP (const struct evhttp_request *req)"
.br
.RI "\fIReturns the request command\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL struct evhttp_connection * \fBevhttp_request_get_connection\fP (struct evhttp_request *req)"
.br
.RI "\fIReturns the connection object associated with the request or NULL\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL const struct evhttp_uri * \fBevhttp_request_get_evhttp_uri\fP (const struct evhttp_request *req)"
.br
.RI "\fIReturns the request URI (parsed) \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL const char * \fBevhttp_request_get_host\fP (struct evhttp_request *req)"
.br
.RI "\fIReturns the host associated with the request\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL struct \fBevbuffer\fP * \fBevhttp_request_get_input_buffer\fP (struct evhttp_request *req)"
.br
.RI "\fIReturns the input buffer\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL struct evkeyvalq * \fBevhttp_request_get_input_headers\fP (struct evhttp_request *req)"
.br
.RI "\fIReturns the input headers\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL struct \fBevbuffer\fP * \fBevhttp_request_get_output_buffer\fP (struct evhttp_request *req)"
.br
.RI "\fIReturns the output buffer\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL struct evkeyvalq * \fBevhttp_request_get_output_headers\fP (struct evhttp_request *req)"
.br
.RI "\fIReturns the output headers\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL int \fBevhttp_request_get_response_code\fP (const struct evhttp_request *req)"
.br
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL const char * \fBevhttp_request_get_response_code_line\fP (const struct evhttp_request *req)"
.br
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL const char * \fBevhttp_request_get_uri\fP (const struct evhttp_request *req)"
.br
.RI "\fIReturns the request URI\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL int \fBevhttp_request_is_owned\fP (struct evhttp_request *req)"
.br
.RI "\fIReturns 1 if the request is owned by the user\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL struct evhttp_request * \fBevhttp_request_new\fP (void(*cb)(struct evhttp_request *, void *), void *arg)"
.br
.RI "\fICreates a new request object that needs to be filled in with the request parameters\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL void \fBevhttp_request_own\fP (struct evhttp_request *req)"
.br
.RI "\fITakes ownership of the request object\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL void \fBevhttp_request_set_chunked_cb\fP (struct evhttp_request *, void(*cb)(struct evhttp_request *, void *))"
.br
.RI "\fIEnable delivery of chunks to requestor\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL void \fBevhttp_request_set_error_cb\fP (struct evhttp_request *, void(*)(enum \fBevhttp_request_error\fP, void *))"
.br
.RI "\fISet a callback for errors\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL void \fBevhttp_request_set_header_cb\fP (struct evhttp_request *, int(*cb)(struct evhttp_request *, void *))"
.br
.RI "\fIRegister callback for additional parsing of request headers\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL void \fBevhttp_request_set_on_complete_cb\fP (struct evhttp_request *req, void(*cb)(struct evhttp_request *, void *), void *cb_arg)"
.br
.RI "\fISet a callback to be called on request completion of evhttp_send_* function\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL void \fBevhttp_send_error\fP (struct evhttp_request *req, int error, const char *reason)"
.br
.RI "\fISend an HTML error message to the client\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL void \fBevhttp_send_reply\fP (struct evhttp_request *req, int code, const char *reason, struct \fBevbuffer\fP *databuf)"
.br
.RI "\fISend an HTML reply to the client\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL void \fBevhttp_send_reply_chunk\fP (struct evhttp_request *req, struct \fBevbuffer\fP *databuf)"
.br
.RI "\fISend another data chunk as part of an ongoing chunked reply\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL void \fBevhttp_send_reply_chunk_with_cb\fP (struct evhttp_request *, struct \fBevbuffer\fP *, void(*cb)(struct evhttp_connection *, void *), void *arg)"
.br
.RI "\fISend another data chunk as part of an ongoing chunked reply\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL void \fBevhttp_send_reply_end\fP (struct evhttp_request *req)"
.br
.RI "\fIComplete a chunked reply, freeing the request as appropriate\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL void \fBevhttp_send_reply_start\fP (struct evhttp_request *req, int code, const char *reason)"
.br
.RI "\fIInitiate a reply that uses Transfer-Encoding chunked\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL void \fBevhttp_set_allowed_methods\fP (struct evhttp *http, ev_uint16_t methods)"
.br
.RI "\fISets the what HTTP methods are supported in requests accepted by this server, and passed to user callbacks\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL void \fBevhttp_set_bevcb\fP (struct evhttp *http, struct \fBbufferevent\fP *(*cb)(struct \fBevent_base\fP *, void *), void *arg)"
.br
.RI "\fISet a callback used to create new bufferevents for connections to a given evhttp object\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL int \fBevhttp_set_cb\fP (struct evhttp *http, const char *path, void(*cb)(struct evhttp_request *, void *), void *cb_arg)"
.br
.RI "\fISet a callback for a specified URI\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL void \fBevhttp_set_default_content_type\fP (struct evhttp *http, const char *content_type)"
.br
.RI "\fISet the value to use for the Content-Type header when none was provided\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL int \fBevhttp_set_flags\fP (struct evhttp *http, int flags)"
.br
.RI "\fISet connection flags for HTTP server\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL void \fBevhttp_set_gencb\fP (struct evhttp *http, void(*cb)(struct evhttp_request *, void *), void *arg)"
.br
.RI "\fISet a callback for all requests that are not caught by specific callbacks\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL void \fBevhttp_set_max_body_size\fP (struct evhttp *http, ev_ssize_t max_body_size)"
.br
.RI "\fIXXX Document\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL void \fBevhttp_set_max_headers_size\fP (struct evhttp *http, ev_ssize_t max_headers_size)"
.br
.RI "\fIXXX Document\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL void \fBevhttp_set_timeout\fP (struct evhttp *http, int timeout_in_secs)"
.br
.RI "\fISet the timeout for an HTTP request\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL void \fBevhttp_set_timeout_tv\fP (struct evhttp *http, const struct timeval *tv)"
.br
.RI "\fISet the timeout for an HTTP request\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL void \fBevhttp_uri_free\fP (struct evhttp_uri *uri)"
.br
.RI "\fIFree all memory allocated for a parsed uri\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL const char * \fBevhttp_uri_get_fragment\fP (const struct evhttp_uri *uri)"
.br
.RI "\fIReturn the fragment part of an evhttp_uri (excluding the leading '#'), or NULL if it has no fragment set\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL const char * \fBevhttp_uri_get_host\fP (const struct evhttp_uri *uri)"
.br
.RI "\fIReturn the host part of an evhttp_uri, or NULL if it has no host set\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL const char * \fBevhttp_uri_get_path\fP (const struct evhttp_uri *uri)"
.br
.RI "\fIReturn the path part of an evhttp_uri, or NULL if it has no path set\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL int \fBevhttp_uri_get_port\fP (const struct evhttp_uri *uri)"
.br
.RI "\fIReturn the port part of an evhttp_uri, or -1 if there is no port set\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL const char * \fBevhttp_uri_get_query\fP (const struct evhttp_uri *uri)"
.br
.RI "\fIReturn the query part of an evhttp_uri (excluding the leading '?'), or NULL if it has no query set\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL const char * \fBevhttp_uri_get_scheme\fP (const struct evhttp_uri *uri)"
.br
.RI "\fIReturn the scheme of an evhttp_uri, or NULL if there is no scheme has been set and the evhttp_uri contains a Relative-Ref\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL const char * \fBevhttp_uri_get_userinfo\fP (const struct evhttp_uri *uri)"
.br
.RI "\fIReturn the userinfo part of an evhttp_uri, or NULL if it has no userinfo set\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL char * \fBevhttp_uri_join\fP (struct evhttp_uri *uri, char *buf, size_t limit)"
.br
.RI "\fIJoin together the uri parts from parsed data to form a URI-Reference\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL struct evhttp_uri * \fBevhttp_uri_new\fP (void)"
.br
.RI "\fIReturn a new empty evhttp_uri with no fields set\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL struct evhttp_uri * \fBevhttp_uri_parse\fP (const char *source_uri)"
.br
.RI "\fIAlias for evhttp_uri_parse_with_flags(source_uri, 0) \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL struct evhttp_uri * \fBevhttp_uri_parse_with_flags\fP (const char *source_uri, unsigned flags)"
.br
.RI "\fIHelper function to parse a URI-Reference as specified by RFC3986\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL void \fBevhttp_uri_set_flags\fP (struct evhttp_uri *uri, unsigned flags)"
.br
.RI "\fIChanges the flags set on a given URI\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL int \fBevhttp_uri_set_fragment\fP (struct evhttp_uri *uri, const char *fragment)"
.br
.RI "\fISet the fragment of an evhttp_uri, or clear the fragment if fragment==NULL\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL int \fBevhttp_uri_set_host\fP (struct evhttp_uri *uri, const char *host)"
.br
.RI "\fISet the host of an evhttp_uri, or clear the host if host==NULL\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL int \fBevhttp_uri_set_path\fP (struct evhttp_uri *uri, const char *path)"
.br
.RI "\fISet the path of an evhttp_uri, or clear the path if path==NULL\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL int \fBevhttp_uri_set_port\fP (struct evhttp_uri *uri, int port)"
.br
.RI "\fISet the port of an evhttp_uri, or clear the port if port==-1\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL int \fBevhttp_uri_set_query\fP (struct evhttp_uri *uri, const char *query)"
.br
.RI "\fISet the query of an evhttp_uri, or clear the query if query==NULL\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL int \fBevhttp_uri_set_scheme\fP (struct evhttp_uri *uri, const char *scheme)"
.br
.RI "\fISet the scheme of an evhttp_uri, or clear the scheme if scheme==NULL\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL int \fBevhttp_uri_set_userinfo\fP (struct evhttp_uri *uri, const char *userinfo)"
.br
.RI "\fISet the userinfo of an evhttp_uri, or clear the userinfo if userinfo==NULL\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL char * \fBevhttp_uridecode\fP (const char *uri, int decode_plus, size_t *size_out)"
.br
.RI "\fIHelper function to decode a URI-escaped string or HTTP parameter\&. \fP"
.ti -1c
.RI "EVENT2_EXPORT_SYMBOL char * \fBevhttp_uriencode\fP (const char *str, ev_ssize_t size, int space_to_plus)"
.br
.RI "\fIAs evhttp_encode_uri, but if 'size' is nonnegative, treat the string as being 'size' bytes long\&. \fP"
.in -1c
.SH "Detailed Description"
.PP
Basic support for HTTP serving\&.
As Libevent is a library for dealing with event notification and most interesting applications are networked today, I have often found the need to write HTTP code\&. The following prototypes and definitions provide an application with a minimal interface for making HTTP requests and for creating a very simple HTTP server\&.
.SH "Macro Definition Documentation"
.PP
.SS "#define EVHTTP_URI_NONCONFORMANT 0x01"
.PP
Tolerate URIs that do not conform to RFC3986\&. Unfortunately, some HTTP clients generate URIs that, according to RFC3986, are not conformant URIs\&. If you need to support these URIs, you can do so by passing this flag to evhttp_uri_parse_with_flags\&.
.PP
Currently, these changes are:
.PD 0
.IP "\(bu" 2
Nonconformant URIs are allowed to contain otherwise unreasonable characters in their path, query, and fragment components\&.
.PP
.SH "Enumeration Type Documentation"
.PP
.SS "enum \fBevhttp_cmd_type\fP"
.PP
The different request types supported by evhttp\&. These are as specified in RFC2616, except for PATCH which is specified by RFC5789\&.
.PP
By default, only some of these methods are accepted and passed to user callbacks; use \fBevhttp_set_allowed_methods()\fP to change which methods are allowed\&.
.SS "enum \fBevhttp_request_error\fP"
.PP
The different error types supported by evhttp\&.
.PP
\fBSee also:\fP
.RS 4
\fBevhttp_request_set_error_cb()\fP
.RE
.PP
.PP
\fBEnumerator\fP
.in +1c
.TP
\fB\fIEVREQ_HTTP_TIMEOUT \fP\fP
Timeout reached, also\&.
.PP
\fBSee also:\fP
.RS 4
\fBevhttp_connection_set_timeout()\fP
.RE
.PP
.TP
\fB\fIEVREQ_HTTP_EOF \fP\fP
EOF reached\&.
.TP
\fB\fIEVREQ_HTTP_INVALID_HEADER \fP\fP
Error while reading header, or invalid header\&.
.TP
\fB\fIEVREQ_HTTP_BUFFER_ERROR \fP\fP
Error encountered while reading or writing\&.
.TP
\fB\fIEVREQ_HTTP_REQUEST_CANCEL \fP\fP
The \fBevhttp_cancel_request()\fP called on this request\&.
.TP
\fB\fIEVREQ_HTTP_DATA_TOO_LONG \fP\fP
Body is greater then evhttp_connection_set_max_body_size()
.SH "Function Documentation"
.PP
.SS "EVENT2_EXPORT_SYMBOL int evhttp_accept_socket (struct evhttp * http, \fBevutil_socket_t\fP fd)"
.PP
Makes an HTTP server accept connections on the specified socket\&. This may be useful to create a socket and then fork multiple instances of an http server, or when a socket has been communicated via file descriptor passing in situations where an http servers does not have permissions to bind to a low-numbered port\&.
.PP
Can be called multiple times to have the http server listen to multiple different sockets\&.
.PP
\fBParameters:\fP
.RS 4
\fIhttp\fP a pointer to an evhttp object
.br
\fIfd\fP a socket fd that is ready for accepting connections
.RE
.PP
\fBReturns:\fP
.RS 4
0 on success, -1 on failure\&.
.RE
.PP
\fBSee also:\fP
.RS 4
\fBevhttp_bind_socket()\fP
.RE
.PP
.SS "EVENT2_EXPORT_SYMBOL struct evhttp_bound_socket* evhttp_accept_socket_with_handle (struct evhttp * http, \fBevutil_socket_t\fP fd)"
.PP
Like \fBevhttp_accept_socket()\fP, but returns a handle for referencing the socket\&. The returned pointer is not valid after \fIhttp\fP is freed\&.
.PP
\fBParameters:\fP
.RS 4
\fIhttp\fP a pointer to an evhttp object
.br
\fIfd\fP a socket fd that is ready for accepting connections
.RE
.PP
\fBReturns:\fP
.RS 4
Handle for the socket on success, NULL on failure\&.
.RE
.PP
\fBSee also:\fP
.RS 4
\fBevhttp_accept_socket()\fP, \fBevhttp_del_accept_socket()\fP
.RE
.PP
.SS "EVENT2_EXPORT_SYMBOL int evhttp_add_header (struct evkeyvalq * headers, const char * key, const char * value)"
.PP
Adds a header to a list of existing headers\&.
.PP
\fBParameters:\fP
.RS 4
\fIheaders\fP the evkeyvalq object to which to add a header
.br
\fIkey\fP the name of the header
.br
\fIvalue\fP the value belonging to the header
.RE
.PP
\fBReturns:\fP
.RS 4
0 on success, -1 otherwise\&.
.RE
.PP
\fBSee also:\fP
.RS 4
\fBevhttp_find_header()\fP, \fBevhttp_clear_headers()\fP
.RE
.PP
.SS "EVENT2_EXPORT_SYMBOL int evhttp_add_server_alias (struct evhttp * http, const char * alias)"
.PP
Add a server alias to an http object\&. The http object can be a virtual host or the main server\&.
.PP
\fBParameters:\fP
.RS 4
\fIhttp\fP the evhttp object
.br
\fIalias\fP the alias to add
.RE
.PP
\fBSee also:\fP
.RS 4
evhttp_add_remove_alias()
.RE
.PP
.SS "EVENT2_EXPORT_SYMBOL int evhttp_add_virtual_host (struct evhttp * http, const char * pattern, struct evhttp * vhost)"
.PP
Adds a virtual host to the http server\&. A virtual host is a newly initialized evhttp object that has request callbacks set on it via \fBevhttp_set_cb()\fP or \fBevhttp_set_gencb()\fP\&. It most not have any listing sockets associated with it\&.
.PP
If the virtual host has not been removed by the time that \fBevhttp_free()\fP is called on the main http server, it will be automatically freed, too\&.
.PP
It is possible to have hierarchical vhosts\&. For example: A vhost with the pattern *\&.example\&.com may have other vhosts with patterns foo\&.example\&.com and bar\&.example\&.com associated with it\&.
.PP
\fBParameters:\fP
.RS 4
\fIhttp\fP the evhttp object to which to add a virtual host
.br
\fIpattern\fP the glob pattern against which the hostname is matched\&. The match is case insensitive and follows otherwise regular shell matching\&.
.br
\fIvhost\fP the virtual host to add the regular http server\&.
.RE
.PP
\fBReturns:\fP
.RS 4
0 on success, -1 on failure
.RE
.PP
\fBSee also:\fP
.RS 4
\fBevhttp_remove_virtual_host()\fP
.RE
.PP
.SS "EVENT2_EXPORT_SYMBOL struct evhttp_bound_socket* evhttp_bind_listener (struct evhttp * http, struct evconnlistener * listener)"
.PP
The most low-level evhttp_bind/accept method: takes an evconnlistener, and returns an evhttp_bound_socket\&. The listener will be freed when the bound socket is freed\&.
.SS "EVENT2_EXPORT_SYMBOL int evhttp_bind_socket (struct evhttp * http, const char * address, ev_uint16_t port)"
.PP
Binds an HTTP server on the specified address and port\&. Can be called multiple times to bind the same http server to multiple different ports\&.
.PP
\fBParameters:\fP
.RS 4
\fIhttp\fP a pointer to an evhttp object
.br
\fIaddress\fP a string containing the IP address to listen(2) on
.br
\fIport\fP the port number to listen on
.RE
.PP
\fBReturns:\fP
.RS 4
0 on success, -1 on failure\&.
.RE
.PP
\fBSee also:\fP
.RS 4
\fBevhttp_accept_socket()\fP
.RE
.PP
.SS "EVENT2_EXPORT_SYMBOL struct evhttp_bound_socket* evhttp_bind_socket_with_handle (struct evhttp * http, const char * address, ev_uint16_t port)"
.PP
Like \fBevhttp_bind_socket()\fP, but returns a handle for referencing the socket\&. The returned pointer is not valid after \fIhttp\fP is freed\&.
.PP
\fBParameters:\fP
.RS 4
\fIhttp\fP a pointer to an evhttp object
.br
\fIaddress\fP a string containing the IP address to listen(2) on
.br
\fIport\fP the port number to listen on
.RE
.PP
\fBReturns:\fP
.RS 4
Handle for the socket on success, NULL on failure\&.
.RE
.PP
\fBSee also:\fP
.RS 4
\fBevhttp_bind_socket()\fP, \fBevhttp_del_accept_socket()\fP
.RE
.PP
.SS "EVENT2_EXPORT_SYMBOL \fBevutil_socket_t\fP evhttp_bound_socket_get_fd (struct evhttp_bound_socket * bound_socket)"
.PP
Get the raw file descriptor referenced by an evhttp_bound_socket\&.
.PP
\fBParameters:\fP
.RS 4
\fIbound_socket\fP a handle returned by evhttp_{bind,accept}_socket_with_handle
.RE
.PP
\fBReturns:\fP
.RS 4
the file descriptor used by the bound socket
.RE
.PP
\fBSee also:\fP
.RS 4
\fBevhttp_bind_socket_with_handle()\fP, \fBevhttp_accept_socket_with_handle()\fP
.RE
.PP
.SS "EVENT2_EXPORT_SYMBOL void evhttp_cancel_request (struct evhttp_request * req)"
.PP
Cancels a pending HTTP request\&. Cancels an ongoing HTTP request\&. The callback associated with this request is not executed and the request object is freed\&. If the request is currently being processed, e\&.g\&. it is ongoing, the corresponding evhttp_connection object is going to get reset\&.
.PP
A request cannot be canceled if its callback has executed already\&. A request may be canceled reentrantly from its chunked callback\&.
.PP
\fBParameters:\fP
.RS 4
\fIreq\fP the evhttp_request to cancel; req becomes invalid after this call\&.
.RE
.PP
.SS "EVENT2_EXPORT_SYMBOL void evhttp_clear_headers (struct evkeyvalq * headers)"
.PP
Removes all headers from the header list\&.
.PP
\fBParameters:\fP
.RS 4
\fIheaders\fP the evkeyvalq object from which to remove all headers
.RE
.PP
.SS "EVENT2_EXPORT_SYMBOL struct evhttp_connection* evhttp_connection_base_bufferevent_new (struct \fBevent_base\fP * base, struct evdns_base * dnsbase, struct \fBbufferevent\fP * bev, const char * address, ev_uint16_t port)"
.PP
Create and return a connection object that can be used to for making HTTP requests\&. The connection object tries to resolve address and establish the connection when it is given an http request object\&.
.PP
\fBParameters:\fP
.RS 4
\fIbase\fP the \fBevent_base\fP to use for handling the connection
.br
\fIdnsbase\fP the dns_base to use for resolving host names; if not specified host name resolution will block\&.
.br
\fIbev\fP a bufferevent to use for connecting to the server; if NULL, a socket-based bufferevent will be created\&. This buffrevent will be freed when the connection closes\&. It must have no fd set on it\&.
.br
\fIaddress\fP the address to which to connect
.br
\fIport\fP the port to connect to
.RE
.PP
\fBReturns:\fP
.RS 4
an evhttp_connection object that can be used for making requests
.RE
.PP
.SS "EVENT2_EXPORT_SYMBOL struct evhttp_connection* evhttp_connection_base_new (struct \fBevent_base\fP * base, struct evdns_base * dnsbase, const char * address, ev_uint16_t port)"
.PP
Create and return a connection object that can be used to for making HTTP requests\&. The connection object tries to resolve address and establish the connection when it is given an http request object\&.
.PP
\fBParameters:\fP
.RS 4
\fIbase\fP the \fBevent_base\fP to use for handling the connection
.br
\fIdnsbase\fP the dns_base to use for resolving host names; if not specified host name resolution will block\&.
.br
\fIaddress\fP the address to which to connect
.br
\fIport\fP the port to connect to
.RE
.PP
\fBReturns:\fP
.RS 4
an evhttp_connection object that can be used for making requests
.RE
.PP
.SS "EVENT2_EXPORT_SYMBOL void evhttp_connection_free_on_completion (struct evhttp_connection * evcon)"
.PP
Disowns a given connection object\&. Can be used to tell libevent to free the connection object after the last request has completed or failed\&.
.SS "EVENT2_EXPORT_SYMBOL const struct sockaddr* evhttp_connection_get_addr (struct evhttp_connection * evcon)"
.PP
Get the remote address associated with this connection\&. extracted from getpeername() OR from nameserver\&.
.PP
\fBReturns:\fP
.RS 4
NULL if getpeername() return non success, or connection is not connected, otherwise it return pointer to struct sockaddr_storage
.RE
.PP
.SS "EVENT2_EXPORT_SYMBOL void evhttp_connection_get_peer (struct evhttp_connection * evcon, char ** address, ev_uint16_t * port)"
.PP
Get the remote address and port associated with this connection\&.
.SS "EVENT2_EXPORT_SYMBOL void evhttp_connection_set_closecb (struct evhttp_connection * evcon, void(*)(struct evhttp_connection *, void *), void *)"
.PP
Set a callback for connection close\&.
.SS "EVENT2_EXPORT_SYMBOL int evhttp_connection_set_flags (struct evhttp_connection * evcon, int flags)"
.PP
Set connection flags\&.
.PP
\fBSee also:\fP
.RS 4
EVHTTP_CON_*
.RE
.PP
\fBReturns:\fP
.RS 4
0 on success, otherwise non zero (for example if flag doesn't supported)\&.
.RE
.PP
.SS "EVENT2_EXPORT_SYMBOL void evhttp_connection_set_initial_retry_tv (struct evhttp_connection * evcon, const struct timeval * tv)"
.PP
Sets the delay before retrying requests on this connection\&. This is only used if evhttp_connection_set_retries is used to make the number of retries at least one\&. Each retry after the first is twice as long as the one before it\&.
.SS "EVENT2_EXPORT_SYMBOL void evhttp_connection_set_timeout_tv (struct evhttp_connection * evcon, const struct timeval * tv)"
.PP
Sets the timeout for events related to this connection\&. Takes a struct timeval\&.
.SS "EVENT2_EXPORT_SYMBOL char* evhttp_decode_uri (const char * uri)"
.PP
Helper function to sort of decode a URI-encoded string\&. Unlike evhttp_get_decoded_uri, it decodes all plus characters that appear \fIafter\fP the first question mark character, but no plusses that occur before\&. This is not a good way to decode URIs in whole or in part\&.
.PP
The returned string must be freed by the caller
.PP
\fBDeprecated\fP
.RS 4
This function is deprecated; you probably want to use evhttp_get_decoded_uri instead\&.
.RE
.PP
.PP
\fBParameters:\fP
.RS 4
\fIuri\fP an encoded URI
.RE
.PP
\fBReturns:\fP
.RS 4
a newly allocated unencoded URI or NULL on failure
.RE
.PP
.SS "EVENT2_EXPORT_SYMBOL void evhttp_del_accept_socket (struct evhttp * http, struct evhttp_bound_socket * bound_socket)"
.PP
Makes an HTTP server stop accepting connections on the specified socket\&. This may be useful when a socket has been sent via file descriptor passing and is no longer needed by the current process\&.
.PP
If you created this bound socket with evhttp_bind_socket_with_handle or evhttp_accept_socket_with_handle, this function closes the fd you provided\&. If you created this bound socket with evhttp_bind_listener, this function frees the listener you provided\&.
.PP
\fIbound_socket\fP is an invalid pointer after this call returns\&.
.PP
\fBParameters:\fP
.RS 4
\fIhttp\fP a pointer to an evhttp object
.br
\fIbound_socket\fP a handle returned by evhttp_{bind,accept}_socket_with_handle
.RE
.PP
\fBSee also:\fP
.RS 4
\fBevhttp_bind_socket_with_handle()\fP, \fBevhttp_accept_socket_with_handle()\fP
.RE
.PP
.SS "EVENT2_EXPORT_SYMBOL char* evhttp_encode_uri (const char * str)"
.PP
Helper function to encode a string for inclusion in a URI\&. All characters are replaced by their hex-escaped (%22) equivalents, except for characters explicitly unreserved by RFC3986 -- that is, ASCII alphanumeric characters, hyphen, dot, underscore, and tilde\&.
.PP
The returned string must be freed by the caller\&.
.PP
\fBParameters:\fP
.RS 4
\fIstr\fP an unencoded string
.RE
.PP
\fBReturns:\fP
.RS 4
a newly allocated URI-encoded string or NULL on failure
.RE
.PP
.SS "EVENT2_EXPORT_SYMBOL const char* evhttp_find_header (const struct evkeyvalq * headers, const char * key)"
.PP
Finds the value belonging to a header\&.
.PP
\fBParameters:\fP
.RS 4
\fIheaders\fP the evkeyvalq object in which to find the header
.br
\fIkey\fP the name of the header to find
.RE
.PP
\fBReturns:\fP
.RS 4
a pointer to the value for the header or NULL if the header could not be found\&.
.RE
.PP
\fBSee also:\fP
.RS 4
\fBevhttp_add_header()\fP, \fBevhttp_remove_header()\fP
.RE
.PP
.SS "EVENT2_EXPORT_SYMBOL void evhttp_foreach_bound_socket (struct evhttp * http, evhttp_bound_socket_foreach_fn * function, void * argument)"
.PP
Applies the function specified in the first argument to all evhttp_bound_sockets associated with 'http'\&. The user must not attempt to free or remove any connections, sockets or listeners in the callback 'function'\&.
.PP
\fBParameters:\fP
.RS 4
\fIhttp\fP pointer to an evhttp object
.br
\fIfunction\fP function to apply to every bound socket
.br
\fIargument\fP pointer value passed to function for every socket iterated
.RE
.PP
.SS "EVENT2_EXPORT_SYMBOL void evhttp_free (struct evhttp * http)"
.PP
Free the previously created HTTP server\&. Works only if no requests are currently being served\&.
.PP
\fBParameters:\fP
.RS 4
\fIhttp\fP the evhttp server object to be freed
.RE
.PP
\fBSee also:\fP
.RS 4
\fBevhttp_start()\fP
.RE
.PP
.SS "EVENT2_EXPORT_SYMBOL char* evhttp_htmlescape (const char * html)"
.PP
Escape HTML character entities in a string\&. Replaces <, >, ", ' and & with <, >, ", ' and & correspondingly\&.
.PP
The returned string needs to be freed by the caller\&.
.PP
\fBParameters:\fP
.RS 4
\fIhtml\fP an unescaped HTML string
.RE
.PP
\fBReturns:\fP
.RS 4
an escaped HTML string or NULL on error
.RE
.PP
.SS "EVENT2_EXPORT_SYMBOL int evhttp_make_request (struct evhttp_connection * evcon, struct evhttp_request * req, enum \fBevhttp_cmd_type\fP type, const char * uri)"
.PP
Make an HTTP request over the specified connection\&. The connection gets ownership of the request\&. On failure, the request object is no longer valid as it has been freed\&.
.PP
\fBParameters:\fP
.RS 4
\fIevcon\fP the evhttp_connection object over which to send the request
.br
\fIreq\fP the previously created and configured request object
.br
\fItype\fP the request type EVHTTP_REQ_GET, EVHTTP_REQ_POST, etc\&.
.br
\fIuri\fP the URI associated with the request
.RE
.PP
\fBReturns:\fP
.RS 4
0 on success, -1 on failure
.RE
.PP
\fBSee also:\fP
.RS 4
\fBevhttp_cancel_request()\fP
.RE
.PP
.SS "EVENT2_EXPORT_SYMBOL struct evhttp* evhttp_new (struct \fBevent_base\fP * base)"
.PP
Create a new HTTP server\&.
.PP
\fBParameters:\fP
.RS 4
\fIbase\fP (optional) the event base to receive the HTTP events
.RE
.PP
\fBReturns:\fP
.RS 4
a pointer to a newly initialized evhttp server structure
.RE
.PP
\fBSee also:\fP
.RS 4
\fBevhttp_free()\fP
.RE
.PP
.SS "EVENT2_EXPORT_SYMBOL int evhttp_parse_query (const char * uri, struct evkeyvalq * headers)"
.PP
Helper function to parse out arguments in a query\&. Parsing a URI like
.PP
http://foo.com/?q=test&s=some+thing
.PP
will result in two entries in the key value queue\&.
.PP
The first entry is: key='q', value='test' The second entry is: key='s', value='some thing'
.PP
\fBDeprecated\fP
.RS 4
This function is deprecated as of Libevent 2\&.0\&.9\&. Use evhttp_uri_parse and evhttp_parse_query_str instead\&.
.RE
.PP
.PP
\fBParameters:\fP
.RS 4
\fIuri\fP the request URI
.br
\fIheaders\fP the head of the evkeyval queue
.RE
.PP
\fBReturns:\fP
.RS 4
0 on success, -1 on failure
.RE
.PP
.SS "EVENT2_EXPORT_SYMBOL int evhttp_parse_query_str (const char * uri, struct evkeyvalq * headers)"
.PP
Helper function to parse out arguments from the query portion of an HTTP URI\&. Parsing a query string like
.PP
q=test&s=some+thing
.PP
will result in two entries in the key value queue\&.
.PP
The first entry is: key='q', value='test' The second entry is: key='s', value='some thing'
.PP
\fBParameters:\fP
.RS 4
\fIquery_parse\fP the query portion of the URI
.br
\fIheaders\fP the head of the evkeyval queue
.RE
.PP
\fBReturns:\fP
.RS 4
0 on success, -1 on failure
.RE
.PP
.SS "EVENT2_EXPORT_SYMBOL int evhttp_remove_header (struct evkeyvalq * headers, const char * key)"
.PP
Removes a header from a list of existing headers\&.
.PP
\fBParameters:\fP
.RS 4
\fIheaders\fP the evkeyvalq object from which to remove a header
.br
\fIkey\fP the name of the header to remove
.RE
.PP
\fBReturns:\fP
.RS 4
0 if the header was removed, -1 otherwise\&.
.RE
.PP
\fBSee also:\fP
.RS 4
\fBevhttp_find_header()\fP, \fBevhttp_add_header()\fP
.RE
.PP
.SS "EVENT2_EXPORT_SYMBOL int evhttp_remove_server_alias (struct evhttp * http, const char * alias)"
.PP
Remove a server alias from an http object\&.
.PP
\fBParameters:\fP
.RS 4
\fIhttp\fP the evhttp object
.br
\fIalias\fP the alias to remove
.RE
.PP
\fBSee also:\fP
.RS 4
\fBevhttp_add_server_alias()\fP
.RE
.PP
.SS "EVENT2_EXPORT_SYMBOL int evhttp_remove_virtual_host (struct evhttp * http, struct evhttp * vhost)"
.PP
Removes a virtual host from the http server\&.
.PP
\fBParameters:\fP
.RS 4
\fIhttp\fP the evhttp object from which to remove the virtual host
.br
\fIvhost\fP the virtual host to remove from the regular http server\&.
.RE
.PP
\fBReturns:\fP
.RS 4
0 on success, -1 on failure
.RE
.PP
\fBSee also:\fP
.RS 4
\fBevhttp_add_virtual_host()\fP
.RE
.PP
.SS "EVENT2_EXPORT_SYMBOL void evhttp_request_free (struct evhttp_request * req)"
.PP
Frees the request object and removes associated events\&.
.SS "EVENT2_EXPORT_SYMBOL struct evhttp_connection* evhttp_request_get_connection (struct evhttp_request * req)"
.PP
Returns the connection object associated with the request or NULL\&. The user needs to either free the request explicitly or call \fBevhttp_send_reply_end()\fP\&.
.SS "EVENT2_EXPORT_SYMBOL const char* evhttp_request_get_host (struct evhttp_request * req)"
.PP
Returns the host associated with the request\&. If a client sends an absolute URI, the host part of that is preferred\&. Otherwise, the input headers are searched for a Host: header\&. NULL is returned if no absolute URI or Host: header is provided\&.
.SS "EVENT2_EXPORT_SYMBOL struct evhttp_request* evhttp_request_new (void(*)(struct evhttp_request *, void *) cb, void * arg)"
.PP
Creates a new request object that needs to be filled in with the request parameters\&. The callback is executed when the request completed or an error occurred\&.
.SS "EVENT2_EXPORT_SYMBOL void evhttp_request_own (struct evhttp_request * req)"
.PP
Takes ownership of the request object\&. Can be used in a request callback to keep onto the request until \fBevhttp_request_free()\fP is explicitly called by the user\&.
.SS "EVENT2_EXPORT_SYMBOL void evhttp_request_set_chunked_cb (struct evhttp_request *, void(*)(struct evhttp_request *, void *) cb)"
.PP
Enable delivery of chunks to requestor\&.
.PP
\fBParameters:\fP
.RS 4
\fIcb\fP will be called after every read of data with the same argument as the completion callback\&. Will never be called on an empty response\&. May drain the input buffer; it will be drained automatically on return\&.
.RE
.PP
.SS "EVENT2_EXPORT_SYMBOL void evhttp_request_set_error_cb (struct evhttp_request *, void(*)(enum \fBevhttp_request_error\fP, void *))"
.PP
Set a callback for errors\&.
.PP
\fBSee also:\fP
.RS 4
\fBevhttp_request_error\fP for error types\&.
.RE
.PP
On error, both the error callback and the regular callback will be called, error callback is called before the regular callback\&.
.SS "EVENT2_EXPORT_SYMBOL void evhttp_request_set_header_cb (struct evhttp_request *, int(*)(struct evhttp_request *, void *) cb)"
.PP
Register callback for additional parsing of request headers\&.
.PP
\fBParameters:\fP
.RS 4
\fIcb\fP will be called after receiving and parsing the full header\&. It allows analyzing the header and possibly closing the connection by returning a value < 0\&.
.RE
.PP
.SS "EVENT2_EXPORT_SYMBOL void evhttp_request_set_on_complete_cb (struct evhttp_request * req, void(*)(struct evhttp_request *, void *) cb, void * cb_arg)"
.PP
Set a callback to be called on request completion of evhttp_send_* function\&. The callback function will be called on the completion of the request after the output data has been written and before the evhttp_request object is destroyed\&. This can be useful for tracking resources associated with a request (ex: timing metrics)\&.
.PP
\fBParameters:\fP
.RS 4
\fIreq\fP a request object
.br
\fIcb\fP callback function that will be called on request completion
.br
\fIcb_arg\fP an additional context argument for the callback
.RE
.PP
.SS "EVENT2_EXPORT_SYMBOL void evhttp_send_error (struct evhttp_request * req, int error, const char * reason)"
.PP
Send an HTML error message to the client\&.
.PP
\fBParameters:\fP
.RS 4
\fIreq\fP a request object
.br
\fIerror\fP the HTTP error code
.br
\fIreason\fP a brief explanation of the error\&. If this is NULL, we'll just use the standard meaning of the error code\&.
.RE
.PP
.SS "EVENT2_EXPORT_SYMBOL void evhttp_send_reply (struct evhttp_request * req, int code, const char * reason, struct \fBevbuffer\fP * databuf)"
.PP
Send an HTML reply to the client\&. The body of the reply consists of the data in databuf\&. After calling \fBevhttp_send_reply()\fP databuf will be empty, but the buffer is still owned by the caller and needs to be deallocated by the caller if necessary\&.
.PP
\fBParameters:\fP
.RS 4
\fIreq\fP a request object
.br
\fIcode\fP the HTTP response code to send
.br
\fIreason\fP a brief message to send with the response code
.br
\fIdatabuf\fP the body of the response
.RE
.PP
.SS "EVENT2_EXPORT_SYMBOL void evhttp_send_reply_chunk (struct evhttp_request * req, struct \fBevbuffer\fP * databuf)"
.PP
Send another data chunk as part of an ongoing chunked reply\&. The reply chunk consists of the data in databuf\&. After calling \fBevhttp_send_reply_chunk()\fP databuf will be empty, but the buffer is still owned by the caller and needs to be deallocated by the caller if necessary\&.
.PP
\fBParameters:\fP
.RS 4
\fIreq\fP a request object
.br
\fIdatabuf\fP the data chunk to send as part of the reply\&.
.RE
.PP
.SS "EVENT2_EXPORT_SYMBOL void evhttp_send_reply_chunk_with_cb (struct evhttp_request *, struct \fBevbuffer\fP *, void(*)(struct evhttp_connection *, void *) cb, void * arg)"
.PP
Send another data chunk as part of an ongoing chunked reply\&. The reply chunk consists of the data in databuf\&. After calling \fBevhttp_send_reply_chunk()\fP databuf will be empty, but the buffer is still owned by the caller and needs to be deallocated by the caller if necessary\&.
.PP
\fBParameters:\fP
.RS 4
\fIreq\fP a request object
.br
\fIdatabuf\fP the data chunk to send as part of the reply\&.
.br
\fIcb\fP callback funcion
.br
\fIcall\fP back's argument\&.
.RE
.PP
.SS "EVENT2_EXPORT_SYMBOL void evhttp_send_reply_end (struct evhttp_request * req)"
.PP
Complete a chunked reply, freeing the request as appropriate\&.
.PP
\fBParameters:\fP
.RS 4
\fIreq\fP a request object
.RE
.PP
.SS "EVENT2_EXPORT_SYMBOL void evhttp_send_reply_start (struct evhttp_request * req, int code, const char * reason)"
.PP
Initiate a reply that uses Transfer-Encoding chunked\&. This allows the caller to stream the reply back to the client and is useful when either not all of the reply data is immediately available or when sending very large replies\&.
.PP
The caller needs to supply data chunks with \fBevhttp_send_reply_chunk()\fP and complete the reply by calling \fBevhttp_send_reply_end()\fP\&.
.PP
\fBParameters:\fP
.RS 4
\fIreq\fP a request object
.br
\fIcode\fP the HTTP response code to send
.br
\fIreason\fP a brief message to send with the response code
.RE
.PP
.SS "EVENT2_EXPORT_SYMBOL void evhttp_set_allowed_methods (struct evhttp * http, ev_uint16_t methods)"
.PP
Sets the what HTTP methods are supported in requests accepted by this server, and passed to user callbacks\&. If not supported they will generate a '405 Method not allowed' response\&.
.PP
By default this includes the following methods: GET, POST, HEAD, PUT, DELETE
.PP
\fBParameters:\fP
.RS 4
\fIhttp\fP the http server on which to set the methods
.br
\fImethods\fP bit mask constructed from evhttp_cmd_type values
.RE
.PP
.SS "EVENT2_EXPORT_SYMBOL void evhttp_set_bevcb (struct evhttp * http, struct \fBbufferevent\fP *(*)(struct \fBevent_base\fP *, void *) cb, void * arg)"
.PP
Set a callback used to create new bufferevents for connections to a given evhttp object\&. You can use this to override the default bufferevent type -- for example, to make this evhttp object use SSL bufferevents rather than unencrypted ones\&.
.PP
New bufferevents must be allocated with no fd set on them\&.
.PP
\fBParameters:\fP
.RS 4
\fIhttp\fP the evhttp server object for which to set the callback
.br
\fIcb\fP the callback to invoke for incoming connections
.br
\fIarg\fP a context argument for the callback
.RE
.PP
.SS "EVENT2_EXPORT_SYMBOL int evhttp_set_cb (struct evhttp * http, const char * path, void(*)(struct evhttp_request *, void *) cb, void * cb_arg)"
.PP
Set a callback for a specified URI\&.
.PP
\fBParameters:\fP
.RS 4
\fIhttp\fP the http sever on which to set the callback
.br
\fIpath\fP the path for which to invoke the callback
.br
\fIcb\fP the callback function that gets invoked on requesting path
.br
\fIcb_arg\fP an additional context argument for the callback
.RE
.PP
\fBReturns:\fP
.RS 4
0 on success, -1 if the callback existed already, -2 on failure
.RE
.PP
.SS "EVENT2_EXPORT_SYMBOL void evhttp_set_default_content_type (struct evhttp * http, const char * content_type)"
.PP
Set the value to use for the Content-Type header when none was provided\&. If the content type string is NULL, the Content-Type header will not be automatically added\&.
.PP
\fBParameters:\fP
.RS 4
\fIhttp\fP the http server on which to set the default content type
.br
\fIcontent_type\fP the value for the Content-Type header
.RE
.PP
.SS "EVENT2_EXPORT_SYMBOL int evhttp_set_flags (struct evhttp * http, int flags)"
.PP
Set connection flags for HTTP server\&.
.PP
\fBSee also:\fP
.RS 4
EVHTTP_SERVER_*
.RE
.PP
\fBReturns:\fP
.RS 4
0 on success, otherwise non zero (for example if flag doesn't supported)\&.
.RE
.PP
.SS "EVENT2_EXPORT_SYMBOL void evhttp_set_gencb (struct evhttp * http, void(*)(struct evhttp_request *, void *) cb, void * arg)"
.PP
Set a callback for all requests that are not caught by specific callbacks\&. Invokes the specified callback for all requests that do not match any of the previously specified request paths\&. This is catchall for requests not specifically configured with \fBevhttp_set_cb()\fP\&.
.PP
\fBParameters:\fP
.RS 4
\fIhttp\fP the evhttp server object for which to set the callback
.br
\fIcb\fP the callback to invoke for any unmatched requests
.br
\fIarg\fP a context argument for the callback
.RE
.PP
.SS "EVENT2_EXPORT_SYMBOL void evhttp_set_max_body_size (struct evhttp * http, ev_ssize_t max_body_size)"
.PP
XXX Document\&.
.SS "EVENT2_EXPORT_SYMBOL void evhttp_set_max_headers_size (struct evhttp * http, ev_ssize_t max_headers_size)"
.PP
XXX Document\&.
.SS "EVENT2_EXPORT_SYMBOL void evhttp_set_timeout (struct evhttp * http, int timeout_in_secs)"
.PP
Set the timeout for an HTTP request\&.
.PP
\fBParameters:\fP
.RS 4
\fIhttp\fP an evhttp object
.br
\fItimeout_in_secs\fP the timeout, in seconds
.RE
.PP
.SS "EVENT2_EXPORT_SYMBOL void evhttp_set_timeout_tv (struct evhttp * http, const struct timeval * tv)"
.PP
Set the timeout for an HTTP request\&.
.PP
\fBParameters:\fP
.RS 4
\fIhttp\fP an evhttp object
.br
\fItv\fP the timeout, or NULL
.RE
.PP
.SS "EVENT2_EXPORT_SYMBOL void evhttp_uri_free (struct evhttp_uri * uri)"
.PP
Free all memory allocated for a parsed uri\&. Only use this for URIs generated by evhttp_uri_parse\&.
.PP
\fBParameters:\fP
.RS 4
\fIuri\fP container with parsed data
.RE
.PP
\fBSee also:\fP
.RS 4
\fBevhttp_uri_parse()\fP
.RE
.PP
.SS "EVENT2_EXPORT_SYMBOL const char* evhttp_uri_get_host (const struct evhttp_uri * uri)"
.PP
Return the host part of an evhttp_uri, or NULL if it has no host set\&. The host may either be a regular hostname (conforming to the RFC 3986 'regname' production), or an IPv4 address, or the empty string, or a bracketed IPv6 address, or a bracketed 'IP-Future' address\&.
.PP
Note that having a NULL host means that the URI has no authority section, but having an empty-string host means that the URI has an authority section with no host part\&. For example, 'mailto:user@example\&.com' has a host of NULL, but 'file:///etc/motd' has a host of ''\&.
.SS "EVENT2_EXPORT_SYMBOL int evhttp_uri_get_port (const struct evhttp_uri * uri)"
.PP
Return the port part of an evhttp_uri, or -1 if there is no port set\&.
.SS "EVENT2_EXPORT_SYMBOL const char* evhttp_uri_get_scheme (const struct evhttp_uri * uri)"
.PP
Return the scheme of an evhttp_uri, or NULL if there is no scheme has been set and the evhttp_uri contains a Relative-Ref\&.
.SS "EVENT2_EXPORT_SYMBOL char* evhttp_uri_join (struct evhttp_uri * uri, char * buf, size_t limit)"
.PP
Join together the uri parts from parsed data to form a URI-Reference\&. Note that no escaping of reserved characters is done on the members of the evhttp_uri, so the generated string might not be a valid URI unless the members of evhttp_uri are themselves valid\&.
.PP
\fBParameters:\fP
.RS 4
\fIuri\fP container with parsed data
.br
\fIbuf\fP destination buffer
.br
\fIlimit\fP destination buffer size
.RE
.PP
\fBReturns:\fP
.RS 4
a joined uri as string or NULL on error
.RE
.PP
\fBSee also:\fP
.RS 4
\fBevhttp_uri_parse()\fP
.RE
.PP
.SS "EVENT2_EXPORT_SYMBOL struct evhttp_uri* evhttp_uri_parse_with_flags (const char * source_uri, unsigned flags)"
.PP
Helper function to parse a URI-Reference as specified by RFC3986\&. This function matches the URI-Reference production from RFC3986, which includes both URIs like
.PP
scheme://[[userinfo]@]foo\&.com[:port]]/[path][?query][#fragment]
.PP
and relative-refs like
.PP
[path][?query][#fragment]
.PP
Any optional elements portions not present in the original URI are left set to NULL in the resulting evhttp_uri\&. If no port is specified, the port is set to -1\&.
.PP
Note that no decoding is performed on percent-escaped characters in the string; if you want to parse them, use evhttp_uridecode or evhttp_parse_query_str as appropriate\&.
.PP
Note also that most URI schemes will have additional constraints that this function does not know about, and cannot check\&. For example, mailto://www\&.example\&.com/cgi-bin/fortune\&.pl is not a reasonable mailto url, http://www.example.com:99999/ is not a reasonable HTTP URL, and ftp:username@example.com is not a reasonable FTP URL\&. Nevertheless, all of these URLs conform to RFC3986, and this function accepts all of them as valid\&.
.PP
\fBParameters:\fP
.RS 4
\fIsource_uri\fP the request URI
.br
\fIflags\fP Zero or more EVHTTP_URI_* flags to affect the behavior of the parser\&.
.RE
.PP
\fBReturns:\fP
.RS 4
uri container to hold parsed data, or NULL if there is error
.RE
.PP
\fBSee also:\fP
.RS 4
\fBevhttp_uri_free()\fP
.RE
.PP
.SS "EVENT2_EXPORT_SYMBOL void evhttp_uri_set_flags (struct evhttp_uri * uri, unsigned flags)"
.PP
Changes the flags set on a given URI\&. See EVHTTP_URI_* for a list of flags\&.
.SS "EVENT2_EXPORT_SYMBOL int evhttp_uri_set_fragment (struct evhttp_uri * uri, const char * fragment)"
.PP
Set the fragment of an evhttp_uri, or clear the fragment if fragment==NULL\&. The fragment should not include a leading '#'\&. Returns 0 on success, -1 if fragment is not well-formed\&.
.SS "EVENT2_EXPORT_SYMBOL int evhttp_uri_set_host (struct evhttp_uri * uri, const char * host)"
.PP
Set the host of an evhttp_uri, or clear the host if host==NULL\&. Returns 0 on success, -1 if host is not well-formed\&.
.SS "EVENT2_EXPORT_SYMBOL int evhttp_uri_set_path (struct evhttp_uri * uri, const char * path)"
.PP
Set the path of an evhttp_uri, or clear the path if path==NULL\&. Returns 0 on success, -1 if path is not well-formed\&.
.SS "EVENT2_EXPORT_SYMBOL int evhttp_uri_set_port (struct evhttp_uri * uri, int port)"
.PP
Set the port of an evhttp_uri, or clear the port if port==-1\&. Returns 0 on success, -1 if port is not well-formed\&.
.SS "EVENT2_EXPORT_SYMBOL int evhttp_uri_set_query (struct evhttp_uri * uri, const char * query)"
.PP
Set the query of an evhttp_uri, or clear the query if query==NULL\&. The query should not include a leading '?'\&. Returns 0 on success, -1 if query is not well-formed\&.
.SS "EVENT2_EXPORT_SYMBOL int evhttp_uri_set_scheme (struct evhttp_uri * uri, const char * scheme)"
.PP
Set the scheme of an evhttp_uri, or clear the scheme if scheme==NULL\&. Returns 0 on success, -1 if scheme is not well-formed\&.
.SS "EVENT2_EXPORT_SYMBOL int evhttp_uri_set_userinfo (struct evhttp_uri * uri, const char * userinfo)"
.PP
Set the userinfo of an evhttp_uri, or clear the userinfo if userinfo==NULL\&. Returns 0 on success, -1 if userinfo is not well-formed\&.
.SS "EVENT2_EXPORT_SYMBOL char* evhttp_uridecode (const char * uri, int decode_plus, size_t * size_out)"
.PP
Helper function to decode a URI-escaped string or HTTP parameter\&. If 'decode_plus' is 1, then we decode the string as an HTTP parameter value, and convert all plus ('+') characters to spaces\&. If 'decode_plus' is 0, we leave all plus characters unchanged\&.
.PP
The returned string must be freed by the caller\&.
.PP
\fBParameters:\fP
.RS 4
\fIuri\fP a URI-encode encoded URI
.br
\fIdecode_plus\fP determines whether we convert '+' to space\&.
.br
\fIsize_out\fP if size_out is not NULL, *size_out is set to the size of the returned string
.RE
.PP
\fBReturns:\fP
.RS 4
a newly allocated unencoded URI or NULL on failure
.RE
.PP
.SS "EVENT2_EXPORT_SYMBOL char* evhttp_uriencode (const char * str, ev_ssize_t size, int space_to_plus)"
.PP
As evhttp_encode_uri, but if 'size' is nonnegative, treat the string as being 'size' bytes long\&. This allows you to encode strings that may contain 0-valued bytes\&.
.PP
The returned string must be freed by the caller\&.
.PP
\fBParameters:\fP
.RS 4
\fIstr\fP an unencoded string
.br
\fIsize\fP the length of the string to encode, or -1 if the string is NUL-terminated
.br
\fIspace_to_plus\fP if true, space characters in 'str' are encoded as +, not %20\&.
.RE
.PP
\fBReturns:\fP
.RS 4
a newly allocate URI-encoded string, or NULL on failure\&.
.RE
.PP
.SH "Author"
.PP
Generated automatically by Doxygen for libevent from the source code\&.
|