This file is indexed.

/usr/share/gtk-doc/html/gnet/gnet-conn-http.html is in libgnet-dev 2.0.8-2.1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

   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
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>GConnHttp</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.72.0">
<link rel="start" href="index.html" title="GNet Network Library Reference Manual">
<link rel="up" href="libgnet-reference.html" title="GNet Library Reference">
<link rel="prev" href="gnet-mcast.html" title="Mcast">
<link rel="next" href="gnet-conn.html" title="Conn">
<meta name="generator" content="GTK-Doc V1.8 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="chapter" href="gnet-overview.html" title="GNet Overview">
<link rel="chapter" href="gnet-developers.html" title="GNet for developers">
<link rel="chapter" href="gnet-examples.html" title="GNet Examples">
<link rel="chapter" href="libgnet-reference.html" title="GNet Library Reference">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="gnet-mcast.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="libgnet-reference.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GNet Network Library Reference Manual</th>
<td><a accesskey="n" href="gnet-conn.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts"><nobr><a href="#id359655" class="shortcut">Top</a>
                  &#160;|&#160;
                  <a href="#id360608" class="shortcut">Description</a></nobr></td></tr>
</table>
<div class="refentry" lang="en">
<a name="gnet-conn-http"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2>
<a name="id359655"></a><span class="refentrytitle">GConnHttp</span>
</h2>
<p>GConnHttp &#8212; HTTP connection object</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<pre class="synopsis">

#include &lt;gnet.h&gt;


                    <a href="gnet-conn-http.html#GConnHttp">GConnHttp</a>;
enum                <a href="gnet-conn-http.html#GConnHttpMethod">GConnHttpMethod</a>;
enum                <a href="gnet-conn-http.html#GConnHttpError">GConnHttpError</a>;
enum                <a href="gnet-conn-http.html#GConnHttpEventType">GConnHttpEventType</a>;
                    <a href="gnet-conn-http.html#GConnHttpEvent">GConnHttpEvent</a>;
                    <a href="gnet-conn-http.html#GConnHttpEventResolved">GConnHttpEventResolved</a>;
                    <a href="gnet-conn-http.html#GConnHttpEventResponse">GConnHttpEventResponse</a>;
                    <a href="gnet-conn-http.html#GConnHttpEventRedirect">GConnHttpEventRedirect</a>;
                    <a href="gnet-conn-http.html#GConnHttpEventData">GConnHttpEventData</a>;
                    <a href="gnet-conn-http.html#GConnHttpEventError">GConnHttpEventError</a>;
void                (<a href="gnet-conn-http.html#GConnHttpFunc">*GConnHttpFunc</a>)                    (<a href="gnet-conn-http.html#GConnHttp">GConnHttp</a> *conn,
                                                         <a href="gnet-conn-http.html#GConnHttpEvent">GConnHttpEvent</a> *event,
                                                         gpointer user_data);
enum                <a href="gnet-conn-http.html#GConnHttpHeaderFlags">GConnHttpHeaderFlags</a>;
<a href="gnet-conn-http.html#GConnHttp">GConnHttp</a>*          <a href="gnet-conn-http.html#gnet-conn-http-new">gnet_conn_http_new</a>                  (void);
gboolean            <a href="gnet-conn-http.html#gnet-conn-http-set-uri">gnet_conn_http_set_uri</a>              (<a href="gnet-conn-http.html#GConnHttp">GConnHttp</a> *conn,
                                                         const gchar *uri);
gboolean            <a href="gnet-conn-http.html#gnet-conn-http-set-escaped-uri">gnet_conn_http_set_escaped_uri</a>      (<a href="gnet-conn-http.html#GConnHttp">GConnHttp</a> *conn,
                                                         const gchar *uri);
gboolean            <a href="gnet-conn-http.html#gnet-conn-http-set-header">gnet_conn_http_set_header</a>           (<a href="gnet-conn-http.html#GConnHttp">GConnHttp</a> *conn,
                                                         const gchar *field,
                                                         const gchar *value,
                                                         <a href="gnet-conn-http.html#GConnHttpHeaderFlags">GConnHttpHeaderFlags</a> flags);
void                <a href="gnet-conn-http.html#gnet-conn-http-set-max-redirects">gnet_conn_http_set_max_redirects</a>    (<a href="gnet-conn-http.html#GConnHttp">GConnHttp</a> *conn,
                                                         guint num);
void                <a href="gnet-conn-http.html#gnet-conn-http-set-timeout">gnet_conn_http_set_timeout</a>          (<a href="gnet-conn-http.html#GConnHttp">GConnHttp</a> *conn,
                                                         guint timeout);
gboolean            <a href="gnet-conn-http.html#gnet-conn-http-set-user-agent">gnet_conn_http_set_user_agent</a>       (<a href="gnet-conn-http.html#GConnHttp">GConnHttp</a> *conn,
                                                         const gchar *agent);
gboolean            <a href="gnet-conn-http.html#gnet-conn-http-set-method">gnet_conn_http_set_method</a>           (<a href="gnet-conn-http.html#GConnHttp">GConnHttp</a> *conn,
                                                         <a href="gnet-conn-http.html#GConnHttpMethod">GConnHttpMethod</a> method,
                                                         const gchar *post_data,
                                                         gsize post_data_len);
gboolean            <a href="gnet-conn-http.html#gnet-conn-http-set-main-context">gnet_conn_http_set_main_context</a>     (<a href="gnet-conn-http.html#GConnHttp">GConnHttp</a> *conn,
                                                         GMainContext *context);
