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
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
#![allow(deprecated)]

use crate::{AuthDomain, ServerListenOptions, ServerMessage};
use glib::{
    prelude::*,
    signal::{connect_raw, SignalHandlerId},
    translate::*,
};
use std::boxed::Box as Box_;

glib::wrapper! {
    /// A HTTP server.
    ///
    /// #SoupServer implements a simple HTTP server.
    ///
    /// To begin, create a server using `Server::new()`. Add at least one
    /// handler by calling [`ServerExtManual::add_handler()`][crate::prelude::ServerExtManual::add_handler()] or
    /// [`ServerExtManual::add_early_handler()`][crate::prelude::ServerExtManual::add_early_handler()]; the handler will be called to
    /// process any requests underneath the path you pass. (If you want all
    /// requests to go to the same handler, just pass "/" (or [`None`]) for
    /// the path.)
    ///
    /// When a new connection is accepted (or a new request is started on
    /// an existing persistent connection), the #SoupServer will emit
    /// [`request-started`][struct@crate::Server#request-started] and then begin processing the request
    /// as described below, but note that once the message is assigned a
    /// status-code, then callbacks after that point will be
    /// skipped. Note also that it is not defined when the callbacks happen
    /// relative to various [`ServerMessage`][crate::ServerMessage] signals.
    ///
    /// Once the headers have been read, #SoupServer will check if there is
    /// a [`AuthDomain`][crate::AuthDomain] `(qv)` covering the Request-URI; if so, and if the
    /// message does not contain suitable authorization, then the
    /// [`AuthDomain`][crate::AuthDomain] will set a status of [`Status::Unauthorized`][crate::Status::Unauthorized] on
    /// the message.
    ///
    /// After checking for authorization, #SoupServer will look for "early"
    /// handlers (added with [`ServerExtManual::add_early_handler()`][crate::prelude::ServerExtManual::add_early_handler()]) matching the
    /// Request-URI. If one is found, it will be run; in particular, this
    /// can be used to connect to signals to do a streaming read of the
    /// request body.
    ///
    /// (At this point, if the request headers contain `Expect:
    /// 100-continue`, and a status code has been set, then
    /// #SoupServer will skip the remaining steps and return the response.
    /// If the request headers contain `Expect:
    /// 100-continue` and no status code has been set,
    /// #SoupServer will return a [`Status::Continue`][crate::Status::Continue] status before
    /// continuing.)
    ///
    /// The server will then read in the response body (if present). At
    /// this point, if there are no handlers at all defined for the
    /// Request-URI, then the server will return [`Status::NotFound`][crate::Status::NotFound] to
    /// the client.
    ///
    /// Otherwise (assuming no previous step assigned a status to the
    /// message) any "normal" handlers (added with
    /// [`ServerExtManual::add_handler()`][crate::prelude::ServerExtManual::add_handler()]) for the message's Request-URI will be
    /// run.
    ///
    /// Then, if the path has a WebSocket handler registered (and has
    /// not yet been assigned a status), #SoupServer will attempt to
    /// validate the WebSocket handshake, filling in the response and
    /// setting a status of [`Status::SwitchingProtocols`][crate::Status::SwitchingProtocols] or
    /// [`Status::BadRequest`][crate::Status::BadRequest] accordingly.
    ///
    /// If the message still has no status code at this point (and has not
    /// been paused with [`ServerMessage::pause()`][crate::ServerMessage::pause()]), then it will be
    /// given a status of [`Status::InternalServerError`][crate::Status::InternalServerError] (because at
    /// least one handler ran, but returned without assigning a status).
    ///
    /// Finally, the server will emit [`request-finished`][struct@crate::Server#request-finished] (or
    /// [`request-aborted`][struct@crate::Server#request-aborted] if an I/O error occurred before
    /// handling was completed).
    ///
    /// If you want to handle the special "*" URI (eg, "OPTIONS *"), you
    /// must explicitly register a handler for "*"; the default handler
    /// will not be used for that case.
    ///
    /// If you want to process https connections in addition to (or instead
    /// of) http connections, you can set the [`tls-certificate`][struct@crate::Server#tls-certificate]
    /// property.
    ///
    /// Once the server is set up, make one or more calls to
    /// [`ServerExt::listen()`][crate::prelude::ServerExt::listen()], [`ServerExt::listen_local()`][crate::prelude::ServerExt::listen_local()], or
    /// [`ServerExt::listen_all()`][crate::prelude::ServerExt::listen_all()] to tell it where to listen for
    /// connections. (All ports on a #SoupServer use the same handlers; if
    /// you need to handle some ports differently, such as returning
    /// different data for http and https, you'll need to create multiple
    /// `SoupServer`s, or else check the passed-in URI in the handler
    /// function.).
    ///
    /// #SoupServer will begin processing connections as soon as you return
    /// to (or start) the main loop for the current thread-default
    /// [`glib::MainContext`][crate::glib::MainContext].
    ///
    /// ## Properties
    ///
    ///
    /// #### `raw-paths`
    ///  If [`true`], percent-encoding in the Request-URI path will not be
    /// automatically decoded.
    ///
    /// Readable | Writeable | Construct Only
    ///
    ///
    /// #### `server-header`
    ///  Server header.
    ///
    /// If non-[`None`], the value to use for the "Server" header on
    /// [`ServerMessage`][crate::ServerMessage]s processed by this server.
    ///
    /// The Server header is the server equivalent of the
    /// User-Agent header, and provides information about the
    /// server and its components. It contains a list of one or
    /// more product tokens, separated by whitespace, with the most
    /// significant product token coming first. The tokens must be
    /// brief, ASCII, and mostly alphanumeric (although "-", "_",
    /// and "." are also allowed), and may optionally include a "/"
    /// followed by a version string. You may also put comments,
    /// enclosed in parentheses, between or after the tokens.
    ///
    /// Some HTTP server implementations intentionally do not use
    /// version numbers in their Server header, so that
    /// installations running older versions of the server don't
    /// end up advertising their vulnerability to specific security
    /// holes.
    ///
    /// As with [`user_agent`][struct@crate::Session#user_agent], if you set a
    /// [`server-header`][struct@crate::Server#server-header] property that has trailing
    /// whitespace, #SoupServer will append its own product token (eg,
    /// `libsoup/2.3.2`) to the end of the header for you.
    ///
    /// Readable | Writeable | Construct
    ///
    ///
    /// #### `tls-auth-mode`
    ///  A [`gio::TlsAuthenticationMode`][crate::gio::TlsAuthenticationMode] for SSL/TLS client authentication.
    ///
    /// Readable | Writeable | Construct
    ///
    ///
    /// #### `tls-certificate`
    ///  A [`gio::TlsCertificate`][crate::gio::TlsCertificate][] that has a
    /// [`private-key`][struct@crate::gio::TlsCertificate#private-key] set.
    ///
    /// If this is set, then the server will be able to speak
    /// https in addition to (or instead of) plain http.
    ///
    /// Readable | Writeable | Construct
    ///
    ///
    /// #### `tls-database`
    ///  A [`gio::TlsDatabase`][crate::gio::TlsDatabase] to use for validating SSL/TLS client
    /// certificates.
    ///
    /// Readable | Writeable | Construct
    ///
    /// ## Signals
    ///
    ///
    /// #### `request-aborted`
    ///  Emitted when processing has failed for a message.
    ///
    /// This could mean either that it could not be read (if
    /// [`request-read`][struct@crate::Server#request-read] has not been emitted for it yet), or that
    /// the response could not be written back (if [`request-read`][struct@crate::Server#request-read]
    /// has been emitted but [`request-finished`][struct@crate::Server#request-finished] has not been).
    ///
    /// @message is in an undefined state when this signal is
    /// emitted; the signal exists primarily to allow the server to
    /// free any state that it may have allocated in
    /// [`request-started`][struct@crate::Server#request-started].
    ///
    ///
    ///
    ///
    /// #### `request-finished`
    ///  Emitted when the server has finished writing a response to
    /// a request.
    ///
    ///
    ///
    ///
    /// #### `request-read`
    ///  Emitted when the server has successfully read a request.
    ///
    /// @message will have all of its request-side information
    /// filled in, and if the message was authenticated, @client
    /// will have information about that. This signal is emitted
    /// before any (non-early) handlers are called for the message,
    /// and if it sets the message's #status_code, then normal
    /// handler processing will be skipped.
    ///
    ///
    ///
    ///
    /// #### `request-started`
    ///  Emitted when the server has started reading a new request.
    ///
    /// @message will be completely blank; not even the
    /// Request-Line will have been read yet. About the only thing
    /// you can usefully do with it is connect to its signals.
    ///
    /// If the request is read successfully, this will eventually
    /// be followed by a [`request_read`][struct@crate::Server#request_read] signal]. If a
    /// response is then sent, the request processing will end with
    /// a [`request-finished`][struct@crate::Server#request-finished] signal. If a network error
    /// occurs, the processing will instead end with
    /// [`request-aborted`][struct@crate::Server#request-aborted].
    ///
    ///
    ///
    /// # Implements
    ///
    /// [`ServerExt`][trait@crate::prelude::ServerExt], [`trait@glib::ObjectExt`], [`ServerExtManual`][trait@crate::prelude::ServerExtManual]
    #[doc(alias = "SoupServer")]
    pub struct Server(Object<ffi::SoupServer, ffi::SoupServerClass>);

    match fn {
        type_ => || ffi::soup_server_get_type(),
    }
}

