libgpac
Documentation of the core library of GPAC
Loading...
Searching...
No Matches
python.libgpac.libgpac.HTTPOutRequest Class Reference

HTTP request handler object. More...

Public Member Functions

 __init__ (self)
 Constructor.
 throttle (self, done, total)
 throttle the connection - if not overridden by subclass, not used
 read (self, buf, size)
 read data for the request - if not overridden by subclass, not used
 write (self, buf, size)
 write data for the request (PUT/POST) - if not overridden by subclass, not used
 close (self, reason)
 close callback for the request - if not overridden by subclass, not used
 on_request (self, method, url, auth_code, headers)
 callback for the request - this shoulld be overridden by subclass, default behaviour being to delegate to GPAC
 send (self)
 Send the reply to the client.

Data Fields

int reply = 0
 reply code A reply code of 0 means httpout will serve the resource as usual
 body = None
 reply body
list headers_out = []
 list of headers to add even values are header names, odd values are header values

Detailed Description

HTTP request handler object.

Constructor & Destructor Documentation

◆ __init__()

python.libgpac.libgpac.HTTPOutRequest.__init__ ( self)

Constructor.

Member Function Documentation

◆ throttle()

python.libgpac.libgpac.HTTPOutRequest.throttle ( self,
done,
total )

throttle the connection - if not overridden by subclass, not used

Parameters
doneamount of bytes of ressource sent
totaltotal size of ressource
Returns
a timeout in microseconds, or 0 to process immediately

◆ read()

python.libgpac.libgpac.HTTPOutRequest.read ( self,
buf,
size )

read data for the request - if not overridden by subclass, not used

Parameters
bufNP array (or c_ubyte pointer if no numpy support) to write data to
sizesize of array to fill
Returns
amount of bytes read, negative value means no data available yet, 0 means end of file

◆ write()

python.libgpac.libgpac.HTTPOutRequest.write ( self,
buf,
size )

write data for the request (PUT/POST) - if not overridden by subclass, not used

Parameters
bufNP array (or c_ubyte pointer if no numpy support) containing data from client
sizenumber of valid bytes in the array
Returns

◆ close()

python.libgpac.libgpac.HTTPOutRequest.close ( self,
reason )

close callback for the request - if not overridden by subclass, not used

Parameters
reasonGPAC error code of the end of session. If 1 (GF_EOS), the session is ended but underlying network is kept alive, otherwise session is destroyed
Returns

◆ on_request()

python.libgpac.libgpac.HTTPOutRequest.on_request ( self,
method,
url,
auth_code,
headers )

callback for the request - this shoulld be overridden by subclass, default behaviour being to delegate to GPAC

Parameters
methodHTTP method used, as string
urlURL of the HTTP request
auth_codeAuthentication reply code - requests are pre-identified using GPAC credentials: a value of 401 indicates no identification, 200 indicates identification OK, 403 indicates failure
headerslist of headers of input request, even values are header names, odd values are header values
Returns
Here is the call graph for this function:

◆ send()

python.libgpac.libgpac.HTTPOutRequest.send ( self)

Send the reply to the client.

This can be called aither upon on_request() or later (asynchronously)

Returns
Here is the caller graph for this function:

Field Documentation

◆ reply

int python.libgpac.libgpac.HTTPOutRequest.reply = 0

reply code A reply code of 0 means httpout will serve the resource as usual

◆ body

python.libgpac.libgpac.HTTPOutRequest.body = None

reply body

  • if reply is 0, this can be set to a file path to serve. If not set, usual URL resolving of httpout is done
  • if reply is not 0, this can be set to a string containing the body. To deliver a binary file or a large file, use read function

◆ headers_out

list python.libgpac.libgpac.HTTPOutRequest.headers_out = []

list of headers to add even values are header names, odd values are header values