void                <a href="gnet-conn-http.html#gnet-conn-http-run-async">gnet_conn_http_run_async</a>            (<a href="gnet-conn-http.html#GConnHttp">GConnHttp</a> *conn,
                                                         <a href="gnet-conn-http.html#GConnHttpFunc">GConnHttpFunc</a> func,
                                                         gpointer user_data);
gboolean            <a href="gnet-conn-http.html#gnet-conn-http-run">gnet_conn_http_run</a>                  (<a href="gnet-conn-http.html#GConnHttp">GConnHttp</a> *conn,
                                                         <a href="gnet-conn-http.html#GConnHttpFunc">GConnHttpFunc</a> func,
                                                         gpointer user_data);
gboolean            <a href="gnet-conn-http.html#gnet-conn-http-steal-buffer">gnet_conn_http_steal_buffer</a>         (<a href="gnet-conn-http.html#GConnHttp">GConnHttp</a> *conn,
                                                         gchar **buffer,
                                                         gsize *length);
void                <a href="gnet-conn-http.html#gnet-conn-http-cancel">gnet_conn_http_cancel</a>               (<a href="gnet-conn-http.html#GConnHttp">GConnHttp</a> *conn);
void                <a href="gnet-conn-http.html#gnet-conn-http-delete">gnet_conn_http_delete</a>               (<a href="gnet-conn-http.html#GConnHttp">GConnHttp</a> *conn);
gboolean            <a href="gnet-conn-http.html#gnet-http-get">gnet_http_get</a>                       (const gchar *url,
                                                         gchar **buffer,
                                                         gsize *length,
                                                         guint *response);
</pre>
</div>
<div class="refsect1" lang="en">
<a name="id360608"></a><h2>Description</h2>
<p>
A <a href="gnet-conn-http.html#GConnHttp"><span class="type">GConnHttp</span></a> represents a HTTP client connection. A <a href="gnet-conn-http.html#GConnHttp"><span class="type">GConnHttp</span></a>
is created directly by calling <a href="gnet-conn-http.html#gnet-conn-http-new"><code class="function">gnet_conn_http_new()</code></a>. After
that set the URI to retrieve using <a href="gnet-conn-http.html#gnet-conn-http-set-uri"><code class="function">gnet_conn_http_set_uri()</code></a>. 
A connection is made and the HTTP request sent only once 
either <a href="gnet-conn-http.html#gnet-conn-http-run-async"><code class="function">gnet_conn_http_run_async()</code></a> or <a href="gnet-conn-http.html#gnet-conn-http-run"><code class="function">gnet_conn_http_run()</code></a>
is called. Use the asynchroneous variant if you want the
function to return immediately and prefer to receive data
and status information in the background via the callback
function. <a href="gnet-conn-http.html#gnet-conn-http-run-async"><code class="function">gnet_conn_http_run_async()</code></a> assumes that there is
already a GLib main loop running (e.g. the Gtk main loop).
</p>
<p>
You can decide for yourself how much information you would
like to receive during the HTTP operation. All status 
information is communicated to the caller via the optional
callback function.
</p>
<p>
The easiest way to just retrieve some data via HTTP is to
use the convenience function <a href="gnet-conn-http.html#gnet-http-get"><code class="function">gnet_http_get()</code></a>.
</p>
<p>
Here is a small example how to retrieve a file with the
least amount of effort and error checking (this is 
more or less what <a href="gnet-conn-http.html#gnet-http-get"><code class="function">gnet_http_get()</code></a> does internally):
</p>
<div class="example">
<a name="id360726"></a><p class="title"><b>Example&#160;1.&#160;Simple <span class="structname">GConnHttp</span> usage.</b></p>
<div class="example-contents"><pre class="programlisting">
#define GNET_EXPERIMENTAL
#include &lt;gnet.h&gt;

void
fetch_and_print_url (const gchar *url)
{
  GConnHttp  *conn;
  
  conn = gnet_conn_http_new();
  
  gnet_conn_http_set_uri(conn, url);
  
  if (gnet_conn_http_run(conn, NULL, NULL))
  {
    gchar *buf;
    gsize  buflen;
    
    if (gnet_conn_http_steal_buffer(conn, &amp;buf, &amp;buflen))
    {
      g_print ("Received %%u bytes of data:\n%%s\n", buflen, buf);
      g_free(buf);
    }
  }
  
  gnet_conn_http_delete(conn);
}

  ...

  fetch_and_print_url ("http://www.google.com");
  
  ...

</pre></div>
</div>
<p><br class="example-break">
</p>
<p>
<a href="gnet-conn-http.html#GConnHttp"><span class="type">GConnHttp</span></a> is still considered less mature than other parts of GNet, even
though it should generall work just fine. It just has not received as much
testing as other parts of GNet yet. You should not use it in production
level code without thoroughly testing it for your purposes. Because of that,
you need to define GNET_EXPERIMENTAL in your source code before including the
GNet headers (otherwise you will get compiler errors when trying to use it).
</p>
</div>
<div class="refsect1" lang="en">
<a name="id360765"></a><h2>Details</h2>
<div class="refsect2" lang="en">
<a name="id360778"></a><h3>
<a name="GConnHttp"></a>GConnHttp</h3>
<a class="indexterm" name="id360789"></a><pre class="programlisting">typedef struct _GConnHttp GConnHttp;</pre>
<p>
HTTP Connection. The entire GConnHttp struct is opaque and private.</p>
<p>