impl Server {
    pub const NONE: Option<&'static Server> = None;

    //#[doc(alias = "soup_server_new")]
    //pub fn new(optname1: &str, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) -> Option<Server> {
    //    unsafe { TODO: call ffi:soup_server_new() }
    //}

    // rustdoc-stripper-ignore-next
    /// Creates a new builder-pattern struct instance to construct [`Server`] objects.
    ///
    /// This method returns an instance of [`ServerBuilder`](crate::builders::ServerBuilder) which can be used to create [`Server`] objects.
    pub fn builder() -> ServerBuilder {
        ServerBuilder::new()
    }
}

// rustdoc-stripper-ignore-next
/// A [builder-pattern] type to construct [`Server`] objects.
///
/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
#[must_use = "The builder must be built to be used"]
pub struct ServerBuilder {
    builder: glib::object::ObjectBuilder<'static, Server>,
}

impl ServerBuilder {
    fn new() -> Self {
        Self {
            builder: glib::object::Object::builder(),
        }
    }

    /// If [`true`], percent-encoding in the Request-URI path will not be
    /// automatically decoded.
    pub fn raw_paths(self, raw_paths: bool) -> Self {
        Self {
            builder: self.builder.property("raw-paths", raw_paths),
        }
    }

    /// Server header.
    ///
    /// If non-[`None`], the value to use for the "Server" header on
    /// [`ServerMessage`][crate::ServerMessage]s processed by this server.
    ///
    /// The Server header is the server equivalent of the
    /// User-Agent header, and provides information about the
    /// server and its components. It contains a list of one or
    /// more product tokens, separated by whitespace, with the most
    /// significant product token coming first. The tokens must be
    /// brief, ASCII, and mostly alphanumeric (although "-", "_",
    /// and "." are also allowed), and may optionally include a "/"
    /// followed by a version string. You may also put comments,
    /// enclosed in parentheses, between or after the tokens.
    ///
    /// Some HTTP server implementations intentionally do not use
    /// version numbers in their Server header, so that
    /// installations running older versions of the server don't
    /// end up advertising their vulnerability to specific security
    /// holes.
    ///
    /// As with [`user_agent`][struct@crate::Session#user_agent], if you set a
    /// [`server-header`][struct@crate::Server#server-header] property that has trailing
    /// whitespace, #SoupServer will append its own product token (eg,
    /// `libsoup/2.3.2`) to the end of the header for you.
    pub fn server_header(self, server_header: impl Into<glib::GString>) -> Self {
        Self {
            builder: self.builder.property("server-header", server_header.into()),
        }
    }

