HTTP request handler object.
|
def | __init__ (self) |
| Constructor. More...
|
|
def | throttle (self, done, total) |
| throttle the connection - if not overriden by subclass, not used More...
|
|
def | read (self, buf, size) |
| read data for the request - if not overriden by subclass, not used More...
|
|
def | write (self, buf, size) |
| write data for the request (PUT/POST) - if not overriden by subclass, not used More...
|
|
def | close (self, reason) |
| close callback for the request - if not overriden by subclass, not used More...
|
|
def | on_request (self, method, url, auth_code, headers) |
| callback for the request - this shoulld be overriden by subclass, default behaviour being to delegate to GPAC More...
|
|
def | send (self) |
| Send the reply to the client. More...
|
|
|
| reply |
| reply code A reply code of 0 means httpout will serve the resource as usual More...
|
|
| body |
| reply body More...
|
|
| headers_out |
| list of headers to add even values are header names, odd values are header values More...
|
|
◆ __init__()
def python.libgpac.libgpac.HTTPOutRequest.__init__ |
( |
|
self | ) |
|
◆ throttle()
def python.libgpac.libgpac.HTTPOutRequest.throttle |
( |
|
self, |
|
|
|
done, |
|
|
|
total |
|
) |
| |
- Parameters
-
done | amount of bytes of ressource sent |
total | total size of ressource |
- Returns
- a timeout in microseconds, or 0 to process immediately
◆ read()
def python.libgpac.libgpac.HTTPOutRequest.read |
( |
|
self, |
|
|
|
buf, |
|
|
|
size |
|
) |
| |
- Parameters
-
buf | NP array (or c_ubyte pointer if no numpy support) to write data to |
size | size of array to fill |
- Returns
- amount of bytes read, negative value means no data available yet, 0 means end of file
◆ write()
def python.libgpac.libgpac.HTTPOutRequest.write |
( |
|
self, |
|
|
|
buf, |
|
|
|
size |
|
) |
| |
- Parameters
-
buf | NP array (or c_ubyte pointer if no numpy support) containing data from client |
size | number of valid bytes in the array |
- Returns
◆ close()
def python.libgpac.libgpac.HTTPOutRequest.close |
( |
|
self, |
|
|
|
reason |
|
) |
| |
- Parameters
-
reason | GPAC 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()
def python.libgpac.libgpac.HTTPOutRequest.on_request |
( |
|
self, |
|
|
|
method, |
|
|
|
url, |
|
|
|
auth_code, |
|
|
|
headers |
|
) |
| |
- Parameters
-
method | HTTP method used, as string |
url | URL of the HTTP request |
auth_code | Authentication reply code - requests are pre-identified using GPAC credentials: a value of 401 indicates no identification, 200 indicates identification OK, 403 indicates failure |
headers | list of headers of input request, even values are header names, odd values are header values |
- Returns
◆ send()
def python.libgpac.libgpac.HTTPOutRequest.send |
( |
|
self | ) |
|
This can be called aither upon on_request or later (asynchronously)
- Returns
◆ reply
python.libgpac.libgpac.HTTPOutRequest.reply |
◆ body
python.libgpac.libgpac.HTTPOutRequest.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
python.libgpac.libgpac.HTTPOutRequest.headers_out |