</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id360807"></a><h3>
<a name="GConnHttpMethod"></a>enum GConnHttpMethod</h3>
<a class="indexterm" name="id360819"></a><pre class="programlisting">typedef enum
{
 GNET_CONN_HTTP_METHOD_GET,
 GNET_CONN_HTTP_METHOD_POST
} GConnHttpMethod;
</pre>
<p>
HTTP request method.  Use with <a href="gnet-conn-http.html#gnet-conn-http-set-method"><code class="function">gnet_conn_http_set_method()</code></a>.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><a name="GNET-CONN-HTTP-METHOD-GET:CAPS"></a><code class="literal">GNET_CONN_HTTP_METHOD_GET</code></span></td>
<td> HTTP GET method
</td>
</tr>
<tr>
<td><span class="term"><a name="GNET-CONN-HTTP-METHOD-POST:CAPS"></a><code class="literal">GNET_CONN_HTTP_METHOD_POST</code></span></td>
<td> HTTP POST method
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id360897"></a><h3>
<a name="GConnHttpError"></a>enum GConnHttpError</h3>
<a class="indexterm" name="id360909"></a><pre class="programlisting">typedef enum
{
 GNET_CONN_HTTP_ERROR_UNSPECIFIED,
 GNET_CONN_HTTP_ERROR_PROTOCOL_UNSUPPORTED,
 GNET_CONN_HTTP_ERROR_HOSTNAME_RESOLUTION
} GConnHttpError;
</pre>
<p>
Error codes.  Used by <a href="gnet-conn-http.html#GConnHttpEventError"><span class="type">GConnHttpEventError</span></a>.  Note that 
   errors by the HTTP server will be communicated to the
   client via the <a href="gnet-conn-http.html#GConnHttpEventResponse"><span class="type">GConnHttpEventResponse</span></a> event.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><a name="GNET-CONN-HTTP-ERROR-UNSPECIFIED:CAPS"></a><code class="literal">GNET_CONN_HTTP_ERROR_UNSPECIFIED</code></span></td>
<td> connection error
</td>
</tr>
<tr>
<td><span class="term"><a name="GNET-CONN-HTTP-ERROR-PROTOCOL-UNSUPPORTED:CAPS"></a><code class="literal">GNET_CONN_HTTP_ERROR_PROTOCOL_UNSUPPORTED</code></span></td>
<td> unsupported protocol (ie. not http)
</td>
</tr>
<tr>
<td><span class="term"><a name="GNET-CONN-HTTP-ERROR-HOSTNAME-RESOLUTION:CAPS"></a><code class="literal">GNET_CONN_HTTP_ERROR_HOSTNAME_RESOLUTION</code></span></td>
<td> the hostname could not be resolved
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id361016"></a><h3>
<a name="GConnHttpEventType"></a>enum GConnHttpEventType</h3>
<a class="indexterm" name="id361028"></a><pre class="programlisting">typedef enum
{
 GNET_CONN_HTTP_RESOLVED,           /* resolved host name           */
 GNET_CONN_HTTP_CONNECTED,          /* connected to host            */
 GNET_CONN_HTTP_RESPONSE,           /* got response (incl. headers) */
 GNET_CONN_HTTP_REDIRECT,           /* got redirect                 */
 GNET_CONN_HTTP_DATA_PARTIAL,       /* we got some data             */
 GNET_CONN_HTTP_DATA_COMPLETE,      /* we got all data              */
 GNET_CONN_HTTP_TIMEOUT,            /* the connection timed out     */
 GNET_CONN_HTTP_ERROR               /* GConnHttp problem            */
} GConnHttpEventType;
</pre>
<p>
GConnHttp event type.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><a name="GNET-CONN-HTTP-RESOLVED:CAPS"></a><code class="literal">GNET_CONN_HTTP_RESOLVED</code></span></td>
<td> the host name has been 
  resolved or host name resolution failed. The event
  structure will be a <a href="gnet-conn-http.html#GConnHttpEventResolved"><span class="type">GConnHttpEventResolved</span></a> structure
</td>
</tr>
<tr>
<td><span class="term"><a name="GNET-CONN-HTTP-CONNECTED:CAPS"></a><code class="literal">GNET_CONN_HTTP_CONNECTED</code></span></td>
<td> the TCP connection to 
  the HTTP server has been established
</td>
</tr>
<tr>
<td><span class="term"><a name="GNET-CONN-HTTP-RESPONSE:CAPS"></a><code class="literal">GNET_CONN_HTTP_RESPONSE</code></span></td>
<td> the HTTP server has sent 
  a response and response headers. The event
  structure will be a <a href="gnet-conn-http.html#GConnHttpEventResponse"><span class="type">GConnHttpEventResponse</span></a> structure
</td>
</tr>
<tr>
<td><span class="term"><a name="GNET-CONN-HTTP-REDIRECT:CAPS"></a><code class="literal">GNET_CONN_HTTP_REDIRECT</code></span></td>
<td> the HTTP server has sent 
  a redirect response. The event structure will be a
  <a href="gnet-conn-http.html#GConnHttpEventRedirect"><span class="type">GConnHttpEventRedirect</span></a> structure
</td>
</tr>
<tr>
<td><span class="term"><a name="GNET-CONN-HTTP-DATA-PARTIAL:CAPS"></a><code class="literal">GNET_CONN_HTTP_DATA_PARTIAL</code></span></td>
<td> data has been received.
  The buffer is caller-owned (ie. owned by GNet), but 
  may be emptied using <a href="gnet-conn-http.html#gnet-conn-http-steal-buffer"><code class="function">gnet_conn_http_steal_buffer()</code></a>. The
  event structure will be a <a href="gnet-conn-http.html#GConnHttpEventData"><span class="type">GConnHttpEventData</span></a> structure