    /// A [`gio::TlsAuthenticationMode`][crate::gio::TlsAuthenticationMode] for SSL/TLS client authentication.
    pub fn tls_auth_mode(self, tls_auth_mode: gio::TlsAuthenticationMode) -> Self {
        Self {
            builder: self.builder.property("tls-auth-mode", tls_auth_mode),
        }
    }

    /// A [`gio::TlsCertificate`][crate::gio::TlsCertificate][] that has a
    /// [`private-key`][struct@crate::gio::TlsCertificate#private-key] set.
    ///
    /// If this is set, then the server will be able to speak
    /// https in addition to (or instead of) plain http.
    pub fn tls_certificate(self, tls_certificate: &impl IsA<gio::TlsCertificate>) -> Self {
        Self {
            builder: self
                .builder
                .property("tls-certificate", tls_certificate.clone().upcast()),
        }
    }

    /// A [`gio::TlsDatabase`][crate::gio::TlsDatabase] to use for validating SSL/TLS client
    /// certificates.
    pub fn tls_database(self, tls_database: &impl IsA<gio::TlsDatabase>) -> Self {
        Self {
            builder: self
                .builder
                .property("tls-database", tls_database.clone().upcast()),
        }
    }

    // rustdoc-stripper-ignore-next
    /// Build the [`Server`].
    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
    pub fn build(self) -> Server {
        self.builder.build()
    }
}

mod sealed {
    pub trait Sealed {}
    impl<T: super::IsA<super::Server>> Sealed for T {}
}

