libgpac
Documentation of the core library of GPAC
_HTTPRequest Interface Reference

import"nodejs.idl";

Public Member Functions

attribute void send ()
 
attribute DOMString body attribute unsigned long throttle (unsigned long long done, unsigned long long total)
 
attribute signed long read (ArrayBuffer buffer)
 
attribute unsigned long write (ArrayBuffer buffer)
 
attribute void close (unsigned long error)
 

Data Fields

attribute unsigned long reply
 
attribute readonly DOMString method
 
attribute readonly DOMString url
 
attribute readonly unsigned long auth_code
 
attribute readonly Array headers_in
 
attribute Array headers_out
 

Detailed Description

interface for HTTP request

Member Function Documentation

◆ send()

attribute void _HTTPRequest::send ( )

send the response to the request

+ Here is the caller graph for this function:

◆ throttle()

attribute DOMString body attribute unsigned long _HTTPRequest::throttle ( unsigned long long  done,
unsigned long long  total 
)

reply body. It is undefined by default

  • 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 the read function

callback function used to throttle the download, can be used even if the request is handled by gpac. It is undefined by default

Parameters
doneamount of bytes already sent in request
totaltotal amount of bytes in request
Returns
a delay for next send in milliseconds

◆ read()

attribute signed long _HTTPRequest::read ( ArrayBuffer  buffer)

callback function used to get data (GET requests). It is undefined by default

Parameters
bufferarray buffer to fill (shared array, do NOT keep)
Returns
the number of bytes read, negative value means no data available yet, 0 means end of file

◆ write()

attribute unsigned long _HTTPRequest::write ( ArrayBuffer  buffer)

callback function used to receive data (PUT/POST requests). It is undefined by default

Parameters
bufferarray buffer received. If null, end of stream is reached
Returns
the number of bytes written (informative only)

◆ close()

attribute void _HTTPRequest::close ( unsigned long  error)

callback function used to monitor end of session. It is undefined by default

Parameters
errorGPAC error code for the session

Field Documentation

◆ reply

attribute unsigned long _HTTPRequest::reply

HTTP reply code to use. If 0, the request is handled by GPAC as usual. Otherwise, the request is handled by your script if the reply does not indicate an error

◆ method

attribute readonly DOMString _HTTPRequest::method

HTTP method of the request

◆ url

attribute readonly DOMString _HTTPRequest::url

HTTP URL of the request

◆ auth_code

attribute readonly unsigned long _HTTPRequest::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_in

attribute readonly Array _HTTPRequest::headers_in

HTTP headers of the request, array of _HTTPHeader objects

◆ headers_out

attribute Array _HTTPRequest::headers_out

HTTP headers to set on the response, array of _HTTPHeader objects (initialized as empty)