Soup.ClientContext¶
Fields¶
None
Methods¶
get_address () |
|
get_auth_domain () |
|
get_auth_user () |
|
get_gsocket () |
|
get_host () |
|
get_local_address () |
|
get_remote_address () |
|
get_socket () |
|
steal_connection () |
Details¶
-
class
Soup.ClientContext¶ A
Soup.ClientContextprovides additional information about the client making a particular request. In particular, you can useSoup.ClientContext.get_auth_domain() andSoup.ClientContext.get_auth_user() to determine if HTTP authentication was used successfully.Soup.ClientContext.get_remote_address() and/orSoup.ClientContext.get_host() can be used to get information for logging or debugging purposes.Soup.ClientContext.get_gsocket() may also be of use in some situations (eg, tracking when multiple requests are made on the same connection).-
get_address()¶ Returns: the Soup.Addressassociated with the remote end of a connection, it may beNoneif you usedSoup.Server.accept_iostream().Return type: Soup.AddressorNoneRetrieves the
Soup.Addressassociated with the remote end of a connection.Deprecated since version ???: Use
Soup.ClientContext.get_remote_address(), which returns aGio.SocketAddress.
-
get_auth_domain()¶ Returns: a Soup.AuthDomain, orNoneif the request was not authenticated.Return type: Soup.AuthDomainorNoneChecks whether the request associated with self has been authenticated, and if so returns the
Soup.AuthDomainthat authenticated it.
-
get_auth_user()¶ Returns: the authenticated-as user, or Noneif the request was not authenticated.Return type: strorNoneChecks whether the request associated with self has been authenticated, and if so returns the username that the client authenticated as.
-
get_gsocket()¶ Returns: the Gio.Socketthat self is associated with,Noneif you usedSoup.Server.accept_iostream().Return type: Gio.SocketorNoneRetrieves the
Gio.Socketthat self is associated with.If you are using this method to observe when multiple requests are made on the same persistent HTTP connection (eg, as the ntlm-test test program does), you will need to pay attention to socket destruction as well (eg, by using weak references), so that you do not get fooled when the allocator reuses the memory address of a previously-destroyed socket to represent a new socket.
New in version 2.48.
-
get_host()¶ Returns: the IP address associated with the remote end of a connection, it may be Noneif you usedSoup.Server.accept_iostream().Return type: strorNoneRetrieves the IP address associated with the remote end of a connection.
-
get_local_address()¶ Returns: the Gio.SocketAddressassociated with the local end of a connection, it may beNoneif you usedSoup.Server.accept_iostream().Return type: Gio.SocketAddressorNoneRetrieves the
Gio.SocketAddressassociated with the local end of a connection.New in version 2.48.
-
get_remote_address()¶ Returns: the Gio.SocketAddressassociated with the remote end of a connection, it may beNoneif you usedSoup.Server.accept_iostream().Return type: Gio.SocketAddressorNoneRetrieves the
Gio.SocketAddressassociated with the remote end of a connection.New in version 2.48.
-
get_socket()¶ Returns: the Soup.Socketthat self is associated with.Return type: Soup.SocketRetrieves the
Soup.Socketthat self is associated with.If you are using this method to observe when multiple requests are made on the same persistent HTTP connection (eg, as the ntlm-test test program does), you will need to pay attention to socket destruction as well (either by using weak references, or by connecting to the
Soup.Socket::disconnectedsignal), so that you do not get fooled when the allocator reuses the memory address of a previously-destroyed socket to represent a new socket.Deprecated since version ???: use
Soup.ClientContext.get_gsocket(), which returns aGio.Socket.
-
steal_connection()¶ Returns: the Gio.IOStreamformerly associated with self (orNoneif self was no longer associated with a connection). No guarantees are made about what kind ofGio.IOStreamis returned.Return type: Gio.IOStream“Steals” the HTTP connection associated with self from its
Soup.Server. This happens immediately, regardless of the current state of the connection; if the response to the currentSoup.Messagehas not yet finished being sent, then it will be discarded; you can steal the connection from aSoup.Message:wrote-informationalorSoup.Message:wrote-bodysignal handler if you need to wait for part or all of the response to be sent.Note that when calling this function from C, self will most likely be freed as a side effect.
New in version 2.50.
-