/// Trait containing all [`struct@Server`] methods.
///
/// # Implementors
///
/// [`Server`][struct@crate::Server]
pub trait ServerExt: IsA<Server> + sealed::Sealed + 'static {
    /// Adds a new client stream to the @self.
    /// ## `stream`
    /// a #GIOStream
    /// ## `local_addr`
    /// the local #GSocketAddress associated with the
    ///   @stream
    /// ## `remote_addr`
    /// the remote #GSocketAddress associated with the
    ///   @stream
    ///
    /// # Returns
    ///
    /// [`true`] on success, [`false`] if the stream could not be
    ///   accepted or any other error occurred (in which case @error will be
    ///   set).
    #[doc(alias = "soup_server_accept_iostream")]
    fn accept_iostream(
        &self,
        stream: &impl IsA<gio::IOStream>,
        local_addr: Option<&impl IsA<gio::SocketAddress>>,
        remote_addr: Option<&impl IsA<gio::SocketAddress>>,
    ) -> Result<(), glib::Error> {
        unsafe {
            let mut error = std::ptr::null_mut();
            let is_ok = ffi::soup_server_accept_iostream(
                self.as_ref().to_glib_none().0,
                stream.as_ref().to_glib_none().0,
                local_addr.map(|p| p.as_ref()).to_glib_none().0,
                remote_addr.map(|p| p.as_ref()).to_glib_none().0,
                &mut error,
            );
            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
            if error.is_null() {
                Ok(())
            } else {
                Err(from_glib_full(error))
            }
        }
    }

    /// Adds an authentication domain to @self.
    ///
    /// Each auth domain will have the chance to require authentication for each
    /// request that comes in; normally auth domains will require authentication for
    /// requests on certain paths that they have been set up to watch, or that meet
    /// other criteria set by the caller. If an auth domain determines that a request
    /// requires authentication (and the request doesn't contain authentication),
    /// @self will automatically reject the request with an appropriate status (401
    /// Unauthorized or 407 Proxy Authentication Required). If the request used the
    /// SoupServer:100-continue Expectation, @self will reject it before the
    /// request body is sent.
    /// ## `auth_domain`
    /// a #SoupAuthDomain
    #[doc(alias = "soup_server_add_auth_domain")]
    fn add_auth_domain(&self, auth_domain: &impl IsA<AuthDomain>) {
        unsafe {
            ffi::soup_server_add_auth_domain(
                self.as_ref().to_glib_none().0,
                auth_domain.as_ref().to_glib_none().0,
            );
        }
    }

    /// Add support for a WebSocket extension of the given @extension_type.
    ///
    /// When a WebSocket client requests an extension of @extension_type,
    /// a new [`WebsocketExtension`][crate::WebsocketExtension] of type @extension_type will be created
    /// to handle the request.
    ///
    /// Note that [`WebsocketExtensionDeflate`][crate::WebsocketExtensionDeflate] is supported by default, use
    /// [`remove_websocket_extension()`][Self::remove_websocket_extension()] if you want to disable it.
    /// ## `extension_type`
    /// a #GType
    #[doc(alias = "soup_server_add_websocket_extension")]
    fn add_websocket_extension(&self, extension_type: glib::types::Type) {
        unsafe {
            ffi::soup_server_add_websocket_extension(
                self.as_ref().to_glib_none().0,
                extension_type.into_glib(),
            );
        }
    }

    /// Closes and frees @self's listening sockets.
    ///
    /// Note that if there are currently requests in progress on @self, that they
    /// will continue to be processed if @self's [`glib::MainContext`][crate::glib::MainContext] is still
    /// running.
    ///
    /// You can call [`listen()`][Self::listen()], etc, after calling this function
    /// if you want to start listening again.
    #[doc(alias = "soup_server_disconnect")]
    fn disconnect(&self) {
        unsafe {
            ffi::soup_server_disconnect(self.as_ref().to_glib_none().0);
        }
    }

    /// Gets @self's list of listening sockets.
    ///
    /// You should treat these sockets as read-only; writing to or
    /// modifiying any of these sockets may cause @self to malfunction.
    ///
    /// # Returns
    ///
    /// a
    ///   list of listening sockets.
    #[doc(alias = "soup_server_get_listeners")]
    #[doc(alias = "get_listeners")]
    fn listeners(&self) -> Vec<gio::Socket> {
        unsafe {
            FromGlibPtrContainer::from_glib_container(ffi::soup_server_get_listeners(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    /// Gets the @self SSL/TLS client authentication mode.
    ///
    /// # Returns
    ///
    /// a #GTlsAuthenticationMode
    #[doc(alias = "soup_server_get_tls_auth_mode")]
    #[doc(alias = "get_tls_auth_mode")]
    fn tls_auth_mode(&self) -> gio::TlsAuthenticationMode {
        unsafe {
            from_glib(ffi::soup_server_get_tls_auth_mode(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    /// Gets the @self SSL/TLS certificate.
    ///
    /// # Returns
    ///
    /// a #GTlsCertificate or [`None`]
    #[doc(alias = "soup_server_get_tls_certificate")]
    #[doc(alias = "get_tls_certificate")]
    fn tls_certificate(&self) -> Option<gio::TlsCertificate> {
        unsafe {
            from_glib_none(ffi::soup_server_get_tls_certificate(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    /// Gets the @self SSL/TLS database.
    ///
    /// # Returns
    ///
    /// a #GTlsDatabase
    #[doc(alias = "soup_server_get_tls_database")]
    #[doc(alias = "get_tls_database")]
    fn tls_database(&self) -> Option<gio::TlsDatabase> {
        unsafe {
            from_glib_none(ffi::soup_server_get_tls_database(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    /// Gets a list of URIs corresponding to the interfaces @self is
    /// listening on.
    ///
    /// These will contain IP addresses, not hostnames, and will also indicate
    /// whether the given listener is http or https.
    ///
    /// Note that if you used [`listen_all()`][Self::listen_all()] the returned URIs will use
    /// the addresses `0.0.0.0` and `::`, rather than actually returning separate
    /// URIs for each interface on the system.
    ///
    /// # Returns
    ///
    /// a list of #GUris, which you
    ///   must free when you are done with it.
    #[doc(alias = "soup_server_get_uris")]
    #[doc(alias = "get_uris")]
    fn uris(&self) -> Vec<glib::Uri> {
        unsafe {
            FromGlibPtrContainer::from_glib_full(ffi::soup_server_get_uris(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    /// Checks whether @self is capable of https.
    ///
    /// In order for a server to run https, you must call
    /// [`set_tls_certificate()`][Self::set_tls_certificate()], or set the
    /// [`tls-certificate`][struct@crate::Server#tls-certificate] property, to provide it with a
    /// certificate to use.
    ///
    /// If you are using the deprecated single-listener APIs, then a return value of
    /// [`true`] indicates that the #SoupServer serves https exclusively. If you are
    /// using [`listen()`][Self::listen()], etc, then a [`true`] return value merely indicates
    /// that the server is *able* to do https, regardless of whether it actually
    /// currently is or not. Use [`uris()`][Self::uris()] to see if it currently has
    /// any https listeners.
    ///
    /// # Returns
    ///
    /// [`true`] if @self is configured to serve https.
    #[doc(alias = "soup_server_is_https")]
    fn is_https(&self) -> bool {
        unsafe { from_glib(ffi::soup_server_is_https(self.as_ref().to_glib_none().0)) }
    }

    /// Attempts to set up @self to listen for connections on @address.
    ///
    /// If @options includes [`ServerListenOptions::HTTPS`][crate::ServerListenOptions::HTTPS], and @self has
    /// been configured for TLS, then @self will listen for https
    /// connections on this port. Otherwise it will listen for plain http.
    ///
    /// You may call this method (along with the other "listen" methods)
    /// any number of times on a server, if you want to listen on multiple
    /// ports, or set up both http and https service.
    ///
    /// After calling this method, @self will begin accepting and processing
    /// connections as soon as the appropriate [`glib::MainContext`][crate::glib::MainContext] is run.
    ///
    /// Note that this API does not make use of dual IPv4/IPv6 sockets; if
    /// @address is an IPv6 address, it will only accept IPv6 connections.
    /// You must configure IPv4 listening separately.
    /// ## `address`
    /// the address of the interface to listen on
    /// ## `options`
    /// listening options for this server
    ///
    /// # Returns
    ///
    /// [`true`] on success, [`false`] if @address could not be
    ///   bound or any other error occurred (in which case @error will be
    ///   set).
    #[doc(alias = "soup_server_listen")]
    fn listen(
        &self,
        address: &impl IsA<gio::SocketAddress>,
        options: ServerListenOptions,
    ) -> Result<(), glib::Error> {
        unsafe {
            let mut error = std::ptr::null_mut();
            let is_ok = ffi::soup_server_listen(
                self.as_ref().to_glib_none().0,
                address.as_ref().to_glib_none().0,
                options.into_glib(),
                &mut error,
            );
            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
            if error.is_null() {
                Ok(())
            } else {
                Err(from_glib_full(error))
            }
        }
    }

    /// Attempts to set up @self to listen for connections on all interfaces
    /// on the system.
    ///
    /// That is, it listens on the addresses `0.0.0.0` and/or `::`, depending on
    /// whether @options includes [`ServerListenOptions::IPV4_ONLY`][crate::ServerListenOptions::IPV4_ONLY],
    /// [`ServerListenOptions::IPV6_ONLY`][crate::ServerListenOptions::IPV6_ONLY], or neither.) If @port is specified, @self
    /// will listen on that port. If it is 0, @self will find an unused port to
    /// listen on. (In that case, you can use [`uris()`][Self::uris()] to find out
    /// what port it ended up choosing.
    ///
    /// See [`listen()`][Self::listen()] for more details.
    /// ## `port`
    /// the port to listen on, or 0
    /// ## `options`
    /// listening options for this server
    ///
    /// # Returns
    ///
    /// [`true`] on success, [`false`] if @port could not be bound
    ///   or any other error occurred (in which case @error will be set).
    #[doc(alias = "soup_server_listen_all")]
    fn listen_all(&self, port: u32, options: ServerListenOptions) -> Result<(), glib::Error> {
        unsafe {
            let mut error = std::ptr::null_mut();
            let is_ok = ffi::soup_server_listen_all(
                self.as_ref().to_glib_none().0,
                port,
                options.into_glib(),
                &mut error,
            );
            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
            if error.is_null() {
                Ok(())
            } else {
                Err(from_glib_full(error))
            }
        }
    }

    /// Attempts to set up @self to listen for connections on "localhost".
    ///
    /// That is, `127.0.0.1` and/or `::1`, depending on whether @options includes
    /// [`ServerListenOptions::IPV4_ONLY`][crate::ServerListenOptions::IPV4_ONLY], [`ServerListenOptions::IPV6_ONLY`][crate::ServerListenOptions::IPV6_ONLY], or neither). If
    /// @port is specified, @self will listen on that port. If it is 0, @self
    /// will find an unused port to listen on. (In that case, you can use
    /// [`uris()`][Self::uris()] to find out what port it ended up choosing.
    ///
    /// See [`listen()`][Self::listen()] for more details.
    /// ## `port`
    /// the port to listen on, or 0
    /// ## `options`
    /// listening options for this server
    ///
    /// # Returns
    ///
    /// [`true`] on success, [`false`] if @port could not be bound
    ///   or any other error occurred (in which case @error will be set).
    #[doc(alias = "soup_server_listen_local")]
    fn listen_local(&self, port: u32, options: ServerListenOptions) -> Result<(), glib::Error> {
        unsafe {
            let mut error = std::ptr::null_mut();
            let is_ok = ffi::soup_server_listen_local(
                self.as_ref().to_glib_none().0,
                port,
                options.into_glib(),
                &mut error,
            );
            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
            if error.is_null() {
                Ok(())
            } else {
                Err(from_glib_full(error))
            }
        }
    }

    /// Attempts to set up @self to listen for connections on @socket.
    ///
    /// See [`listen()`][Self::listen()] for more details.
    /// ## `socket`
    /// a listening #GSocket
    /// ## `options`
    /// listening options for this server
    ///
    /// # Returns
    ///
    /// [`true`] on success, [`false`] if an error occurred (in
    ///   which case @error will be set).
    #[doc(alias = "soup_server_listen_socket")]
    fn listen_socket(
        &self,
        socket: &impl IsA<gio::Socket>,
        options: ServerListenOptions,
    ) -> Result<(), glib::Error> {
        unsafe {
            let mut error = std::ptr::null_mut();
            let is_ok = ffi::soup_server_listen_socket(
                self.as_ref().to_glib_none().0,
                socket.as_ref().to_glib_none().0,
                options.into_glib(),
                &mut error,
            );
            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
            if error.is_null() {
                Ok(())
            } else {
                Err(from_glib_full(error))
            }
        }
    }

    /// Pauses I/O on @msg.
    ///
    /// This can be used when you need to return from the server handler without
    /// having the full response ready yet. Use [`unpause_message()`][Self::unpause_message()] to
    /// resume I/O.
    ///
    /// This must only be called on a [`ServerMessage`][crate::ServerMessage] which was created by the
    /// #SoupServer and are currently doing I/O, such as those passed into a
    /// `callback::ServerCallback or emitted in a [`request-read`][struct@crate::Server#request-read]
    /// signal.
    ///
    /// # Deprecated since 3.2
    ///
    /// Use soup_server_message_pause() instead.
    /// ## `msg`
    /// a #SoupServerMessage associated with @self.
    #[cfg_attr(feature = "v3_2", deprecated = "Since 3.2")]
    #[allow(deprecated)]
    #[doc(alias = "soup_server_pause_message")]
    fn pause_message(&self, msg: &ServerMessage) {
        unsafe {
            ffi::soup_server_pause_message(self.as_ref().to_glib_none().0, msg.to_glib_none().0);
        }
    }

    /// Removes @auth_domain from @self.
    /// ## `auth_domain`
    /// a #SoupAuthDomain
    #[doc(alias = "soup_server_remove_auth_domain")]
    fn remove_auth_domain(&self, auth_domain: &impl IsA<AuthDomain>) {
        unsafe {
            ffi::soup_server_remove_auth_domain(
                self.as_ref().to_glib_none().0,
                auth_domain.as_ref().to_glib_none().0,
            );
        }
    }

    /// Removes all handlers (early and normal) registered at @path.
    /// ## `path`
    /// the toplevel path for the handler
    #[doc(alias = "soup_server_remove_handler")]
    fn remove_handler(&self, path: &str) {
        unsafe {
            ffi::soup_server_remove_handler(self.as_ref().to_glib_none().0, path.to_glib_none().0);
        }
    }

    /// Removes support for WebSocket extension of type @extension_type (or any subclass of
    /// @extension_type) from @self.
    /// ## `extension_type`
    /// a #GType
    #[doc(alias = "soup_server_remove_websocket_extension")]
    fn remove_websocket_extension(&self, extension_type: glib::types::Type) {
        unsafe {
            ffi::soup_server_remove_websocket_extension(
                self.as_ref().to_glib_none().0,
                extension_type.into_glib(),
            );
        }
    }

    /// Sets @self's #GTlsAuthenticationMode to use for SSL/TLS client authentication.
    /// ## `mode`
    /// a #GTlsAuthenticationMode
    #[doc(alias = "soup_server_set_tls_auth_mode")]
    fn set_tls_auth_mode(&self, mode: gio::TlsAuthenticationMode) {
        unsafe {
            ffi::soup_server_set_tls_auth_mode(self.as_ref().to_glib_none().0, mode.into_glib());
        }
    }

    /// Sets @self up to do https, using the given SSL/TLS @certificate.
    /// ## `certificate`
    /// a #GTlsCertificate
    #[doc(alias = "soup_server_set_tls_certificate")]
    fn set_tls_certificate(&self, certificate: &impl IsA<gio::TlsCertificate>) {
        unsafe {
            ffi::soup_server_set_tls_certificate(
                self.as_ref().to_glib_none().0,
                certificate.as_ref().to_glib_none().0,
            );
        }
    }

    /// Sets @self's #GTlsDatabase to use for validating SSL/TLS client certificates.
    /// ## `tls_database`
    /// a #GTlsDatabase
    #[doc(alias = "soup_server_set_tls_database")]
    fn set_tls_database(&self, tls_database: &impl IsA<gio::TlsDatabase>) {
        unsafe {
            ffi::soup_server_set_tls_database(
                self.as_ref().to_glib_none().0,
                tls_database.as_ref().to_glib_none().0,
            );
        }
    }

    /// Resumes I/O on @msg.
    ///
    /// Use this to resume after calling [`pause_message()`][Self::pause_message()], or after
    /// adding a new chunk to a chunked response.
    ///
    /// I/O won't actually resume until you return to the main loop.
    ///
    /// This must only be called on a [`ServerMessage`][crate::ServerMessage] which was created by the
    /// #SoupServer and are currently doing I/O, such as those passed into a
    /// `callback::ServerCallback or emitted in a [`request-read`][struct@crate::Server#request-read]
    /// signal.
    ///
    /// # Deprecated since 3.2
    ///
    /// Use soup_server_message_unpause() instead.
    /// ## `msg`
    /// a #SoupServerMessage associated with @self.
    #[cfg_attr(feature = "v3_2", deprecated = "Since 3.2")]
    #[allow(deprecated)]
    #[doc(alias = "soup_server_unpause_message")]
    fn unpause_message(&self, msg: &ServerMessage) {
        unsafe {
            ffi::soup_server_unpause_message(self.as_ref().to_glib_none().0, msg.to_glib_none().0);
        }
    }

    /// If [`true`], percent-encoding in the Request-URI path will not be
    /// automatically decoded.
    #[doc(alias = "raw-paths")]
    fn is_raw_paths(&self) -> bool {
        ObjectExt::property(self.as_ref(), "raw-paths")
    }

    /// Server header.
    ///
    /// If non-[`None`], the value to use for the "Server" header on
    /// [`ServerMessage`][crate::ServerMessage]s processed by this server.
    ///
    /// The Server header is the server equivalent of the
    /// User-Agent header, and provides information about the
    /// server and its components. It contains a list of one or
    /// more product tokens, separated by whitespace, with the most
    /// significant product token coming first. The tokens must be
    /// brief, ASCII, and mostly alphanumeric (although "-", "_",
    /// and "." are also allowed), and may optionally include a "/"
    /// followed by a version string. You may also put comments,
    /// enclosed in parentheses, between or after the tokens.
    ///
    /// Some HTTP server implementations intentionally do not use
    /// version numbers in their Server header, so that
    /// installations running older versions of the server don't
    /// end up advertising their vulnerability to specific security
    /// holes.
    ///
    /// As with [`user_agent`][struct@crate::Session#user_agent], if you set a
    /// [`server-header`][struct@crate::Server#server-header] property that has trailing
    /// whitespace, #SoupServer will append its own product token (eg,
    /// `libsoup/2.3.2`) to the end of the header for you.
    #[doc(alias = "server-header")]
    fn server_header(&self) -> Option<glib::GString> {
        ObjectExt::property(self.as_ref(), "server-header")
    }

    /// Server header.
    ///
    /// If non-[`None`], the value to use for the "Server" header on
    /// [`ServerMessage`][crate::ServerMessage]s processed by this server.
    ///
    /// The Server header is the server equivalent of the
    /// User-Agent header, and provides information about the
    /// server and its components. It contains a list of one or
    /// more product tokens, separated by whitespace, with the most
    /// significant product token coming first. The tokens must be
    /// brief, ASCII, and mostly alphanumeric (although "-", "_",
    /// and "." are also allowed), and may optionally include a "/"
    /// followed by a version string. You may also put comments,
    /// enclosed in parentheses, between or after the tokens.
    ///
    /// Some HTTP server implementations intentionally do not use
    /// version numbers in their Server header, so that
    /// installations running older versions of the server don't
    /// end up advertising their vulnerability to specific security
    /// holes.
    ///
    /// As with [`user_agent`][struct@crate::Session#user_agent], if you set a
    /// [`server-header`][struct@crate::Server#server-header] property that has trailing
    /// whitespace, #SoupServer will append its own product token (eg,
    /// `libsoup/2.3.2`) to the end of the header for you.
    #[doc(alias = "server-header")]
    fn set_server_header(&self, server_header: Option<&str>) {
        ObjectExt::set_property(self.as_ref(), "server-header", server_header)
    }

    /// Emitted when processing has failed for a message.
    ///
    /// This could mean either that it could not be read (if
    /// [`request-read`][struct@crate::Server#request-read] has not been emitted for it yet), or that
    /// the response could not be written back (if [`request-read`][struct@crate::Server#request-read]
    /// has been emitted but [`request-finished`][struct@crate::Server#request-finished] has not been).
    ///
    /// @message is in an undefined state when this signal is
    /// emitted; the signal exists primarily to allow the server to
    /// free any state that it may have allocated in
    /// [`request-started`][struct@crate::Server#request-started].
    /// ## `message`
    /// the message
    #[doc(alias = "request-aborted")]
    fn connect_request_aborted<F: Fn(&Self, &ServerMessage) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn request_aborted_trampoline<
            P: IsA<Server>,
            F: Fn(&P, &ServerMessage) + 'static,
        >(
            this: *mut ffi::SoupServer,
            message: *mut ffi::SoupServerMessage,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(
                Server::from_glib_borrow(this).unsafe_cast_ref(),
                &from_glib_borrow(message),
            )
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"request-aborted\0".as_ptr() as *const _,
                Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
                    request_aborted_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    /// Emitted when the server has finished writing a response to
    /// a request.
    /// ## `message`
    /// the message
    #[doc(alias = "request-finished")]
    fn connect_request_finished<F: Fn(&Self, &ServerMessage) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn request_finished_trampoline<
            P: IsA<Server>,
            F: Fn(&P, &ServerMessage) + 'static,
        >(
            this: *mut ffi::SoupServer,
            message: *mut ffi::SoupServerMessage,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(
                Server::from_glib_borrow(this).unsafe_cast_ref(),
                &from_glib_borrow(message),
            )
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"request-finished\0".as_ptr() as *const _,
                Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
                    request_finished_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    /// Emitted when the server has successfully read a request.
    ///
    /// @message will have all of its request-side information
    /// filled in, and if the message was authenticated, @client
    /// will have information about that. This signal is emitted
    /// before any (non-early) handlers are called for the message,
    /// and if it sets the message's #status_code, then normal
    /// handler processing will be skipped.
    /// ## `message`
    /// the message
    #[doc(alias = "request-read")]
    fn connect_request_read<F: Fn(&Self, &ServerMessage) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn request_read_trampoline<
            P: IsA<Server>,
            F: Fn(&P, &ServerMessage) + 'static,
        >(
            this: *mut ffi::SoupServer,
            message: *mut ffi::SoupServerMessage,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(
                Server::from_glib_borrow(this).unsafe_cast_ref(),
                &from_glib_borrow(message),
            )
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"request-read\0".as_ptr() as *const _,
                Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
                    request_read_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    /// Emitted when the server has started reading a new request.
    ///
    /// @message will be completely blank; not even the
    /// Request-Line will have been read yet. About the only thing
    /// you can usefully do with it is connect to its signals.
    ///
    /// If the request is read successfully, this will eventually
    /// be followed by a [`request_read`][struct@crate::Server#request_read] signal]. If a
    /// response is then sent, the request processing will end with
    /// a [`request-finished`][struct@crate::Server#request-finished] signal. If a network error
    /// occurs, the processing will instead end with
    /// [`request-aborted`][struct@crate::Server#request-aborted].
    /// ## `message`
    /// the new message
    #[doc(alias = "request-started")]
    fn connect_request_started<F: Fn(&Self, &ServerMessage) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn request_started_trampoline<
            P: IsA<Server>,
            F: Fn(&P, &ServerMessage) + 'static,
        >(
            this: *mut ffi::SoupServer,
            message: *mut ffi::SoupServerMessage,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(
                Server::from_glib_borrow(this).unsafe_cast_ref(),
                &from_glib_borrow(message),
            )
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"request-started\0".as_ptr() as *const _,
                Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
                    request_started_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "server-header")]
    fn connect_server_header_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_server_header_trampoline<
            P: IsA<Server>,
            F: Fn(&P) + 'static,
        >(
            this: *mut ffi::SoupServer,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(Server::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::server-header\0".as_ptr() as *const _,
                Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
                    notify_server_header_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "tls-auth-mode")]
    fn connect_tls_auth_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_tls_auth_mode_trampoline<
            P: IsA<Server>,
            F: Fn(&P) + 'static,
        >(
            this: *mut ffi::SoupServer,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(Server::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::tls-auth-mode\0".as_ptr() as *const _,
                Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
                    notify_tls_auth_mode_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "tls-certificate")]
    fn connect_tls_certificate_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_tls_certificate_trampoline<
            P: IsA<Server>,
            F: Fn(&P) + 'static,
        >(
            this: *mut ffi::SoupServer,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(Server::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::tls-certificate\0".as_ptr() as *const _,
                Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
                    notify_tls_certificate_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "tls-database")]
    fn connect_tls_database_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_tls_database_trampoline<P: IsA<Server>, F: Fn(&P) + 'static>(
            this: *mut ffi::SoupServer,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(Server::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::tls-database\0".as_ptr() as *const _,
                Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
                    notify_tls_database_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }
}

impl<O: IsA<Server>> ServerExt for O {}