</td>
</tr>
<tr>
<td><span class="term"><a name="GNET-CONN-HTTP-DATA-COMPLETE:CAPS"></a><code class="literal">GNET_CONN_HTTP_DATA_COMPLETE</code></span></td>
<td> data has been received
  in full.  The buffer is caller-owned (ie. owned by GNet), 
  but may be emptied using <a href="gnet-conn-http.html#gnet-conn-http-steal-buffer"><code class="function">gnet_conn_http_steal_buffer()</code></a>. The
  event structure will be a <a href="gnet-conn-http.html#GConnHttpEventData"><span class="type">GConnHttpEventData</span></a> structure
</td>
</tr>
<tr>
<td><span class="term"><a name="GNET-CONN-HTTP-TIMEOUT:CAPS"></a><code class="literal">GNET_CONN_HTTP_TIMEOUT</code></span></td>
<td> the connection timed out
</td>
</tr>
<tr>
<td><span class="term"><a name="GNET-CONN-HTTP-ERROR:CAPS"></a><code class="literal">GNET_CONN_HTTP_ERROR</code></span></td>
<td> <a href="gnet-conn-http.html#GConnHttp"><span class="type">GConnHttp</span></a> problem (not a server 
  error response). The event structure will be a 
  <a href="gnet-conn-http.html#GConnHttpEventError"><span class="type">GConnHttpEventError</span></a> structure
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id361312"></a><h3>
<a name="GConnHttpEvent"></a>GConnHttpEvent</h3>
<a class="indexterm" name="id361324"></a><pre class="programlisting">typedef struct {
 GConnHttpEventType   type;           /* type of event (see above)         */
} GConnHttpEvent;
</pre>
<p>
GConnHttp Base Event.  Check event-&gt;type and then cast the event
  structure into the corresponding specialised event structure.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><span class="term"><a href="gnet-conn-http.html#GConnHttpEventType">GConnHttpEventType</a>&#160;<em class="structfield"><code>type</code></em>;</span></td>
<td> event type
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id361368"></a><h3>
<a name="GConnHttpEventResolved"></a>GConnHttpEventResolved</h3>
<a class="indexterm" name="id361380"></a><pre class="programlisting">typedef struct {
 GInetAddr           *ia;             /* GInetAddr of the host name        */
} GConnHttpEventResolved;
</pre>
<p>
GConnHttp Host Name Resolved Event.  Emitted when the host name has 
  been resolved to an IP address, primarily to give progress feedback 
  to the user. <em class="parameter"><code>ia</code></em> will be NULL if the host name could not be resolved.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><span class="term"><a href="gnet-inetaddr.html#GInetAddr">GInetAddr</a>&#160;*<em class="structfield"><code>ia</code></em>;</span></td>
<td> a <a href="gnet-inetaddr.html#GInetAddr"><span class="type">GInetAddr</span></a> of the resolved host name.
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id361439"></a><h3>
<a name="GConnHttpEventResponse"></a>GConnHttpEventResponse</h3>
<a class="indexterm" name="id361452"></a><pre class="programlisting">typedef struct {
 guint                response_code;  /* response code, e.g. 200, or 404   */
 gchar              **header_fields;  /* NULL-terminated array of strings  */
 gchar              **header_values;  /* NULL-terminated array of strings  */
} GConnHttpEventResponse;
</pre>
<p>
Emitted when the server has sent a response and response headers.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term">guint&#160;<em class="structfield"><code>response_code</code></em>;</span></td>
<td> response code from the HTTP server (e.g. 200 or 404)
</td>
</tr>
<tr>
<td><span class="term">gchar&#160;**<em class="structfield"><code>header_fields</code></em>;</span></td>
<td> array of header field strings, NULL-terminated
</td>
</tr>
<tr>
<td><span class="term">gchar&#160;**<em class="structfield"><code>header_values</code></em>;</span></td>
<td> array of header value strings, NULL-terminated
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id361538"></a><h3>
<a name="GConnHttpEventRedirect"></a>GConnHttpEventRedirect</h3>
<a class="indexterm" name="id361551"></a><pre class="programlisting">typedef struct {
 guint                num_redirects;  /* number of redirects so far        */
 guint                max_redirects;  /* max. num. of redirects allowed    */
 gchar               *new_location;   /* redirect location if provided     */
 gboolean             auto_redirect;  /* FALSE if action is needed         */
} GConnHttpEventRedirect;
</pre>
<p>
Emitted when the server sends a redirect response.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term">guint&#160;<em class="structfield"><code>num_redirects</code></em>;</span></td>
<td> number of redirects so far
</td>
</tr>
<tr>
<td><span class="term">guint&#160;<em class="structfield"><code>max_redirects</code></em>;</span></td>
<td> maximum number of redirects allowed
</td>
</tr>
<tr>
<td><span class="term">gchar&#160;*<em class="structfield"><code>new_location</code></em>;</span></td>
<td> redirect location, or NULL if not provided
</td>
</tr>
<tr>
<td><span class="term">gboolean&#160;<em class="structfield"><code>auto_redirect</code></em>;</span></td>
<td> FALSE if action by the client is needed. Set 
                 to FALSE to prevent automatic redirection
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id361727"></a><h3>
<a name="GConnHttpEventData"></a>GConnHttpEventData</h3>
<a class="indexterm" name="id361740"></a><pre class="programlisting">typedef struct {
 guint64              content_length; /* set if available, otherwise 0     */
 guint64              data_received;  /* bytes received so far             */
 const gchar         *buffer;         /* buffer                            */
 gsize                buffer_length;  /* buffer length                     */
} GConnHttpEventData;
</pre>
<p>
Emitted when data has been received. Useful for progress feedback 
  to the user or to process data before all of it has been received.
  The client is responsible for emptying the buffer regularly when the 
  amount of data received or expected is larger than the amount that
  should be kept in memory (e.g. in the case of large binary files).</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term">guint64&#160;<em class="structfield"><code>content_length</code></em>;</span></td>
<td> set if available, otherwise 0
</td>
</tr>
<tr>
<td><span class="term">guint64&#160;<em class="structfield"><code>data_received</code></em>;</span></td>
<td> total amount of data received so far
</td>
</tr>
<tr>
<td><span class="term">const&#160;gchar&#160;*<em class="structfield"><code>buffer</code></em>;</span></td>
<td> buffer with data received so far. Use 
 <a href="gnet-conn-http.html#gnet-conn-http-steal-buffer"><code class="function">gnet_conn_http_steal_buffer()</code></a> to empty the buffer.
</td>
</tr>
<tr>
<td><span class="term">gsize&#160;<em class="structfield"><code>buffer_length</code></em>;</span></td>
<td> buffer length
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id361862"></a><h3>
<a name="GConnHttpEventError"></a>GConnHttpEventError</h3>
<a class="indexterm" name="id361874"></a><pre class="programlisting">typedef struct {
 GConnHttpError       code;           /* error code                        */
 gchar               *message;        /* message (use for debugging only)  */
} GConnHttpEventError;
</pre>
<p>
Emitted when an error has occured. Note that HTTP server errors are
  communicated to the client by means of a <a href="gnet-conn-http.html#GConnHttpEventResponse"><span class="type">GConnHttpEventResponse</span></a> event.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><a href="gnet-conn-http.html#GConnHttpError">GConnHttpError</a>&#160;<em class="structfield"><code>code</code></em>;</span></td>
<td> one of the <a href="gnet-conn-http.html#GConnHttpError"><span class="type">GConnHttpError</span></a> codes
</td>
</tr>
<tr>
<td><span class="term">gchar&#160;*<em class="structfield"><code>message</code></em>;</span></td>
<td> clear-text error message (for debugging purposes only)
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id361956"></a><h3>
<a name="GConnHttpFunc"></a>GConnHttpFunc ()</h3>
<a class="indexterm" name="id361968"></a><pre class="programlisting">void                (*GConnHttpFunc)                    (<a href="gnet-conn-http.html#GConnHttp">GConnHttp</a> *conn,
                                                         <a href="gnet-conn-http.html#GConnHttpEvent">GConnHttpEvent</a> *event,
                                                         gpointer user_data);</pre>
<p>
Callback for <a href="gnet-conn-http.html#GConnHttp"><span class="type">GConnHttp</span></a>.
</p>
<p>
 Check event-&gt;type and then cast the event into the appropriate
  event structure. event-&gt;type will be one of
</p>
<p>
 <a href="gnet-conn-http.html#GNET-CONN-HTTP-RESOLVED:CAPS"><code class="literal">GNET_CONN_HTTP_RESOLVED</code></a>: this event occurs when the host name
 has been resolved or host name resolution failed
</p>
<p>
 <a href="gnet-conn-http.html#GNET-CONN-HTTP-CONNECTED:CAPS"><code class="literal">GNET_CONN_HTTP_CONNECTED</code></a>: the TCP connection to the 
 HTTP server has been established
</p>
<p>
 <a href="gnet-conn-http.html#GNET-CONN-HTTP-RESPONSE:CAPS"><code class="literal">GNET_CONN_HTTP_RESPONSE</code></a>: the HTTP server has sent a response
 and response headers
</p>
<p>
 <a href="gnet-conn-http.html#GNET-CONN-HTTP-REDIRECT:CAPS"><code class="literal">GNET_CONN_HTTP_REDIRECT</code></a>: the HTTP server has sent a redirect
 response
</p>
<p>
 <a href="gnet-conn-http.html#GNET-CONN-HTTP-DATA-PARTIAL:CAPS"><code class="literal">GNET_CONN_HTTP_DATA_PARTIAL</code></a>: data has been read. The buffer is
 owned by GNet and you must not modify it or free it. You can
 take ownership of the buffer with <a href="gnet-conn-http.html#gnet-conn-http-steal-buffer"><code class="function">gnet_conn_http_steal_buffer()</code></a>
</p>
<p>
 <a href="gnet-conn-http.html#GNET-CONN-HTTP-DATA-COMPLETE:CAPS"><code class="literal">GNET_CONN_HTTP_DATA_COMPLETE</code></a>: data has been received in full.
 The buffer is owned by GNet and you must not modify it or free 
 it. You can acquire ownership of the buffer by calling 
 <a href="gnet-conn-http.html#gnet-conn-http-steal-buffer"><code class="function">gnet_conn_http_steal_buffer()</code></a>
</p>
<p>
 <a href="gnet-conn-http.html#GNET-CONN-HTTP-TIMEOUT:CAPS"><code class="literal">GNET_CONN_HTTP_TIMEOUT</code></a>: the connection timed out
</p>
<p>
 <a href="gnet-conn-http.html#GNET-CONN-HTTP-ERROR:CAPS"><code class="literal">GNET_CONN_HTTP_ERROR</code></a>: <a href="gnet-conn-http.html#GConnHttp"><span class="type">GConnHttp</span></a> problem (not a server error response)</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>conn</code></em>&#160;:</span></td>
<td> <a href="gnet-conn-http.html#GConnHttp"><span class="type">GConnHttp</span></a>
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>event</code></em>&#160;:</span></td>
<td> event (caller-owned, do not free)
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>user_data</code></em>&#160;:</span></td>
<td> user data specified in <a href="gnet-conn-http.html#gnet-conn-http-run"><code class="function">gnet_conn_http_run()</code></a> 
             or <a href="gnet-conn-http.html#gnet-conn-http-run-async"><code class="function">gnet_conn_http_run_async()</code></a>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id362249"></a><h3>
<a name="GConnHttpHeaderFlags"></a>enum GConnHttpHeaderFlags</h3>
<a class="indexterm" name="id362261"></a><pre class="programlisting">typedef enum
{
  GNET_CONN_HTTP_FLAG_SKIP_HEADER_CHECK  = 1
} GConnHttpHeaderFlags;
</pre>
<p>
Flags for <a href="gnet-conn-http.html#gnet-conn-http-set-header"><code class="function">gnet_conn_http_set_header()</code></a>.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><span class="term"><a name="GNET-CONN-HTTP-FLAG-SKIP-HEADER-CHECK:CAPS"></a><code class="literal">GNET_CONN_HTTP_FLAG_SKIP_HEADER_CHECK</code></span></td>
<td> do not check whether
  the header is a standard header
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id362317"></a><h3>
<a name="gnet-conn-http-new"></a>gnet_conn_http_new ()</h3>
<a class="indexterm" name="id362329"></a><pre class="programlisting"><a href="gnet-conn-http.html#GConnHttp">GConnHttp</a>*          gnet_conn_http_new                  (void);</pre>
<p>
Creates a <a href="gnet-conn-http.html#GConnHttp"><span class="type">GConnHttp</span></a>.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> a <a href="gnet-conn-http.html#GConnHttp"><span class="type">GConnHttp</span></a>.

</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id362383"></a><h3>
<a name="gnet-conn-http-set-uri"></a>gnet_conn_http_set_uri ()</h3>
<a class="indexterm" name="id362396"></a><pre class="programlisting">gboolean            gnet_conn_http_set_uri              (<a href="gnet-conn-http.html#GConnHttp">GConnHttp</a> *conn,
                                                         const gchar *uri);</pre>
<p>
Sets the URI to GET or POST, e.g. http://www.foo.com/bar.html. <em class="parameter"><code>uri</code></em> is
 assumed to be unescaped, so all special URI characters will be escaped.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>conn</code></em>&#160;:</span></td>
<td> a <a href="gnet-conn-http.html#GConnHttp"><span class="type">GConnHttp</span></a>
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>uri</code></em>&#160;:</span></td>
<td> URI string
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> TRUE if the URI has been accepted.

</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id362491"></a><h3>
<a name="gnet-conn-http-set-escaped-uri"></a>gnet_conn_http_set_escaped_uri ()</h3>
<a class="indexterm" name="id362503"></a><pre class="programlisting">gboolean            gnet_conn_http_set_escaped_uri      (<a href="gnet-conn-http.html#GConnHttp">GConnHttp</a> *conn,
                                                         const gchar *uri);</pre>
<p>
Sets the URI to GET or POST, e.g. http://www.foo.com/My%<code class="literal">20Documents</code>/bar.txt</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>conn</code></em>&#160;:</span></td>
<td> a <a href="gnet-conn-http.html#GConnHttp"><span class="type">GConnHttp</span></a>
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>uri</code></em>&#160;:</span></td>
<td> URI string with special characters already escaped
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> TRUE if the URI has been accepted.

</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id362603"></a><h3>
<a name="gnet-conn-http-set-header"></a>gnet_conn_http_set_header ()</h3>
<a class="indexterm" name="id362615"></a><pre class="programlisting">gboolean            gnet_conn_http_set_header           (<a href="gnet-conn-http.html#GConnHttp">GConnHttp</a> *conn,
                                                         const gchar *field,
                                                         const gchar *value,
                                                         <a href="gnet-conn-http.html#GConnHttpHeaderFlags">GConnHttpHeaderFlags</a> flags);</pre>
<p>
Set header field to send with the HTTP request.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>conn</code></em>&#160;:</span></td>
<td> a <a href="gnet-conn-http.html#GConnHttp"><span class="type">GConnHttp</span></a>
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>field</code></em>&#160;:</span></td>
<td> a header field, e.g. "Accept"
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>value</code></em>&#160;:</span></td>
<td> the header field value, e.g. "text/html"
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>flags</code></em>&#160;:</span></td>
<td> one or more flags of <a href="gnet-conn-http.html#GConnHttpHeaderFlags"><span class="type">GConnHttpHeaderFlags</span></a>, or 0
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> TRUE if the header field has been set or changed

</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id362754"></a><h3>
<a name="gnet-conn-http-set-max-redirects"></a>gnet_conn_http_set_max_redirects ()</h3>
<a class="indexterm" name="id362767"></a><pre class="programlisting">void                gnet_conn_http_set_max_redirects    (<a href="gnet-conn-http.html#GConnHttp">GConnHttp</a> *conn,
                                                         guint num);</pre>
<p>
Sets the maximum allowed number of automatic redirects.
  Note that the HTTP protocol specification (RFC2616) specifies 
  occasions where the client must not redirect automatically 
  without user intervention. In those cases, no automatic redirect
  will be performed, even if the limit has not been reached yet.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>conn</code></em>&#160;:</span></td>
<td> a <a href="gnet-conn-http.html#GConnHttp"><span class="type">GConnHttp</span></a>
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>num</code></em>&#160;:</span></td>
<td> the maximum number of allowed automatic redirects
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id362848"></a><h3>
<a name="gnet-conn-http-set-timeout"></a>gnet_conn_http_set_timeout ()</h3>
<a class="indexterm" name="id362860"></a><pre class="programlisting">void                gnet_conn_http_set_timeout          (<a href="gnet-conn-http.html#GConnHttp">GConnHttp</a> *conn,
                                                         guint timeout);</pre>
<p>
Sets a timeout on the http connection.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>conn</code></em>&#160;:</span></td>
<td> a <a href="gnet-conn-http.html#GConnHttp"><span class="type">GConnHttp</span></a>
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>timeout</code></em>&#160;:</span></td>
<td> timeout in milliseconds
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id362938"></a><h3>
<a name="gnet-conn-http-set-user-agent"></a>gnet_conn_http_set_user_agent ()</h3>
<a class="indexterm" name="id362951"></a><pre class="programlisting">gboolean            gnet_conn_http_set_user_agent       (<a href="gnet-conn-http.html#GConnHttp">GConnHttp</a> *conn,
                                                         const gchar *agent);</pre>
<p>
Convenience function. Wraps <a href="gnet-conn-http.html#gnet-conn-http-set-header"><code class="function">gnet_conn_http_set_header()</code></a>.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>conn</code></em>&#160;:</span></td>
<td> a <a href="gnet-conn-http.html#GConnHttp"><span class="type">GConnHttp</span></a>
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>agent</code></em>&#160;:</span></td>
<td> the user agent string to send (will be supplemented by a GNet
         version number comment)
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> TRUE if the user agent string has been changed.

</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id363051"></a><h3>
<a name="gnet-conn-http-set-method"></a>gnet_conn_http_set_method ()</h3>
<a class="indexterm" name="id363063"></a><pre class="programlisting">gboolean            gnet_conn_http_set_method           (<a href="gnet-conn-http.html#GConnHttp">GConnHttp</a> *conn,
                                                         <a href="gnet-conn-http.html#GConnHttpMethod">GConnHttpMethod</a> method,
                                                         const gchar *post_data,
                                                         gsize post_data_len);</pre>
<p>
Sets the HTTP request method. Default is the GET method.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>conn</code></em>&#160;:</span></td>
<td> a <a href="gnet-conn-http.html#GConnHttp"><span class="type">GConnHttp</span></a>
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>method</code></em>&#160;:</span></td>
<td> a <a href="gnet-conn-http.html#GConnHttpMethod"><span class="type">GConnHttpMethod</span></a>
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>post_data</code></em>&#160;:</span></td>
<td> post data to send with POST method, or NULL
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>post_data_len</code></em>&#160;:</span></td>
<td> the length of the post data to send with POST method, or 0
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> TRUE if the method has been changed successfully.

</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id363202"></a><h3>
<a name="gnet-conn-http-set-main-context"></a>gnet_conn_http_set_main_context ()</h3>
<a class="indexterm" name="id363217"></a><pre class="programlisting">gboolean            gnet_conn_http_set_main_context     (<a href="gnet-conn-http.html#GConnHttp">GConnHttp</a> *conn,
                                                         GMainContext *context);</pre>
<p>
Sets the GLib <span class="type">GMainContext</span> to use for asynchronous operations. You should
 call this function right after you create <em class="parameter"><code>conn</code></em>. You must not call this
 function after the actual connection process has started.
</p>
<p>
 You are very unlikely to ever need this function.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>conn</code></em>&#160;:</span></td>
<td> a <a href="gnet-conn-http.html#GConnHttp"><span class="type">GConnHttp</span></a>
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>context</code></em>&#160;:</span></td>
<td> a <span class="type">GMainContext</span>, or NULL to use the default GLib main context
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> TRUE on success, FALSE on failure.

</td>
</tr>
</tbody>
</table></div>
<p class="since">Since  2.0.8
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id363339"></a><h3>
<a name="gnet-conn-http-run-async"></a>gnet_conn_http_run_async ()</h3>
<a class="indexterm" name="id363352"></a><pre class="programlisting">void                gnet_conn_http_run_async            (<a href="gnet-conn-http.html#GConnHttp">GConnHttp</a> *conn,
                                                         <a href="gnet-conn-http.html#GConnHttpFunc">GConnHttpFunc</a> func,
                                                         gpointer user_data);</pre>
<p>
Starts connecting and sending the specified http request. Will 
  return immediately. Assumes there is an existing and running 
  default Gtk/GLib/Gnome main loop.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>conn</code></em>&#160;:</span></td>
<td> a <a href="gnet-conn-http.html#GConnHttp"><span class="type">GConnHttp</span></a>
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>func</code></em>&#160;:</span></td>
<td> callback function to communicate progress and errors, or NULL
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>user_data</code></em>&#160;:</span></td>
<td> user data to pass to callback function, or NULL
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id363452"></a><h3>
<a name="gnet-conn-http-run"></a>gnet_conn_http_run ()</h3>
<a class="indexterm" name="id363465"></a><pre class="programlisting">gboolean            gnet_conn_http_run                  (<a href="gnet-conn-http.html#GConnHttp">GConnHttp</a> *conn,
                                                         <a href="gnet-conn-http.html#GConnHttpFunc">GConnHttpFunc</a> func,
                                                         gpointer user_data);</pre>
<p>
Starts connecting and sending the specified http request. Will 
  return once the operation has finished and either an error has 
  occured, or the data has been received in full.
</p>
<p>
  This function will run its own main loop in the default GLib main context
  (or the user-specified main context, if one was specified with
  <a href="gnet-conn-http.html#gnet-conn-http-set-main-context"><code class="function">gnet_conn_http_set_main_context()</code></a>), which means that if your application
  is based on Gtk+ or sets up GLib timeouts or idle callbacks, it is
  possible that those callback functions are invoked while you are waiting
  for <a href="gnet-conn-http.html#gnet-conn-http-run"><code class="function">gnet_conn_http_run()</code></a> to return. This means you shouldn't make
  assumptions about any state you set up before calling this function,
  because it might have been changed again from within a callback in the
  mean time (if this can happen or not depends on your callbacks and what
  they do of course).</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>conn</code></em>&#160;:</span></td>
<td> a <a href="gnet-conn-http.html#GConnHttp"><span class="type">GConnHttp</span></a>
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>func</code></em>&#160;:</span></td>
<td> callback function to communicate progress and errors, or NULL
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>user_data</code></em>&#160;:</span></td>
<td> user data to pass to callback function, or NULL
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> TRUE if no error occured before connecting

</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id363605"></a><h3>
<a name="gnet-conn-http-steal-buffer"></a>gnet_conn_http_steal_buffer ()</h3>
<a class="indexterm" name="id363618"></a><pre class="programlisting">gboolean            gnet_conn_http_steal_buffer         (<a href="gnet-conn-http.html#GConnHttp">GConnHttp</a> *conn,
                                                         gchar **buffer,
                                                         gsize *length);</pre>
<p>
Empties the current buffer and returns the contents. The 
  main purpose of this function is to make it possible to 
  just use <a href="gnet-conn-http.html#gnet-conn-http-run"><code class="function">gnet_conn_http_run()</code></a>, check its return value, and 
  then get the buffer data without having to install a 
  callback function. Also needed to empty the buffer regularly
  while receiving large amounts of data.
</p>
<p>
 The caller (you) needs to free the buffer with <code class="function">g_free()</code> when done.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>conn</code></em>&#160;:</span></td>
<td> a <a href="gnet-conn-http.html#GConnHttp"><span class="type">GConnHttp</span></a>
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>buffer</code></em>&#160;:</span></td>
<td> where to store a pointer to the buffer data
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>length</code></em>&#160;:</span></td>
<td> where to store the length of the buffer data
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> TRUE if buffer and length have been set

</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id363755"></a><h3>
<a name="gnet-conn-http-cancel"></a>gnet_conn_http_cancel ()</h3>
<a class="indexterm" name="id363768"></a><pre class="programlisting">void                gnet_conn_http_cancel               (<a href="gnet-conn-http.html#GConnHttp">GConnHttp</a> *conn);</pre>
<p>
Cancels the current http transfer (if any) and makes
  <a href="gnet-conn-http.html#gnet-conn-http-run"><code class="function">gnet_conn_http_run()</code></a> return immediately. Will do nothing
  if the transfer was started with <a href="gnet-conn-http.html#gnet-conn-http-run-async"><code class="function">gnet_conn_http_run_async()</code></a>.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><span class="term"><em class="parameter"><code>conn</code></em>&#160;:</span></td>
<td> a <a href="gnet-conn-http.html#GConnHttp"><span class="type">GConnHttp</span></a>
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id363846"></a><h3>
<a name="gnet-conn-http-delete"></a>gnet_conn_http_delete ()</h3>
<a class="indexterm" name="id363858"></a><pre class="programlisting">void                gnet_conn_http_delete               (<a href="gnet-conn-http.html#GConnHttp">GConnHttp</a> *conn);</pre>
<p>
Deletes a <a href="gnet-conn-http.html#GConnHttp"><span class="type">GConnHttp</span></a> and frees all associated resources.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><span class="term"><em class="parameter"><code>conn</code></em>&#160;:</span></td>
<td> a <a href="gnet-conn-http.html#GConnHttp"><span class="type">GConnHttp</span></a>
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id363923"></a><h3>
<a name="gnet-http-get"></a>gnet_http_get ()</h3>
<a class="indexterm" name="id363936"></a><pre class="programlisting">gboolean            gnet_http_get                       (const gchar *url,
                                                         gchar **buffer,
                                                         gsize *length,
                                                         guint *response);</pre>
<p>
Convenience function that just retrieves
  the provided URI without the need to 
  set up a full <a href="gnet-conn-http.html#GConnHttp"><span class="type">GConnHttp</span></a>. Uses 
  <a href="gnet-conn-http.html#gnet-conn-http-run"><code class="function">gnet_conn_http_run()</code></a> internally.
</p>
<p>
 Caller (you) needs to free the buffer with <code class="function">g_free()</code> when
  no longer needed.
</p>
<p>
 This function will run its own main loop in the default GLib main context,
  which means that if your application is based on Gtk+ or sets up GLib
  timeouts or idle callbacks, it is possible that those callback functions
  are invoked while you are waiting for <a href="gnet-conn-http.html#gnet-http-get"><code class="function">gnet_http_get()</code></a> to return. This
  means you shouldn't make assumptions about any state you set up before
  calling this function, because it might have been changed again from
  within a callback in the mean time (if this can happen or not depends on
  your callbacks and what they do of course).</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>url</code></em>&#160;:</span></td>
<td> a URI, e.g. http://www.foo.com
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>buffer</code></em>&#160;:</span></td>
<td> where to store a pointer to the data retrieved
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>length</code></em>&#160;:</span></td>
<td> where to store the length of the data retrieved
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>response</code></em>&#160;:</span></td>
<td> where to store the last HTTP response code 
 received from the HTTP server, or NULL.
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> TRUE if <em class="parameter"><code>buffer</code></em>, <em class="parameter"><code>length</code></em> and <em class="parameter"><code>response</code></em> are set,
  otherwise FALSE.

</td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
</body>
</html>