com.Tivadar.Best.HTTP
Computes a CRC-32. The CRC-32 algorithm is parameterized - you
can set the polynomial and enable or disable bit
reversal. This can be used for GZIP, BZip2, or ZIP.
This type is used internally by DotNetZip; it is generally not used
directly by applications wishing to create, read, or manipulate zip
archive files.
Indicates the total number of bytes applied to the CRC.
Indicates the current CRC for all blocks slurped in.
Returns the CRC32 for the specified stream.
The stream over which to calculate the CRC32
the CRC32 calculation
Returns the CRC32 for the specified stream, and writes the input into the
output stream.
The stream over which to calculate the CRC32
The stream into which to deflate the input
the CRC32 calculation
Get the CRC32 for the given (word,byte) combo. This is a
computation defined by PKzip for PKZIP 2.0 (weak) encryption.
The word to start with.
The byte to combine it with.
The CRC-ized result.
Update the value for the running CRC32 using the given block of bytes.
This is useful when using the CRC32() class in a Stream.
block of bytes to slurp
starting point in the block
how many bytes within the block to slurp
Process one byte in the CRC.
the byte to include into the CRC .
Process a run of N identical bytes into the CRC.
This method serves as an optimization for updating the CRC when a
run of identical bytes is found. Rather than passing in a buffer of
length n, containing all identical bytes b, this method accepts the
byte value and the length of the (virtual) buffer - the length of
the run.
the byte to include into the CRC.
the number of times that byte should be repeated.
Combines the given CRC32 value with the current running total.
This is useful when using a divide-and-conquer approach to
calculating a CRC. Multiple threads can each calculate a
CRC32 on a segment of the data, and then combine the
individual CRC32 values at the end.
the crc value to be combined with this one
the length of data the CRC value was calculated on
Create an instance of the CRC32 class using the default settings: no
bit reversal, and a polynomial of 0xEDB88320.
Create an instance of the CRC32 class, specifying whether to reverse
data bits or not.
specify true if the instance should reverse data bits.
In the CRC-32 used by BZip2, the bits are reversed. Therefore if you
want a CRC32 with compatibility with BZip2, you should pass true
here. In the CRC-32 used by GZIP and PKZIP, the bits are not
reversed; Therefore if you want a CRC32 with compatibility with
those, you should pass false.
Create an instance of the CRC32 class, specifying the polynomial and
whether to reverse data bits or not.
The polynomial to use for the CRC, expressed in the reversed (LSB)
format: the highest ordered bit in the polynomial value is the
coefficient of the 0th power; the second-highest order bit is the
coefficient of the 1 power, and so on. Expressed this way, the
polynomial for the CRC-32C used in IEEE 802.3, is 0xEDB88320.
specify true if the instance should reverse data bits.
In the CRC-32 used by BZip2, the bits are reversed. Therefore if you
want a CRC32 with compatibility with BZip2, you should pass true
here for the reverseBits parameter. In the CRC-32 used by
GZIP and PKZIP, the bits are not reversed; Therefore if you want a
CRC32 with compatibility with those, you should pass false for the
reverseBits parameter.
Reset the CRC-32 class - clear the CRC "remainder register."
Use this when employing a single instance of this class to compute
multiple, distinct CRCs on multiple, distinct data blocks.
A class for compressing and decompressing streams using the Deflate algorithm.
The DeflateStream is a Decorator on a . It adds DEFLATE compression or decompression to any
stream.
Using this stream, applications can compress or decompress data via stream
Read and Write operations. Either compresssion or decompression
can occur through either reading or writing. The compression format used is
DEFLATE, which is documented in IETF RFC 1951, "DEFLATE
Compressed Data Format Specification version 1.3.".
Create a DeflateStream using the specified CompressionMode.
When mode is CompressionMode.Compress, the DeflateStream will use
the default compression level. The "captive" stream will be closed when
the DeflateStream is closed.
This example uses a DeflateStream to compress data from a file, and writes
the compressed data to another file.
using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress))
{
using (var raw = System.IO.File.Create(fileToCompress + ".deflated"))
{
using (Stream compressor = new DeflateStream(raw, CompressionMode.Compress))
{
byte[] buffer = new byte[WORKING_BUFFER_SIZE];
int n;
while ((n= input.Read(buffer, 0, buffer.Length)) != 0)
{
compressor.Write(buffer, 0, n);
}
}
}
}
Using input As Stream = File.OpenRead(fileToCompress)
Using raw As FileStream = File.Create(fileToCompress & ".deflated")
Using compressor As Stream = New DeflateStream(raw, CompressionMode.Compress)
Dim buffer As Byte() = New Byte(4096) {}
Dim n As Integer = -1
Do While (n <> 0)
If (n > 0) Then
compressor.Write(buffer, 0, n)
End If
n = input.Read(buffer, 0, buffer.Length)
Loop
End Using
End Using
End Using
The stream which will be read or written.
Indicates whether the DeflateStream will compress or decompress.
Create a DeflateStream using the specified CompressionMode and the specified CompressionLevel.
When mode is CompressionMode.Decompress, the level parameter is
ignored. The "captive" stream will be closed when the DeflateStream is
closed.
This example uses a DeflateStream to compress data from a file, and writes
the compressed data to another file.
using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress))
{
using (var raw = System.IO.File.Create(fileToCompress + ".deflated"))
{
using (Stream compressor = new DeflateStream(raw,
CompressionMode.Compress,
CompressionLevel.BestCompression))
{
byte[] buffer = new byte[WORKING_BUFFER_SIZE];
int n= -1;
while (n != 0)
{
if (n > 0)
compressor.Write(buffer, 0, n);
n= input.Read(buffer, 0, buffer.Length);
}
}
}
}
Using input As Stream = File.OpenRead(fileToCompress)
Using raw As FileStream = File.Create(fileToCompress & ".deflated")
Using compressor As Stream = New DeflateStream(raw, CompressionMode.Compress, CompressionLevel.BestCompression)
Dim buffer As Byte() = New Byte(4096) {}
Dim n As Integer = -1
Do While (n <> 0)
If (n > 0) Then
compressor.Write(buffer, 0, n)
End If
n = input.Read(buffer, 0, buffer.Length)
Loop
End Using
End Using
End Using
The stream to be read or written while deflating or inflating.
Indicates whether the DeflateStream will compress or decompress.
A tuning knob to trade speed for effectiveness.
Create a DeflateStream using the specified
CompressionMode, and explicitly specify whether the
stream should be left open after Deflation or Inflation.
This constructor allows the application to request that the captive stream
remain open after the deflation or inflation occurs. By default, after
Close() is called on the stream, the captive stream is also
closed. In some cases this is not desired, for example if the stream is a
memory stream that will be re-read after compression. Specify true for
the parameter to leave the stream open.
The DeflateStream will use the default compression level.
See the other overloads of this constructor for example code.
The stream which will be read or written. This is called the
"captive" stream in other places in this documentation.
Indicates whether the DeflateStream will compress or decompress.
true if the application would like the stream to
remain open after inflation/deflation.
Create a DeflateStream using the specified CompressionMode
and the specified CompressionLevel, and explicitly specify whether
the stream should be left open after Deflation or Inflation.
When mode is CompressionMode.Decompress, the level parameter is ignored.
This constructor allows the application to request that the captive stream
remain open after the deflation or inflation occurs. By default, after
Close() is called on the stream, the captive stream is also
closed. In some cases this is not desired, for example if the stream is a
that will be re-read after
compression. Specify true for the parameter
to leave the stream open.
This example shows how to use a DeflateStream to compress data from
a file, and store the compressed data into another file.
using (var output = System.IO.File.Create(fileToCompress + ".deflated"))
{
using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress))
{
using (Stream compressor = new DeflateStream(output, CompressionMode.Compress, CompressionLevel.BestCompression, true))
{
byte[] buffer = new byte[WORKING_BUFFER_SIZE];
int n= -1;
while (n != 0)
{
if (n > 0)
compressor.Write(buffer, 0, n);
n= input.Read(buffer, 0, buffer.Length);
}
}
}
// can write additional data to the output stream here
}
Using output As FileStream = File.Create(fileToCompress & ".deflated")
Using input As Stream = File.OpenRead(fileToCompress)
Using compressor As Stream = New DeflateStream(output, CompressionMode.Compress, CompressionLevel.BestCompression, True)
Dim buffer As Byte() = New Byte(4096) {}
Dim n As Integer = -1
Do While (n <> 0)
If (n > 0) Then
compressor.Write(buffer, 0, n)
End If
n = input.Read(buffer, 0, buffer.Length)
Loop
End Using
End Using
' can write additional data to the output stream here.
End Using
The stream which will be read or written.
Indicates whether the DeflateStream will compress or decompress.
true if the application would like the stream to remain open after inflation/deflation.
A tuning knob to trade speed for effectiveness.
Create a DeflateStream using the specified CompressionMode
and the specified CompressionLevel, and explicitly specify whether
the stream should be left open after Deflation or Inflation.
When mode is CompressionMode.Decompress, the level parameter is ignored.
This constructor allows the application to request that the captive stream
remain open after the deflation or inflation occurs. By default, after
Close() is called on the stream, the captive stream is also
closed. In some cases this is not desired, for example if the stream is a
that will be re-read after
compression. Specify true for the parameter
to leave the stream open.
This example shows how to use a DeflateStream to compress data from
a file, and store the compressed data into another file.
using (var output = System.IO.File.Create(fileToCompress + ".deflated"))
{
using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress))
{
using (Stream compressor = new DeflateStream(output, CompressionMode.Compress, CompressionLevel.BestCompression, true))
{
byte[] buffer = new byte[WORKING_BUFFER_SIZE];
int n= -1;
while (n != 0)
{
if (n > 0)
compressor.Write(buffer, 0, n);
n= input.Read(buffer, 0, buffer.Length);
}
}
}
// can write additional data to the output stream here
}
Using output As FileStream = File.Create(fileToCompress & ".deflated")
Using input As Stream = File.OpenRead(fileToCompress)
Using compressor As Stream = New DeflateStream(output, CompressionMode.Compress, CompressionLevel.BestCompression, True)
Dim buffer As Byte() = New Byte(4096) {}
Dim n As Integer = -1
Do While (n <> 0)
If (n > 0) Then
compressor.Write(buffer, 0, n)
End If
n = input.Read(buffer, 0, buffer.Length)
Loop
End Using
End Using
' can write additional data to the output stream here.
End Using
The stream which will be read or written.
Indicates whether the DeflateStream will compress or decompress.
true if the application would like the stream to remain open after inflation/deflation.
A tuning knob to trade speed for effectiveness.
Desired window bits.
This property sets the flush behavior on the stream.
See the ZLIB documentation for the meaning of the flush behavior.
The size of the working buffer for the compression codec.
The working buffer is used for all stream operations. The default size is
1024 bytes. The minimum size is 128 bytes. You may get better performance
with a larger buffer. Then again, you might not. You would have to test
it.
Set this before the first call to Read() or Write() on the
stream. If you try to set it afterwards, it will throw.
The ZLIB strategy to be used during compression.
By tweaking this parameter, you may be able to optimize the compression for
data with particular characteristics.
Returns the total number of bytes input so far.
Returns the total number of bytes output so far.
Dispose the stream.
This may or may not result in a Close() call on the captive
stream. See the constructors that have a leaveOpen parameter
for more information.
Application code won't call this code directly. This method may be
invoked in two distinct scenarios. If disposing == true, the method
has been called directly or indirectly by a user's code, for example
via the public Dispose() method. In this case, both managed and
unmanaged resources can be referenced and disposed. If disposing ==
false, the method has been called by the runtime from inside the
object finalizer and this method should not reference other objects;
in that case only unmanaged resources must be referenced or
disposed.
true if the Dispose method was invoked by user code.
Indicates whether the stream can be read.
The return value depends on whether the captive stream supports reading.
Indicates whether the stream supports Seek operations.
Always returns false.
Indicates whether the stream can be written.
The return value depends on whether the captive stream supports writing.
Flush the stream.
Reading this property always throws a .
The position of the stream pointer.
Setting this property always throws a . Reading will return the total bytes
written out, if used in writing, or the total bytes read in, if used in
reading. The count may refer to compressed bytes or uncompressed bytes,
depending on how you've used the stream.
Read data from the stream.
If you wish to use the DeflateStream to compress data while
reading, you can create a DeflateStream with
CompressionMode.Compress, providing an uncompressed data stream.
Then call Read() on that DeflateStream, and the data read will be
compressed as you read. If you wish to use the DeflateStream to
decompress data while reading, you can create a DeflateStream with
CompressionMode.Decompress, providing a readable compressed data
stream. Then call Read() on that DeflateStream, and the data read
will be decompressed as you read.
A DeflateStream can be used for Read() or Write(), but not both.
The buffer into which the read data should be placed.
the offset within that data array to put the first byte read.
the number of bytes to read.
the number of bytes actually read
Calling this method always throws a .
this is irrelevant, since it will always throw!
this is irrelevant, since it will always throw!
irrelevant!
Will call the base stream's SetLength method.
Write data to the stream.
If you wish to use the DeflateStream to compress data while
writing, you can create a DeflateStream with
CompressionMode.Compress, and a writable output stream. Then call
Write() on that DeflateStream, providing uncompressed data
as input. The data sent to the output stream will be the compressed form
of the data written. If you wish to use the DeflateStream to
decompress data while writing, you can create a DeflateStream with
CompressionMode.Decompress, and a writable output stream. Then
call Write() on that stream, providing previously compressed
data. The data sent to the output stream will be the decompressed form of
the data written.
A DeflateStream can be used for Read() or Write(),
but not both.
The buffer holding data to write to the stream.
the offset within that data array to find the first byte to write.
the number of bytes to write.
A class for compressing and decompressing GZIP streams.
The GZipStream is a Decorator on a
. It adds GZIP compression or decompression to any
stream.
Like the System.IO.Compression.GZipStream in the .NET Base Class Library, the
Ionic.Zlib.GZipStream can compress while writing, or decompress while
reading, but not vice versa. The compression method used is GZIP, which is
documented in IETF RFC
1952, "GZIP file format specification version 4.3".
A GZipStream can be used to decompress data (through Read()) or
to compress data (through Write()), but not both.
If you wish to use the GZipStream to compress data, you must wrap it
around a write-able stream. As you call Write() on the GZipStream, the
data will be compressed into the GZIP format. If you want to decompress data,
you must wrap the GZipStream around a readable stream that contains an
IETF RFC 1952-compliant stream. The data will be decompressed as you call
Read() on the GZipStream.
Though the GZIP format allows data from multiple files to be concatenated
together, this stream handles only a single segment of GZIP format, typically
representing a single file.
The comment on the GZIP stream.
The GZIP format allows for each file to optionally have an associated
comment stored with the file. The comment is encoded with the ISO-8859-1
code page. To include a comment in a GZIP stream you create, set this
property before calling Write() for the first time on the
GZipStream.
When using GZipStream to decompress, you can retrieve this property
after the first call to Read(). If no comment has been set in the
GZIP bytestream, the Comment property will return null
(Nothing in VB).
The FileName for the GZIP stream.
The GZIP format optionally allows each file to have an associated
filename. When compressing data (through Write()), set this
FileName before calling Write() the first time on the GZipStream.
The actual filename is encoded into the GZIP bytestream with the
ISO-8859-1 code page, according to RFC 1952. It is the application's
responsibility to insure that the FileName can be encoded and decoded
correctly with this code page.
When decompressing (through Read()), you can retrieve this value
any time after the first Read(). In the case where there was no filename
encoded into the GZIP bytestream, the property will return null (Nothing
in VB).
The last modified time for the GZIP stream.
GZIP allows the storage of a last modified time with each GZIP entity.
When compressing data, you can set this before the first call to
Write(). When decompressing, you can retrieve this value any time
after the first call to Read().
The CRC on the GZIP stream.
This is used for internal error checking. You probably don't need to look at this property.
Create a GZipStream using the specified CompressionMode.
When mode is CompressionMode.Compress, the GZipStream will use the
default compression level.
As noted in the class documentation, the CompressionMode (Compress
or Decompress) also establishes the "direction" of the stream. A
GZipStream with CompressionMode.Compress works only through
Write(). A GZipStream with
CompressionMode.Decompress works only through Read().
This example shows how to use a GZipStream to compress data.
using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress))
{
using (var raw = System.IO.File.Create(outputFile))
{
using (Stream compressor = new GZipStream(raw, CompressionMode.Compress))
{
byte[] buffer = new byte[WORKING_BUFFER_SIZE];
int n;
while ((n= input.Read(buffer, 0, buffer.Length)) != 0)
{
compressor.Write(buffer, 0, n);
}
}
}
}
Dim outputFile As String = (fileToCompress & ".compressed")
Using input As Stream = File.OpenRead(fileToCompress)
Using raw As FileStream = File.Create(outputFile)
Using compressor As Stream = New GZipStream(raw, CompressionMode.Compress)
Dim buffer As Byte() = New Byte(4096) {}
Dim n As Integer = -1
Do While (n <> 0)
If (n > 0) Then
compressor.Write(buffer, 0, n)
End If
n = input.Read(buffer, 0, buffer.Length)
Loop
End Using
End Using
End Using
This example shows how to use a GZipStream to uncompress a file.
private void GunZipFile(string filename)
{
if (!filename.EndsWith(".gz))
throw new ArgumentException("filename");
var DecompressedFile = filename.Substring(0,filename.Length-3);
byte[] working = new byte[WORKING_BUFFER_SIZE];
int n= 1;
using (System.IO.Stream input = System.IO.File.OpenRead(filename))
{
using (Stream decompressor= new Ionic.Zlib.GZipStream(input, CompressionMode.Decompress, true))
{
using (var output = System.IO.File.Create(DecompressedFile))
{
while (n !=0)
{
n= decompressor.Read(working, 0, working.Length);
if (n > 0)
{
output.Write(working, 0, n);
}
}
}
}
}
}
Private Sub GunZipFile(ByVal filename as String)
If Not (filename.EndsWith(".gz)) Then
Throw New ArgumentException("filename")
End If
Dim DecompressedFile as String = filename.Substring(0,filename.Length-3)
Dim working(WORKING_BUFFER_SIZE) as Byte
Dim n As Integer = 1
Using input As Stream = File.OpenRead(filename)
Using decompressor As Stream = new Ionic.Zlib.GZipStream(input, CompressionMode.Decompress, True)
Using output As Stream = File.Create(UncompressedFile)
Do
n= decompressor.Read(working, 0, working.Length)
If n > 0 Then
output.Write(working, 0, n)
End IF
Loop While (n > 0)
End Using
End Using
End Using
End Sub
The stream which will be read or written.
Indicates whether the GZipStream will compress or decompress.
Create a GZipStream using the specified CompressionMode and
the specified CompressionLevel.
The CompressionMode (Compress or Decompress) also establishes the
"direction" of the stream. A GZipStream with
CompressionMode.Compress works only through Write(). A
GZipStream with CompressionMode.Decompress works only
through Read().
This example shows how to use a GZipStream to compress a file into a .gz file.
using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress))
{
using (var raw = System.IO.File.Create(fileToCompress + ".gz"))
{
using (Stream compressor = new GZipStream(raw,
CompressionMode.Compress,
CompressionLevel.BestCompression))
{
byte[] buffer = new byte[WORKING_BUFFER_SIZE];
int n;
while ((n= input.Read(buffer, 0, buffer.Length)) != 0)
{
compressor.Write(buffer, 0, n);
}
}
}
}
Using input As Stream = File.OpenRead(fileToCompress)
Using raw As FileStream = File.Create(fileToCompress & ".gz")
Using compressor As Stream = New GZipStream(raw, CompressionMode.Compress, CompressionLevel.BestCompression)
Dim buffer As Byte() = New Byte(4096) {}
Dim n As Integer = -1
Do While (n <> 0)
If (n > 0) Then
compressor.Write(buffer, 0, n)
End If
n = input.Read(buffer, 0, buffer.Length)
Loop
End Using
End Using
End Using
The stream to be read or written while deflating or inflating.
Indicates whether the GZipStream will compress or decompress.
A tuning knob to trade speed for effectiveness.
Create a GZipStream using the specified CompressionMode, and
explicitly specify whether the stream should be left open after Deflation
or Inflation.
This constructor allows the application to request that the captive stream
remain open after the deflation or inflation occurs. By default, after
Close() is called on the stream, the captive stream is also
closed. In some cases this is not desired, for example if the stream is a
memory stream that will be re-read after compressed data has been written
to it. Specify true for the parameter to leave
the stream open.
The (Compress or Decompress) also
establishes the "direction" of the stream. A GZipStream with
CompressionMode.Compress works only through Write(). A GZipStream
with CompressionMode.Decompress works only through Read().
The GZipStream will use the default compression level. If you want
to specify the compression level, see .
See the other overloads of this constructor for example code.
The stream which will be read or written. This is called the "captive"
stream in other places in this documentation.
Indicates whether the GZipStream will compress or decompress.
true if the application would like the base stream to remain open after
inflation/deflation.
Create a GZipStream using the specified CompressionMode and the
specified CompressionLevel, and explicitly specify whether the
stream should be left open after Deflation or Inflation.
This constructor allows the application to request that the captive stream
remain open after the deflation or inflation occurs. By default, after
Close() is called on the stream, the captive stream is also
closed. In some cases this is not desired, for example if the stream is a
memory stream that will be re-read after compressed data has been written
to it. Specify true for the parameter to
leave the stream open.
As noted in the class documentation, the CompressionMode (Compress
or Decompress) also establishes the "direction" of the stream. A
GZipStream with CompressionMode.Compress works only through
Write(). A GZipStream with CompressionMode.Decompress works only
through Read().
This example shows how to use a GZipStream to compress data.
using (System.IO.Stream input = System.IO.File.OpenRead(fileToCompress))
{
using (var raw = System.IO.File.Create(outputFile))
{
using (Stream compressor = new GZipStream(raw, CompressionMode.Compress, CompressionLevel.BestCompression, true))
{
byte[] buffer = new byte[WORKING_BUFFER_SIZE];
int n;
while ((n= input.Read(buffer, 0, buffer.Length)) != 0)
{
compressor.Write(buffer, 0, n);
}
}
}
}
Dim outputFile As String = (fileToCompress & ".compressed")
Using input As Stream = File.OpenRead(fileToCompress)
Using raw As FileStream = File.Create(outputFile)
Using compressor As Stream = New GZipStream(raw, CompressionMode.Compress, CompressionLevel.BestCompression, True)
Dim buffer As Byte() = New Byte(4096) {}
Dim n As Integer = -1
Do While (n <> 0)
If (n > 0) Then
compressor.Write(buffer, 0, n)
End If
n = input.Read(buffer, 0, buffer.Length)
Loop
End Using
End Using
End Using
The stream which will be read or written.
Indicates whether the GZipStream will compress or decompress.
true if the application would like the stream to remain open after inflation/deflation.
A tuning knob to trade speed for effectiveness.
This property sets the flush behavior on the stream.
The size of the working buffer for the compression codec.
The working buffer is used for all stream operations. The default size is
1024 bytes. The minimum size is 128 bytes. You may get better performance
with a larger buffer. Then again, you might not. You would have to test
it.
Set this before the first call to Read() or Write() on the
stream. If you try to set it afterwards, it will throw.
Returns the total number of bytes input so far.
Returns the total number of bytes output so far.
Dispose the stream.
This may or may not result in a Close() call on the captive
stream. See the constructors that have a leaveOpen parameter
for more information.
This method may be invoked in two distinct scenarios. If disposing
== true, the method has been called directly or indirectly by a
user's code, for example via the public Dispose() method. In this
case, both managed and unmanaged resources can be referenced and
disposed. If disposing == false, the method has been called by the
runtime from inside the object finalizer and this method should not
reference other objects; in that case only unmanaged resources must
be referenced or disposed.
indicates whether the Dispose method was invoked by user code.
Indicates whether the stream can be read.
The return value depends on whether the captive stream supports reading.
Indicates whether the stream supports Seek operations.
Always returns false.
Indicates whether the stream can be written.
The return value depends on whether the captive stream supports writing.
Flush the stream.
Reading this property always throws a .
The position of the stream pointer.
Setting this property always throws a . Reading will return the total bytes
written out, if used in writing, or the total bytes read in, if used in
reading. The count may refer to compressed bytes or uncompressed bytes,
depending on how you've used the stream.
Read and decompress data from the source stream.
With a GZipStream, decompression is done through reading.
byte[] working = new byte[WORKING_BUFFER_SIZE];
using (System.IO.Stream input = System.IO.File.OpenRead(_CompressedFile))
{
using (Stream decompressor= new Ionic.Zlib.GZipStream(input, CompressionMode.Decompress, true))
{
using (var output = System.IO.File.Create(_DecompressedFile))
{
int n;
while ((n= decompressor.Read(working, 0, working.Length)) !=0)
{
output.Write(working, 0, n);
}
}
}
}
The buffer into which the decompressed data should be placed.
the offset within that data array to put the first byte read.
the number of bytes to read.
the number of bytes actually read
Calling this method always throws a .
irrelevant; it will always throw!
irrelevant; it will always throw!
irrelevant!
Calling this method always throws a .
irrelevant; this method will always throw!
Write data to the stream.
If you wish to use the GZipStream to compress data while writing,
you can create a GZipStream with CompressionMode.Compress, and a
writable output stream. Then call Write() on that GZipStream,
providing uncompressed data as input. The data sent to the output stream
will be the compressed form of the data written.
A GZipStream can be used for Read() or Write(), but not
both. Writing implies compression. Reading implies decompression.
The buffer holding data to write to the stream.
the offset within that data array to find the first byte to write.
the number of bytes to write.
Describes how to flush the current deflate operation.
The different FlushType values are useful when using a Deflate in a streaming application.
No flush at all.
Closes the current block, but doesn't flush it to
the output. Used internally only in hypothetical
scenarios. This was supposed to be removed by Zlib, but it is
still in use in some edge cases.
Use this during compression to specify that all pending output should be
flushed to the output buffer and the output should be aligned on a byte
boundary. You might use this in a streaming communication scenario, so that
the decompressor can get all input data available so far. When using this
with a ZlibCodec, AvailableBytesIn will be zero after the call if
enough output space has been provided before the call. Flushing will
degrade compression and so it should be used only when necessary.
Use this during compression to specify that all output should be flushed, as
with FlushType.Sync, but also, the compression state should be reset
so that decompression can restart from this point if previous compressed
data has been damaged or if random access is desired. Using
FlushType.Full too often can significantly degrade the compression.
Signals the end of the compression/decompression stream.
The compression level to be used when using a DeflateStream or ZlibStream with CompressionMode.Compress.
None means that the data will be simply stored, with no change at all.
If you are producing ZIPs for use on Mac OSX, be aware that archives produced with CompressionLevel.None
cannot be opened with the default zip reader. Use a different CompressionLevel.
Same as None.
The fastest but least effective compression.
A synonym for BestSpeed.
A little slower, but better, than level 1.
A little slower, but better, than level 2.
A little slower, but better, than level 3.
A little slower than level 4, but with better compression.
The default compression level, with a good balance of speed and compression efficiency.
A synonym for Default.
Pretty good compression!
Better compression than Level7!
The "best" compression, where best means greatest reduction in size of the input data stream.
This is also the slowest compression.
A synonym for BestCompression.
Describes options for how the compression algorithm is executed. Different strategies
work better on different sorts of data. The strategy parameter can affect the compression
ratio and the speed of compression but not the correctness of the compresssion.
The default strategy is probably the best for normal data.
The Filtered strategy is intended to be used most effectively with data produced by a
filter or predictor. By this definition, filtered data consists mostly of small
values with a somewhat random distribution. In this case, the compression algorithm
is tuned to compress them better. The effect of Filtered is to force more Huffman
coding and less string matching; it is a half-step between Default and HuffmanOnly.
Using HuffmanOnly will force the compressor to do Huffman encoding only, with no
string matching.
An enum to specify the direction of transcoding - whether to compress or decompress.
Used to specify that the stream should compress the data.
Used to specify that the stream should decompress the data.
A general purpose exception class for exceptions in the Zlib library.
The ZlibException class captures exception information generated
by the Zlib library.
This ctor collects a message attached to the exception.
the message for the exception.
Performs an unsigned bitwise right shift with the specified number
Number to operate on
Ammount of bits to shift
The resulting number from the shift operation
Reads a number of characters from the current source TextReader and writes
the data to the target array at the specified index.
The source TextReader to read from
Contains the array of characteres read from the source TextReader.
The starting index of the target array.
The maximum number of characters to read from the source TextReader.
The number of characters read. The number will be less than or equal to
count depending on the data available in the source TextReader. Returns -1
if the end of the stream is reached.
Computes an Adler-32 checksum.
The Adler checksum is similar to a CRC checksum, but faster to compute, though less
reliable. It is used in producing RFC1950 compressed streams. The Adler checksum
is a required part of the "ZLIB" standard. Applications will almost never need to
use this class directly.
Calculates the Adler32 checksum.
This is used within ZLIB. You probably don't need to use this directly.
To compute an Adler32 checksum on a byte array:
var adler = Adler.Adler32(0, null, 0, 0);
adler = Adler.Adler32(adler, buffer, index, length);
Encoder and Decoder for ZLIB and DEFLATE (IETF RFC1950 and RFC1951).
This class compresses and decompresses data according to the Deflate algorithm
and optionally, the ZLIB format, as documented in RFC 1950 - ZLIB and RFC 1951 - DEFLATE.
The buffer from which data is taken.
An index into the InputBuffer array, indicating where to start reading.
The number of bytes available in the InputBuffer, starting at NextIn.
Generally you should set this to InputBuffer.Length before the first Inflate() or Deflate() call.
The class will update this number as calls to Inflate/Deflate are made.
Total number of bytes read so far, through all calls to Inflate()/Deflate().
Buffer to store output data.
An index into the OutputBuffer array, indicating where to start writing.
The number of bytes available in the OutputBuffer, starting at NextOut.
Generally you should set this to OutputBuffer.Length before the first Inflate() or Deflate() call.
The class will update this number as calls to Inflate/Deflate are made.
Total number of bytes written to the output so far, through all calls to Inflate()/Deflate().
used for diagnostics, when something goes wrong!
The compression level to use in this codec. Useful only in compression mode.
The number of Window Bits to use.
This gauges the size of the sliding window, and hence the
compression effectiveness as well as memory consumption. It's best to just leave this
setting alone if you don't know what it is. The maximum value is 15 bits, which implies
a 32k window.
The compression strategy to use.
This is only effective in compression. The theory offered by ZLIB is that different
strategies could potentially produce significant differences in compression behavior
for different data sets. Unfortunately I don't have any good recommendations for how
to set it differently. When I tested changing the strategy I got minimally different
compression performance. It's best to leave this property alone if you don't have a
good feel for it. Or, you may want to produce a test harness that runs through the
different strategy options and evaluates them on different file types. If you do that,
let me know your results.
The Adler32 checksum on the data transferred through the codec so far. You probably don't need to look at this.
Create a ZlibCodec.
If you use this default constructor, you will later have to explicitly call
InitializeInflate() or InitializeDeflate() before using the ZlibCodec to compress
or decompress.
Create a ZlibCodec that either compresses or decompresses.
Indicates whether the codec should compress (deflate) or decompress (inflate).
Initialize the inflation state.
It is not necessary to call this before using the ZlibCodec to inflate data;
It is implicitly called when you call the constructor.
Z_OK if everything goes well.
Initialize the inflation state with an explicit flag to
govern the handling of RFC1950 header bytes.
By default, the ZLIB header defined in RFC 1950 is expected. If
you want to read a zlib stream you should specify true for
expectRfc1950Header. If you have a deflate stream, you will want to specify
false. It is only necessary to invoke this initializer explicitly if you
want to specify false.
whether to expect an RFC1950 header byte
pair when reading the stream of data to be inflated.
Z_OK if everything goes well.
Initialize the ZlibCodec for inflation, with the specified number of window bits.
The number of window bits to use. If you need to ask what that is,
then you shouldn't be calling this initializer.
Z_OK if all goes well.
Initialize the inflation state with an explicit flag to govern the handling of
RFC1950 header bytes.
If you want to read a zlib stream you should specify true for
expectRfc1950Header. In this case, the library will expect to find a ZLIB
header, as defined in RFC
1950, in the compressed stream. If you will be reading a DEFLATE or
GZIP stream, which does not have such a header, you will want to specify
false.
whether to expect an RFC1950 header byte pair when reading
the stream of data to be inflated.
The number of window bits to use. If you need to ask what that is,
then you shouldn't be calling this initializer.
Z_OK if everything goes well.
Inflate the data in the InputBuffer, placing the result in the OutputBuffer.
You must have set InputBuffer and OutputBuffer, NextIn and NextOut, and AvailableBytesIn and
AvailableBytesOut before calling this method.
private void InflateBuffer()
{
int bufferSize = 1024;
byte[] buffer = new byte[bufferSize];
ZlibCodec decompressor = new ZlibCodec();
Console.WriteLine("\n============================================");
Console.WriteLine("Size of Buffer to Inflate: {0} bytes.", CompressedBytes.Length);
MemoryStream ms = new MemoryStream(DecompressedBytes);
int rc = decompressor.InitializeInflate();
decompressor.InputBuffer = CompressedBytes;
decompressor.NextIn = 0;
decompressor.AvailableBytesIn = CompressedBytes.Length;
decompressor.OutputBuffer = buffer;
// pass 1: inflate
do
{
decompressor.NextOut = 0;
decompressor.AvailableBytesOut = buffer.Length;
rc = decompressor.Inflate(FlushType.None);
if (rc != ZlibConstants.Z_OK && rc != ZlibConstants.Z_STREAM_END)
throw new Exception("inflating: " + decompressor.Message);
ms.Write(decompressor.OutputBuffer, 0, buffer.Length - decompressor.AvailableBytesOut);
}
while (decompressor.AvailableBytesIn > 0 || decompressor.AvailableBytesOut == 0);
// pass 2: finish and flush
do
{
decompressor.NextOut = 0;
decompressor.AvailableBytesOut = buffer.Length;
rc = decompressor.Inflate(FlushType.Finish);
if (rc != ZlibConstants.Z_STREAM_END && rc != ZlibConstants.Z_OK)
throw new Exception("inflating: " + decompressor.Message);
if (buffer.Length - decompressor.AvailableBytesOut > 0)
ms.Write(buffer, 0, buffer.Length - decompressor.AvailableBytesOut);
}
while (decompressor.AvailableBytesIn > 0 || decompressor.AvailableBytesOut == 0);
decompressor.EndInflate();
}
The flush to use when inflating.
Z_OK if everything goes well.
Ends an inflation session.
Call this after successively calling Inflate(). This will cause all buffers to be flushed.
After calling this you cannot call Inflate() without a intervening call to one of the
InitializeInflate() overloads.
Z_OK if everything goes well.
I don't know what this does!
Z_OK if everything goes well.
Initialize the ZlibCodec for deflation operation.
The codec will use the MAX window bits and the default level of compression.
int bufferSize = 40000;
byte[] CompressedBytes = new byte[bufferSize];
byte[] DecompressedBytes = new byte[bufferSize];
ZlibCodec compressor = new ZlibCodec();
compressor.InitializeDeflate(CompressionLevel.Default);
compressor.InputBuffer = System.Text.ASCIIEncoding.ASCII.GetBytes(TextToCompress);
compressor.NextIn = 0;
compressor.AvailableBytesIn = compressor.InputBuffer.Length;
compressor.OutputBuffer = CompressedBytes;
compressor.NextOut = 0;
compressor.AvailableBytesOut = CompressedBytes.Length;
while (compressor.TotalBytesIn != TextToCompress.Length && compressor.TotalBytesOut < bufferSize)
{
compressor.Deflate(FlushType.None);
}
while (true)
{
int rc= compressor.Deflate(FlushType.Finish);
if (rc == ZlibConstants.Z_STREAM_END) break;
}
compressor.EndDeflate();
Z_OK if all goes well. You generally don't need to check the return code.
Initialize the ZlibCodec for deflation operation, using the specified CompressionLevel.
The codec will use the maximum window bits (15) and the specified
CompressionLevel. It will emit a ZLIB stream as it compresses.
The compression level for the codec.
Z_OK if all goes well.
Initialize the ZlibCodec for deflation operation, using the specified CompressionLevel,
and the explicit flag governing whether to emit an RFC1950 header byte pair.
The codec will use the maximum window bits (15) and the specified CompressionLevel.
If you want to generate a zlib stream, you should specify true for
wantRfc1950Header. In this case, the library will emit a ZLIB
header, as defined in RFC
1950, in the compressed stream.
The compression level for the codec.
whether to emit an initial RFC1950 byte pair in the compressed stream.
Z_OK if all goes well.
Initialize the ZlibCodec for deflation operation, using the specified CompressionLevel,
and the specified number of window bits.
The codec will use the specified number of window bits and the specified CompressionLevel.
The compression level for the codec.
the number of window bits to use. If you don't know what this means, don't use this method.
Z_OK if all goes well.
Initialize the ZlibCodec for deflation operation, using the specified
CompressionLevel, the specified number of window bits, and the explicit flag
governing whether to emit an RFC1950 header byte pair.
The compression level for the codec.
whether to emit an initial RFC1950 byte pair in the compressed stream.
the number of window bits to use. If you don't know what this means, don't use this method.
Z_OK if all goes well.
Deflate one batch of data.
You must have set InputBuffer and OutputBuffer before calling this method.
private void DeflateBuffer(CompressionLevel level)
{
int bufferSize = 1024;
byte[] buffer = new byte[bufferSize];
ZlibCodec compressor = new ZlibCodec();
Console.WriteLine("\n============================================");
Console.WriteLine("Size of Buffer to Deflate: {0} bytes.", UncompressedBytes.Length);
MemoryStream ms = new MemoryStream();
int rc = compressor.InitializeDeflate(level);
compressor.InputBuffer = UncompressedBytes;
compressor.NextIn = 0;
compressor.AvailableBytesIn = UncompressedBytes.Length;
compressor.OutputBuffer = buffer;
// pass 1: deflate
do
{
compressor.NextOut = 0;
compressor.AvailableBytesOut = buffer.Length;
rc = compressor.Deflate(FlushType.None);
if (rc != ZlibConstants.Z_OK && rc != ZlibConstants.Z_STREAM_END)
throw new Exception("deflating: " + compressor.Message);
ms.Write(compressor.OutputBuffer, 0, buffer.Length - compressor.AvailableBytesOut);
}
while (compressor.AvailableBytesIn > 0 || compressor.AvailableBytesOut == 0);
// pass 2: finish and flush
do
{
compressor.NextOut = 0;
compressor.AvailableBytesOut = buffer.Length;
rc = compressor.Deflate(FlushType.Finish);
if (rc != ZlibConstants.Z_STREAM_END && rc != ZlibConstants.Z_OK)
throw new Exception("deflating: " + compressor.Message);
if (buffer.Length - compressor.AvailableBytesOut > 0)
ms.Write(buffer, 0, buffer.Length - compressor.AvailableBytesOut);
}
while (compressor.AvailableBytesIn > 0 || compressor.AvailableBytesOut == 0);
compressor.EndDeflate();
ms.Seek(0, SeekOrigin.Begin);
CompressedBytes = new byte[compressor.TotalBytesOut];
ms.Read(CompressedBytes, 0, CompressedBytes.Length);
}
whether to flush all data as you deflate. Generally you will want to
use Z_NO_FLUSH here, in a series of calls to Deflate(), and then call EndDeflate() to
flush everything.
Z_OK if all goes well.
End a deflation session.
Call this after making a series of one or more calls to Deflate(). All buffers are flushed.
Z_OK if all goes well.
Reset a codec for another deflation session.
Call this to reset the deflation state. For example if a thread is deflating
non-consecutive blocks, you can call Reset() after the Deflate(Sync) of the first
block and before the next Deflate(None) of the second block.
Z_OK if all goes well.
Set the CompressionStrategy and CompressionLevel for a deflation session.
the level of compression to use.
the strategy to use for compression.
Z_OK if all goes well.
Set the dictionary to be used for either Inflation or Deflation.
The dictionary bytes to use.
Z_OK if all goes well.
A bunch of constants used in the Zlib interface.
The maximum number of window bits for the Deflate algorithm.
The default number of window bits for the Deflate algorithm.
indicates everything is A-OK
Indicates that the last operation reached the end of the stream.
The operation ended in need of a dictionary.
There was an error with the stream - not enough data, not open and readable, etc.
There was an error with the data - not enough data, bad data, etc.
There was an error with the working buffer.
The size of the working buffer used in the ZlibCodec class. Defaults to 8192 bytes.
The minimum size of the working buffer used in the ZlibCodec class. Currently it is 128 bytes.
Map from a distance to a distance code.
No side effects. _dist_code[256] and _dist_code[257] are never used.
Loads the first content from the metadata indexes.
Loads the content from the metadata index.
Loads all content from the metadatas.
Loads all content from the metadata indexes.
Sum size of the cached contents
Implements most common list functions. With best case (no or only one item) it doesn't do any allocation.
Depth of the node.
Difference between LeftDepth and RightDepth.
Left node's Depth, or -1 if it's null.
Right node's Depth, or -1 if it's null.
Removes node and reparent any child it has.
Index newly added metadata
Remove metadata from all indexes.
Clear all indexes
Get indexes in an optimized order. This is usually one of the indexes' WalkHorizontal() call.
Called when metadata loaded from file
Called by a concrete MetadataService implementation to create a new metadata
On WP8 platform there are no ASCII encoding.
On WP8 platform there are no ASCII encoding.
Returns true if the Uri's host is a valid IPv4 or IPv6 address.
Validates an IPv4 address.
Validates an IPv6 address.
Will fill the entire buffer from the stream. Will throw an exception when the underlying stream is closed.
Will parse a comma-separeted header value
Used in string parsers. Its Value is optional.
A manager class that can handle subscribing and unsubscribeing in the same update.
Base class for specialized parsers
Create a new TimerData but the Created field will be set to the current time.
Global entry point to access and manage main services of the plugin.
Static constructor. Setup default values.
Delegate for the setup finished event.
Instance of the per-host settings manager.
Cached DateTime value for cases where high resolution isn't needed.
Warning!! It must be used only on the main update thread!
By default the plugin will save all cache and cookie data under the path returned by Application.persistentDataPath.
You can assign a function to this delegate to return a custom root path to define a new path.
This delegate will be called on a non Unity thread!
The global, default proxy for all HTTPRequests. The HTTPRequest's Proxy still can be changed per-request. Default value is null.
Heartbeat manager to use less threads in the plugin. The heartbeat updates are called from the OnUpdate function.
A basic Best.HTTP.Logger.ILogger implementation to be able to log intelligently additional informations about the plugin's internal mechanism.
An IIOService implementation to handle filesystem operations.
User-agent string that will be sent with each requests.
It's true if the application is quitting and the plugin is shutting down itself.
The local content cache, maintained by the plugin. When set to a non-null value, Maintain called immediately on the cache.
Initializes the HTTPManager with default settings. This method should be called on Unity's main thread before using the HTTP plugin. By default it gets called by .
Will return where the various caches should be saved.
Updates the HTTPManager. This method should be called regularly from a Unity event (e.g., Update, LateUpdate).
It processes various events and callbacks and manages internal tasks.
Shuts down the HTTPManager and performs cleanup operations. This method should be called when the application is quitting.
Aborts all ongoing HTTP requests and performs an immediate shutdown of the HTTPManager.
Threading mode the plugin will use to call HTTPManager.OnUpdate().
HTTPManager.OnUpdate() is called from the HTTPUpdateDelegator's Update functions (Unity's main thread).
The plugin starts a dedicated thread to call HTTPManager.OnUpdate() periodically.
HTTPManager.OnUpdate() will not be called automatically.
Will route some U3D calls to the HTTPManager.
The singleton instance of the HTTPUpdateDelegator
True, if the Instance property should hold a valid value.
It's true if the dispatch thread running.
The current threading mode the plugin is in.
How much time the plugin should wait between two update call. Its default value 100 ms.
Called in the OnApplicationQuit function. If this function returns False, the plugin will not start to
shut down itself.
Called when the Unity application's foreground state changed.
Will create the HTTPUpdateDelegator instance and set it up.
Return true if the call happens on the Unity main thread. Setup must be called before to save the thread id!
Set directly the threading mode to use.
Swaps threading mode between Unity's Update function or a distinct thread.
Pings the update thread to call HTTPManager.OnUpdate immediately.
Works only when the current threading mode is Threaded!
Provides an implementation of that writes log messages to a file.
Gets a value indicating whether this log output accepts color codes. Always returns false.
Initializes a new instance of the FileOutput class with the specified file name.
The name of the file to write log messages to.
Writes a log message to the file.
The log level of the message.
The log message to write.
Flushes any buffered log messages to the file.
Releases any resources used by the FileOutput instance.
Available logging levels.
All message will be logged.
Only Informations and above will be logged.
Only Warnings and above will be logged.
Only Errors and above will be logged.
Only Exceptions will be logged.
No logging will occur.
Represents an output target for log messages.
This interface defines methods for writing log messages to an output target.
Implementations of this interface are used to configure where log messages
should be written.
Two of its out-of-the-box implementations are
- UnityOutput
- FileOutput
Gets a value indicating whether the log output supports colored text.
Writes a log entry to the output.
The logging level of the entry.
The log message to write.
Flushes any buffered log entries to the output.
Represents a filter for further sort out what log entries to include in the final log output.
Return true if the division must be included in the output.
Represents a logger for recording log messages.
Gets or sets the minimum severity level for logging.
Gets or sets the output target for log messages.
The instance used to write log messages.
Gets or sets an output filter to decide what messages are included or not.
The instance used for filtering.
Property indicating whether the logger's internal queue is empty or not.
Gets a value indicating whether diagnostic logging is enabled.
Diagnostic logging is enabled when is set to .
Logs a message with level.
The division or category of the log message.
The verbose log message.
The optional for additional context.
Logs a message with level.
The division or category of the log message.
The verbose log message.
The optional for additional context.
Logs a message with level.
The division or category of the log message.
The verbose log message.
The optional for additional context.
Logs a message with level.
The division or category of the log message.
The verbose log message.
The optional for additional context.
Logs a message with level.
The division or category of the log message.
The verbose log message.
The optional for additional context.
Represents a logging context for categorizing and organizing log messages.
The LoggingContext class is used to provide additional context information
to log messages, allowing for better categorization and organization of log output. It can be
associated with specific objects or situations to enrich log entries with context-specific data.
Gets the unique hash value of this logging context.
Initializes a new instance of the LoggingContext class associated with the specified object.
The object to associate the context with.
Adds a long value to the logging context.
The key to associate with the value.
The long value to add.
Adds a bool value to the logging context.
The key to associate with the value.
The bool value to add.
Adds a string value to the logging context.
The key to associate with the value.
The string value to add.
Adds a LoggingContext value to the logging context.
The key to associate with the value.
The LoggingContext value to add.
Gets the string field with the specified name from the logging context.
The name of the string field to retrieve.
The value of the string field or null if not found.
Removes a field from the logging context by its key.
The key of the field to remove.
Converts the logging context and its associated fields to a JSON string representation.
A instance to which the JSON string is appended.
This method serializes the logging context and its associated fields into a JSON format
for structured logging purposes. The resulting JSON string represents the context and its fields, making it
suitable for inclusion in log entries for better analysis and debugging.
implementation to include only one division in the log output.
implementation to allow filtering for multiple divisions.
Provides an implementation of that writes log messages to the Unity Debug Console.
Gets a value indicating whether this log output accepts color codes.
This property returns true when running in the Unity Editor and false otherwise.
Writes a log message to the Unity Debug Console based on the specified log level.
The log level of the message.
The log message to write.
This implementation does nothing.
These are the different modes that the plugin want's to use a filestream.
Create a new file.
Open an existing file for reading.
Open or create a file for read and write.
Open an existing file for writing to the end.
Interface for file-system abstraction.
Create a directory for the given path.
Return true if the directory exists for the given path.
Delete the directory.
Return with the file names for the given path.
Delete the file for the given path.
Return true if the file exists on the given path.
Create a stream that can read and/or write a file on the given path.
The code generation options available for IL to C++ conversion.
Enable or disabled these with caution.
Enable or disable code generation for null checks.
Global null check support is enabled by default when il2cpp.exe
is launched from the Unity editor.
Disabling this will prevent NullReferenceException exceptions from
being thrown in generated code. In *most* cases, code that dereferences
a null pointer will crash then. Sometimes the point where the crash
happens is later than the location where the null reference check would
have been emitted though.
Enable or disable code generation for array bounds checks.
Global array bounds check support is enabled by default when il2cpp.exe
is launched from the Unity editor.
Disabling this will prevent IndexOutOfRangeException exceptions from
being thrown in generated code. This will allow reading and writing to
memory outside of the bounds of an array without any runtime checks.
Disable this check with extreme caution.
Enable or disable code generation for divide by zero checks.
Global divide by zero check support is disabled by default when il2cpp.exe
is launched from the Unity editor.
Enabling this will cause DivideByZeroException exceptions to be
thrown in generated code. Most code doesn't need to handle this
exception, so it is probably safe to leave it disabled.
Use this attribute on a class, method, or property to inform the IL2CPP code conversion utility to override the
global setting for one of a few different runtime checks.
Example:
[Il2CppSetOption(Option.NullChecks, false)]
public static string MethodWithNullChecksDisabled()
{
var tmp = new Object();
return tmp.ToString();
}
https://docs.unity3d.com/Manual/ManagedCodeStripping.html
Light-weight user-mode lock for code blocks that has rare contentions and doesn't take a long time to finish.
The BufferPool is a foundational element of the Best HTTP package, aiming to reduce dynamic memory allocation overheads by reusing byte arrays. The concept is elegantly simple: rather than allocating and deallocating memory for every requirement, byte arrays can be "borrowed" and "returned" within this pool. Once returned, these arrays are retained for subsequent use, minimizing repetitive memory operations.
While the BufferPool is housed within the Best HTTP package, its benefits are not limited to just HTTP operations. All protocols and packages integrated with or built upon the Best HTTP package utilize and benefit from the BufferPool. This ensures that memory is used efficiently and performance remains optimal across all integrated components.
Represents an empty byte array that can be returned for zero-length requests.
Gets or sets a value indicating whether the buffer pooling mechanism is enabled or disabled.
Disabling will also clear all stored entries.
Specifies the duration after which buffer entries, once released back to the pool, are deemed old and will be
considered for removal in the next maintenance cycle.
Specifies how frequently the maintenance cycle should run to manage old buffers.
Specifies the minimum buffer size that will be allocated. If a request is made for a size smaller than this and canBeLarger is true,
this size will be used.
Specifies the maximum size of a buffer that the system will consider storing back into the pool.
Specifies the maximum total size of all stored buffers. When the buffer reach this threshold, new releases will be declined.
Indicates whether to remove buffer stores that don't hold any buffers from the free list.
If set to true, and a byte array is released back to the pool more than once, an error will be logged.
Error checking is expensive and has a very large overhead! Turn it on with caution!
Fetches a byte array from the pool.
Depending on the `canBeLarger` parameter, the returned buffer may be larger than the requested size!
Requested size of the buffer.
If true, the returned buffer can be larger than the requested size.
Optional context for logging purposes.
A byte array from the pool or a newly allocated one if suitable size is not available.
Releases a list of buffer segments back to the pool in a bulk operation.
List of buffer segments to release.
Releases a list of buffer segments back to the pool in a bulk operation.
List of buffer segments to release.
Releases a byte array back to the pool.
Buffer to be released back to the pool.
Resizes a byte array by returning the old one to the pool and fetching (or creating) a new one of the specified size.
Buffer to resize.
New size for the buffer.
If true, the new buffer can be larger than the specified size.
If true, the new buffer will be cleared (set to all zeros).
Optional context for logging purposes.
A resized buffer.
Clears all stored entries in the buffer pool instantly, releasing memory.
Internal method called by the plugin to remove old, non-used buffers.
Represents a segment (a continuous section) of a byte array, providing functionalities to
work with a portion of the data without copying.
Represents an empty buffer segment.
The underlying data of the buffer segment.
The starting offset of the segment within the data.
The number of bytes in the segment that contain valid data.
Initializes a new instance of the BufferSegment struct.
The data for the buffer segment.
The starting offset of the segment.
The number of bytes in the segment.
Converts the buffer segment to an AutoReleaseBuffer to use it in a local using statement.
A new AutoReleaseBuffer instance containing the data of the buffer segment.
Creates a new segment starting from the specified offset.
The new segment will reference the same underlying byte[] as the original, without creating a copy of the data.
The starting offset of the new segment.
A new buffer segment that references the same underlying data.
Creates a new segment with the specified offset and count.
The new segment will reference the same underlying byte[] as the original, without creating a copy of the data.
The starting offset of the new segment.
The number of bytes in the new segment.
A new buffer segment that references the same underlying data.
Copyies the buffer's content to the received array.
The array the data will be copied into.
Private data struct that contains the size - byte arrays mapping.
Size/length of the arrays stored in the buffers.
Create a new store with its first byte[] to store.
Helper struct for .
The actual reference to the stored byte array.
When the buffer is put back to the pool. Based on this value the pool will calculate the age of the buffer.
The IPeekableContentProvider interface defines an abstraction for providing content to an with the ability to peek at the content without consuming it.
It is an essential part of content streaming over a TCP connection.
Key Functions of IPeekableContentProvider:
-
Content ProvisionIt provides content to an associated without immediately consuming the content. This allows the consumer to examine the data before processing.
-
Two-Way BindingSupports establishing a two-way binding between the and an , enabling bidirectional communication between the provider and consumer.
-
UnbindingProvides methods for unbinding a content consumer, terminating the association between the provider and consumer.
Gets the associated with this content provider, which allows peeking at the content without consuming it.
Gets the implementor that will be notified through calls when new data is available in the TCPStreamer.
Sets up a two-way binding between this content provider and an . This enables bidirectional communication between the provider and consumer.
The to bind to.
Unbinds the content provider from its associated content consumer. This terminates the association between the provider and consumer.
Unbinds the content provider from a specific content consumer if it is currently bound to that consumer.
The to unbind from.
The IContentConsumer interface represents a consumer of content provided by an . It defines methods for handling received content and connection-related events.
Key Functions of IContentConsumer:
-
Content HandlingDefines methods for handling incoming content, allowing consumers to process data as it becomes available.
-
Connection ManagementProvides event methods to notify consumers of connection closure and error conditions, facilitating graceful handling of connection-related issues.
Gets the associated with this content consumer, which allows access to incoming content.
This method should not be called directly. It is used internally to set the binding between the content consumer and its associated content provider.
The to bind to.
This method should not be called directly. It is used internally to unset the binding between the content consumer and its associated content provider.
Called when new content is available from the associated content provider.
Called when the connection is closed by the remote peer. It notifies the content consumer about the connection closure.
Called when an error occurs during content processing or connection handling. It provides the exception that caused the error.
The that represents the error condition.
Implements pooling logic for instances.
Setting this property to false the pooling mechanism can be disabled.
Buffer entries that released back to the pool and older than this value are moved when next maintenance is triggered.
How often pool maintenance must run.
This is a modified MemoryStream class to use VariableSizedBufferPool
A PeekableStream implementation that also implements the interface too.
This will set Consumer to null.
Set Consumer to null if the current one is the one passed in the parameter.
Wrapper of multiple streams. Writes and reads are both supported. Read goes trough all the streams.
A custom buffer stream implementation that will not close the underlying stream.
Based on the download from http://techblog.procurios.nl/k/news/view/14605/14863/how-do-i-write-my-own-parser-%28for-json%29.html
This class encodes and decodes JSON strings.
Spec. details, see http://www.json.org/
JSON uses Arrays and Objects. These correspond here to the datatypes List and Dictionary.
All numbers are parsed to doubles.
Parses the string json into a value
A JSON string.
A List, a Dictionary, a double, a string, null, true, or false
Parses the string json into a value; and fills 'success' with the successfullness of the parse.
A JSON string.
Successful parse?
A List, a Dictionary, a double, a string, null, true, or false
Converts a Dictionary / List object into a JSON string
A Dictionary / List
A JSON encoded string, or null if object 'json' is not serializable
Determines whether the json contains an element that has the specified key.
The key to locate in the json.
true if the json contains an element that has the specified key; otherwise, false.
A builder struct for constructing an instance of the HTTPCache class with optional configuration options and callbacks.
Sets the configuration options for the HTTP cache.
The containing cache configuration settings.
The current instance for method chaining.
Sets the configuration options for the HTTP cache using an .
An for building cache configuration settings.
The current instance for method chaining.
Sets a callback delegate to be executed before caching of an entity begins.
The delegate to be executed before caching starts.
The current instance for method chaining.
Builds and returns an instance of the with the specified configuration options and callback delegate.
An instance configured with the specified options and callback.
A builder struct for constructing an instance of with optional configuration settings.
Sets the maximum cache size for the HTTP cache.
The maximum size, in bytes, that the cache can reach.
The current instance for method chaining.
Sets the maximum duration for which cached entries will be retained.
By default all entities (even stalled ones) are kept cached until they are evicted to make room for new, fresh ones.
The maximum age for cached entries to be retained.
The current instance for method chaining.
Builds and returns an instance of with the specified configuration settings.
An instance configured with the specified settings.
Types of errors that can occur during cache validation.
Indicates that no error has occurred during validation.
Indicates a server error has occurred during validation.
Indicates a connection error has occurred during validation.
Represents a delegate that can be used to perform actions before caching of an entity begins.
The HTTP method used in the request.
The URI of the HTTP request.
The HTTP status code of the response.
The HTTP response headers.
An optional logging context for debugging.
Represents a delegate that can be used to handle cache size change events.
Manages caching of HTTP responses and associated metadata.
The `HTTPCache` class provides a powerful caching mechanism for HTTP responses in Unity applications.
It allows you to store and retrieve HTTP responses efficiently, reducing network requests and improving
the performance of your application. By utilizing HTTP caching, you can enhance user experience, reduce
bandwidth usage, and optimize loading times.
Key features:
- Optimal User ExperienceUsers experience faster load times and smoother interactions, enhancing user satisfaction.
- Efficient CachingIt enables efficient caching of HTTP responses, reducing the need to fetch data from the network repeatedly.
- Improved PerformanceCaching helps improve the performance of your Unity application by reducing latency and decreasing loading times.
- Bandwidth OptimizationBy storing and reusing cached responses, you can minimize bandwidth usage, making your application more data-friendly.
- Offline AccessCached responses allow your application to function even when the device is offline or has limited connectivity.
- Reduced Server LoadFewer network requests mean less load on your server infrastructure, leading to cost savings and improved server performance.
- Manual Cache ControlYou can also manually control caching by adding, removing, or updating cached responses.
Constants defining folder and file names used in the HTTP cache storage.
This is the reversed domain the plugin uses for file paths when it have to load content from the local cache.
Event that is triggered when the size of the cache changes.
Gets the options that define the behavior of the HTTP cache.
Gets the current size of the HTTP cache in bytes.
Called before the plugin calls to decide whether the content will be cached or not.
Initializes a new instance of the HTTPCache class with the specified cache options.
The HTTP cache options specifying cache size and deletion policy.
Calculates a unique hash identifier based on the HTTP method and URI.
The HTTP method used in the request.
The URI of the HTTP request.
A unique hash identifier for the combination of method and URI.
Generates the directory path based on the given hash where cached content is stored.
A unique hash identifier for the cached content, returned by .
The directory path for the cached content associated with the given hash.
Generates the file path for the header cache associated with the given hash.
A unique hash identifier for the cached content, returned by .
The file path for the header cache associated with the given hash.
Generates the file path for the content cache associated with the given hash.
A unique hash identifier for the cached content, returned by .
The file path for the content cache associated with the given hash.
Checks whether cache files (header and content) associated with the given hash exist.
A unique hash identifier for the cached content.
true if both header and content cache files exist, otherwise false.
Sets up validation headers on an HTTP request if a locally cached response exists.
The to which validation headers will be added.
If necessary tries to make enough space in the cache by calling Maintain.
Initiates the caching process for an HTTP response, creating an if caching is enabled and all predconditions are met.
The method used to fetch the response.
The URI for the response.
The HTTP status code of the response.
The HTTP headers of the response.
An optional logging context for debugging.
An instance for writing the response content to the cache, or null if caching is not enabled or not possible.
Finalizes the caching process and takes appropriate actions based on the completion status.
The instance representing the caching operation.
A boolean indicating whether the caching process completed without issues.
An optional logging context for debugging.
Initiates the process of reading cached content associated with a given hash. Call BeginReadContent to acquire a Stream object that points to the cached resource.
A hash from identifying the resource.
An optional
A stream for reading the cached content, or null if the content could not be read (the resource isn't cached or currently downloading).
Finalizes the process of reading cached content associated with a given hash.
The unique hash identifier for the cached content.
An optional logging context for debugging.
Deletes a cached entry identified by the given hash, including its associated header and content files.
The unique hash identifier for the cached entry to be deleted.
An optional logging context for debugging.
Refreshes the headers of a cached HTTP response with new headers.
A unique hash identifier for the cached response from a call.
A dictionary of new headers to replace or merge with existing headers.
Used by the plugin to add an addition logging context for debugging. It can be null.
true if the headers were successfully refreshed; otherwise, false.
Checks whether the caches resource identified by the hash is can be served from the local store with the given error conditions.
This check reflects the very current state, even if it returns true, a request might just executing to get a write lock on it to refresh the content.
hash returned by identifying a resource.
Possible error condition that can occur during validation. Servers can provision that certain stalled resources can be served if revalidation fails.
Used by the plugin to add an addition logging context for debugging. It can be null.
true if the cached response can be served without validating it with the origin server; otherwise, false
Redirects a request to a cached entity.
The that will be redirected.
Hash obtained from .
Clears the HTTP cache by removing all cached entries and associated metadata.
Represents a writer for caching HTTP response content.
Gets the parent HTTPCache instance associated with this content writer.
Hash identifying the resource. If fails, it becomes an invalid one.
Expected length of the content. Has a non-zero value only when the server is sending a "content-length" header.
Number of bytes written to the cache.
Context of this cache writer used for logging.
Underlying stream the download bytes are written into.
Writes content to the underlying stream.
holding a reference to the data and containing information about the offset and count of the valid range of data.
Close the underlying stream and invalidate the hash.
Possible lock-states a cache-content can be in.
No reads or writes are happening on the cached content.
There's one writer operating on the cached content. No other writes or reads allowed while this lock is held on the content.
There's at least one read operation happening on the cached content. No writes allowed while this lock is held on the content.
Metadata stored for every cached content. It contains only limited data about the content to help early cache decision making and cache management.
Unique hash of the cached content, generated by .
Size of the stored content in bytes.
When the last time the content is accessed. Also initialized when the initial download completes.
What kind of lock the content is currently in.
Number of readers.
Possible caching flags that a `Cache-Control` header can send.
No special treatment required.
Indicates whether the entity must be revalidated with the server or can be serverd directly from the cache without touching the server when the content is considered stale.
More details can be found here:
If it's true, the client always have to revalidate the cached content when it's stale.
More details can be found here:
Cached content associated with a .
This is NOT the cached content received from the server! It's for storing caching values to decide on how the content can be used.
ETag of the entity.
More details can be found here:
LastModified date of the entity. Use ToString("r") to convert it to the format defined in RFC 1123.
When the cache will expire.
More details can be found here:
The age that came with the response
More details can be found here:
Maximum how long the entry should served from the cache without revalidation.
More details can be found here:
The Date that came with the response.
More details can be found here:
It's a grace period to serve staled content without revalidation.
More details can be found here:
Allows the client to serve stale content if the server responds with an 5xx error.
More details can be found here:
bool values packed into one single flag.
The value of the clock at the time of the request that resulted in the stored response.
More details can be found here:
The value of the clock at the time the response was received.
Represents the configuration options for the HTTP cache.
Gets or sets the maximum duration for which cached entries will be retained.
Gets or sets the maximum size, in bytes, that the cache can reach.
Initializes a new instance of the class with default settings.
Initializes a new instance of the class with custom settings.
The maximum age for cached entries to be retained.
The maximum size, in bytes, that the cache can reach.
The Cookie implementation based on RFC-6265.
The name of the cookie.
The value of the cookie.
The Date when the Cookie is registered.
When this Cookie last used in a request.
The Expires attribute indicates the maximum lifetime of the cookie, represented as the date and time at which the cookie expires.
The user agent is not required to retain the cookie until the specified date has passed.
In fact, user agents often evict cookies due to memory pressure or privacy concerns.
The Max-Age attribute indicates the maximum lifetime of the cookie, represented as the number of seconds until the cookie expires.
The user agent is not required to retain the cookie for the specified duration.
In fact, user agents often evict cookies due to memory pressure or privacy concerns.
If a cookie has neither the Max-Age nor the Expires attribute, the user agent will retain the cookie until "the current session is over".
The Domain attribute specifies those hosts to which the cookie will be sent.
For example, if the value of the Domain attribute is "example.com", the user agent will include the cookie
in the Cookie header when making HTTP requests to example.com, www.example.com, and www.corp.example.com.
If the server omits the Domain attribute, the user agent will return the cookie only to the origin server.
The scope of each cookie is limited to a set of paths, controlled by the Path attribute.
If the server omits the Path attribute, the user agent will use the "directory" of the request-uri's path component as the default value.
The Secure attribute limits the scope of the cookie to "secure" channels (where "secure" is defined by the user agent).
When a cookie has the Secure attribute, the user agent will include the cookie in an HTTP request only if the request is
transmitted over a secure channel (typically HTTP over Transport Layer Security (TLS)).
The HttpOnly attribute limits the scope of the cookie to HTTP requests.
In particular, the attribute instructs the user agent to omit the cookie when providing access to
cookies via "non-HTTP" APIs (such as a web browser API that exposes cookies to scripts).
SameSite prevents the browser from sending this cookie along with cross-site requests.
The main goal is mitigate the risk of cross-origin information leakage.
It also provides some protection against cross-site request forgery attacks.
Possible values for the flag are lax or strict.
More details can be found here:
- SameSite cookies explained
Guess the storage size of the cookie.
The Cookie Jar implementation based on RFC 6265.
Maximum size of the Cookie Jar in bytes. It's default value is 10485760 (10 MB).
Returns true if File apis are supported.
The plugin will delete cookies that are accessed this threshold ago. Its default value is 7 days.
If this property is set to true, then new cookies treated as session cookies and these cookies are not saved to disk. Its default value is false.
Enabled or disables storing and handling of cookies. If set to false, HTTPRequests aren't searched for cookies and no cookies will be set for s.
List of the Cookies
Synchronization object for thread safety.
Will set or update all cookies from the response object.
Deletes all expired or 'old' cookies, and will keep the sum size of cookies under the given size.
Saves the Cookie Jar to a file.
Not implemented under Unity WebPlayer
Load previously persisted cookie library from the file.
Returns all Cookies that corresponds to the given Uri.
Will add a new, or overwrite an old cookie if already exists.
Will add a new, or overwrite an old cookie if already exists.
Deletes all cookies from the Jar.
Removes cookies that older than the given parameter.
Removes cookies that matches to the given domain.
Find and return a Cookie and his index in the list.
Abstract base class for concrete connection implementation (HTTP/1, HTTP/2, WebGL, File).
The address of the server that this connection is bound to.
The state of this connection.
If the State is HTTPConnectionStates.Processing, then it holds a HTTPRequest instance. Otherwise it's null.
How much the connection kept alive after its last request processing.
Number of assigned requests to process.
Maximum number of assignable requests.
When we start to process the current request. It's set after the connection is established.
Called when the plugin shuts down immediately.
https://tools.ietf.org/html/draft-thomson-hybi-http-timeout-03
Test servers: http://tools.ietf.org/ http://nginx.org/
A host sets the value of the "timeout" parameter to the time that the host will allow an idle connection to remain open before it is closed. A connection is idle if no data is sent or received by a host.
The "max" parameter has been used to indicate the maximum number of requests that would be made on the connection.This parameter is deprecated.Any limit on requests can be enforced by sending "Connection: close" and closing the connection.
Static helper class to handle cases where the plugin has to do additional logic based on the received response. These are like connection management, handling redirections, loading from local cache, authentication challanges, etc.
Called when the whole response received
An HTTP 1.1 response implementation that can utilize a peekable stream.
Its main entry point is the ProcessPeekable method that should be called after every chunk of data downloaded.
Possible states of a Http Connection.
The ideal lifecycle of a connection that has KeepAlive is the following: Initial => [Processing => WaitForRecycle => Free] => Closed.
This Connection instance is just created.
This Connection is processing a request
Wait for the upgraded protocol to shut down.
The Connection is finished processing the request, it's waiting now to deliver it's result.
The request result's delivered, it's now up to processing again.
If it's not a KeepAlive connection, or something happened, then we close this connection and remove from the pool.
Same as the Closed state, but processing this request requires resending the last processed request too.
Defines an interface for notifying connections when space becomes available in a buffer for downloading data.
Connections implementating of this interface are used to signal their internal logic that they can transfer data into the available buffer space.
Notifies a connection that space has become available in the buffer for downloading data.
When invoked, this method indicates to a connection that it can transfer additional data into the buffer for further processing.
The instance associated with the buffer.
Interface for signaling upload threads.
A instance for debugging purposes.
To help implementors log in the IThreadSignaler's context,
the interface implementors must make their logging context accessible.
Signals the associated thread to resume or wake up.
Is an unsigned long representing the number of milliseconds a request can take before automatically being terminated. A value of 0 (which is the default) means there is no timeout.
Moves any added asterisk(*) to the end of the list.
Settings for HTTP requests.
The timeout for establishing a connection.
The maximum time allowed for the request to complete.
Settings for HTTP/1 connections.
Indicates whether the connection should be open after receiving the response.
If set to true, internal TCP connections will be reused whenever possible.
If making rare requests to the server, it's recommended to change this to false.
The maximum time a connection can remain idle before being closed.
Indicates whether the upload thread should use a ThreadPool thread instead of creating and using a Thread.
The plugin tries to use ThreadPool threads for known short-living uploads like requests without upload body. With ForceUseThreadPool all HTTP/1 requests, including long uploads or downloads can be forced to use ThreadPool threads.
Settings for s.
The maximum number of connections allowed per host variant.
Factor used when calculations are made whether to open a new connection to the server or not.
It has an effect on HTTP/2 connections only.
Higher values (gte 1.0f) delay, lower values (lte 1.0f) bring forward creation of new connections.
Factory function to generate HostVariant or descendent instances.
Factory function to generate custom connection implementations.
Represents the low-level TCP buffer settings for connections.
Gets or sets the size of the TCP write buffer in bytes.
Default value is 1 MiB.
This determines the maximum amount of data that that the class can buffer up if it's already in a write operation.
Increasing this value can potentially improve write performance, especially for large messages or data streams.
However, setting it too high might consume a significant amount of memory, especially if there are many active connections.
The size of the TCP write buffer in bytes.
Gets or sets the size of the read buffer in bytes.
The size of the read buffer in bytes.
Default value is 1 MiB.
This determines the maximum amount of data that low level streams and the can buffer up for consuming by higher level layers.
Adjusting this value can affect the read performance of the application.
Like the write buffer, setting this too high might be memory-intensive, especially with many connections.
It's advised to find a balance that suits the application's needs and resources.
Contains settings that can be associated with a specific host or host variant.
Gets or sets the low-level TCP buffer settings for connections associated with the host or host variant.
The low-level TCP buffer settings.
These settings determine the buffer sizes for reading from and writing to TCP connections,
which can impact performance and memory usage.
Settings related to HTTP requests made to this host or host variant.
Settings related to HTTP/1.x connection behavior.
Settings related to behavior.
Host Settings Hierarchy for the following hosts, settings are stored as leafs:
*.com
*.example.com
example.com
'*' matches one or more subdomains so *.example.com
- matches a.example.com and a.b.example.com
- but doesn't match example.com!
[com] [localhost] [org] [*]
+------+------+ | | |
| | [setting] [*] [setting]
[example] [*] |
/ \ | [setting]
[b] [setting] [setting]
|
[a]
|
[setting]
Manages host-specific settings for HTTP requests based on hostnames.
The HostSettingsManager is a powerful tool for fine-tuning HTTP request and connection behaviors
on a per-host basis. It enables you to define custom settings for specific hostnames
while maintaining default settings for all other hosts. This level of granularity allows you to
optimize and customize HTTP requests for different endpoints within your application.
When host-specific settings are not found for a given host variant, the default
associated with the "*" host will be returned.
Initializes a new instance of the class with default settings for all hosts ("*").
Adds default settings for the host part of the specified URI. This is equivalent to calling with the a new .
The URI for which default settings should be applied. Only the host part of the URI will be used.
A instance with default values.
Adds default settings for the the specified host name. This is equivalent to calling with the a new .
The hostname for which default settings should be applied.
A instance with default values.
Adds host-specific settings for the host part of the specified URI.
The URI for which settings should be applied. Only the host part of the URI will be used.
The to apply.
Adds host-specific settings for the specified hostname.
The hostname for which settings should be applied.
The to apply.
Thrown when either the hostname or settings is null.
Thrown when the hostname contains more than one asterisk ('*').
Gets for the host part of the specified . Returns the default settings associated with "*" when not found.
The for which settings should be retrieved. Only the host part of the variant will be used.
The host settings for the specified host variant or the default settings for "*" if not found.
Gets for the host part of the specified . Returns the default settings associated with "*" when not found.
The for which settings should be retrieved. Only the host part of the host key will be used.
The host settings for the specified host key or the default settings for "*" if not found.
Gets for the host part of the specified . Returns the default settings associated with "*" when not found.
The for which settings should be retrieved. Only the host part of the URI will be used.
The host settings for the specified URI or the default settings for "*" if not found.
Gets for the host part of the specified hostname. Returns the default settings associated with "*" when not found.
The hostname for which settings should be retrieved. Only the host part of the hostname will be used.
The host settings for the specified hostname or the default settings for "*" if not found.
Thrown when the hostname is null.
Clears all host-specific settings and resetting the default ("*") with default values.
The struct represents a unique key for identifying hosts based on their and .
The struct is designed to uniquely identify a host based on its URI (Uniform Resource Identifier) and optional proxy settings.
It provides a way to create, compare, and hash host keys, enabling efficient host variant management in the .
Key features of the struct include:
-
Uniqueness
Each is guaranteed to be unique for a specific host, considering both the URI and proxy settings.
-
Hashing
The struct provides a method to calculate a hash code for a , making it suitable for use as a dictionary key.
-
Creation
You can create a instance from a and optional .
Usage of the struct is typically handled internally by the BestHTTP library to manage unique hosts and optimize resource usage.
Developers can use it when dealing with host-specific operations or customization of the library's behavior.
Gets the URI (Uniform Resource Identifier) associated with the host.
Gets the proxy settings associated with the host.
Gets the unique hash key for the host.
Gets the host name from the URI or "file" if the URI is a file URI.
Initializes a new instance of the struct with the specified URI and proxy settings.
The URI of the host.
The proxy settings associated with the host, or null if no proxy is used.
Creates a instance from an HTTP request.
The HTTP request from which to extract the current URI and proxy settings.
A representing the host of the HTTP request.
Creates a instance from a URI and proxy settings.
The URI of the host.
The proxy settings associated with the host, or null if no proxy is used.
A representing the host with the given URI and proxy settings.
The class provides centralized management for objects associated with HTTP requests and connections.
The class acts as a central registry for managing objects, each associated with a unique .
It facilitates the creation, retrieval, and management of instances based on HTTP requests and connections.
A represents a specific host and port combination (e.g., "http://example.com:80" or "https://example.com:443") and
manages the connections and request queues for that host. The class ensures that a single instance is used for
each unique host, helping optimize resource usage and connection pooling.
Key features of the class include:
-
Creation and Retrieval
The class allows you to create and retrieve instances based on HTTP requests, connections, or .
It ensures that a single is used for each unique host.
-
Queue Management
The manages the queue of pending requests for each , ensuring efficient request processing.
-
Connection Management
The class handles the management of connections associated with objects, including recycling idle connections,
removing idle connections, and shutting down connections when needed.
Usage of the class is typically transparent to developers and is handled internally by the Best HTTP library. However,
it provides a convenient and efficient way to manage connections and requests when needed.
Dictionary to store - mappings.
Gets the associated with an HTTP request.
The HTTP request.
The for the request's host.
Gets the associated with a connection.
The HTTP connection.
The for the connection's host.
Gets the associated with a HostKey.
The HostKey for which to get the HostVariant.
The for the specified HostKey.
Removes all idle connections for all hosts.
Tries to send queued requests for all hosts.
Shuts down all connections for all hosts.
Clears all hosts and their associated variants.
An enumeration representing the protocol support for a host.
Protocol support is unknown or undetermined.
The host supports HTTP/1.
The host supports HTTP/2.
This is a file-based host.
The HostVariant class is a critical component in managing HTTP connections and handling HTTP requests for a specific host. It maintains a queue of requests and a list of active connections associated with the host, ensuring efficient utilization of available resources. Additionally, it supports protocol version detection (HTTP/1 or HTTP/2) for optimized communication with the host.
- It maintains a queue of requests to ensure efficient and controlled use of available connections.
- It supports HTTP/1 and HTTP/2 protocol versions, allowing requests to be sent using the appropriate protocol based on the host's protocol support.
- Provides methods for sending requests, recycling connections, managing connection state, and handling the shutdown of connections and the host variant itself.
- It includes logging for diagnostic purposes, helping to monitor and debug the behavior of connections and requests.
In summary, the HostVariant class plays a central role in managing HTTP connections and requests for a specific host, ensuring efficient and reliable communication with that host while supporting different protocol versions.
Represents the HTTP methods used in HTTP requests.
The GET method means retrieve whatever information (in the form of an entity) is identified by the Request-URI.
If the Request-URI refers to a data-producing process, it is the produced data which shall be returned as the
entity in the response and not the source text of the process, unless that text happens to be the output of the process.
The HEAD method is identical to GET except that the server MUST NOT return a message-body in the response.
The metainformation contained in the HTTP headers in response to a HEAD request SHOULD be identical to the information sent in response to a GET request.
This method can be used for obtaining metainformation about the entity implied by the request without transferring the entity-body itself.
This method is often used for testing hypertext links for validity, accessibility, and recent modification.
The POST method is used to request that the origin server accept the entity enclosed in the request as a new subordinate of the resource identified by the Request-URI in the Request-Line.
POST is designed to allow a uniform method to cover the following functions:
- Annotation of existing resources;
- Posting a message to a bulletin board, newsgroup, mailing list, or similar group of articles;
- Providing a block of data, such as the result of submitting a form, to a data-handling process;
- Extending a database through an append operation.
The actual function performed by the POST method is determined by the server and is usually dependent on the Request-URI.
The posted entity is subordinate to that URI in the same way that a file is subordinate to a directory containing it,
a news article is subordinate to a newsgroup to which it is posted, or a record is subordinate to a database.
The action performed by the POST method might not result in a resource that can be identified by a URI. In this case,
either 200 (OK) or 204 (No Content) is the appropriate response status, depending on whether or not the response includes an entity that describes the result.
The PUT method requests that the enclosed entity be stored under the supplied Request-URI.
If the Request-URI refers to an already existing resource, the enclosed entity SHOULD be considered as a modified version of the one residing on the origin server.
If the Request-URI does not point to an existing resource, and that URI is capable of being defined as a new resource by the requesting user agent,
the origin server can create the resource with that URI. If a new resource is created, the origin server MUST inform the user agent via the 201 (Created) response.
If an existing resource is modified, either the 200 (OK) or 204 (No Content) response codes SHOULD be sent to indicate successful completion of the request.
If the resource could not be created or modified with the Request-URI, an appropriate error response SHOULD be given that reflects the nature of the problem.
The recipient of the entity MUST NOT ignore any Content-* (e.g. Content-Range) headers that it does not understand or implement and MUST return a 501 (Not Implemented) response in such cases.
The DELETE method requests that the origin server delete the resource identified by the Request-URI. This method MAY be overridden by human intervention (or other means) on the origin server.
The client cannot be guaranteed that the operation has been carried out, even if the status code returned from the origin server indicates that the action has been completed successfully.
However, the server SHOULD NOT indicate success unless, at the time the response is given, it intends to delete the resource or move it to an inaccessible location.
A successful response SHOULD be 200 (OK) if the response includes an entity describing the status, 202 (Accepted) if the action has not yet been enacted, or 204 (No Content)
if the action has been enacted but the response does not include an entity.
The PATCH method requests that a set of changes described in the request entity be applied to the resource identified by the Request-URI.
The set of changes is represented in a format called a "patchdocument" identified by a media type. If the Request-URI does not point to an existing resource,
the server MAY create a new resource, depending on the patch document type (whether it can logically modify a null resource) and permissions, etc.
More details can be found here:
- RFC-5789
- When should we use the PATCH HTTP method?
The HTTP TRACE method is used to perform a message loop-back test along the path to the target resource.
The HTTP MERGE method is used to apply modifications to an existing resource.
The MERGE HTTP method is not as commonly used as other methods like GET, POST, or PUT.
It's often used in specific WebDAV (Web Distributed Authoring and Versioning) scenarios.
The HTTP OPTIONS method requests permitted communication options for a given URL or server.
A client can specify a URL with this method, or an asterisk (*) to refer to the entire server.
More details can be found here:
- Mozilla Developer Networks - OPTIONS
The CONNECT method is primarily used in the context of HTTP proxies to establish a network connection through the proxy to a target host.
It is used in the context of the HTTP CONNECT tunneling method.
More details can be found here:
- RFC-2616
- RFC-8441
The HTTP QUERY method is used to retrieve data based on a query parameter or search criteria.
The QUERY method is not a standard HTTP method, and its usage may vary depending on the specific application or API you are working with.
It might be used for querying data or resources with specific parameters.
Details about the QUERY method would depend on the API or service you are interacting with.
You should refer to the documentation or specifications provided by the API/service provider.
More details can be found here:
- HTTP's New Method For Data APIs: HTTP QUERY
- The HTTP QUERY Method (Draft)
Represents an HTTP range that specifies the byte range of a response content, received as an answer for a range-request.
Gets the position of the first byte in the range that the server sent.
Gets the position of the last byte in the range that the server sent.
Gets the total length of the full entity-body on the server. Returns -1 if this length is unknown or difficult to determine.
Gets a value indicating whether the HTTP range is valid.
Delegate for a callback function that is called after the request is fully processed.
Delegate for enumerating headers during request preparation.
The header name.
A list of header values.
Represents an HTTP request that allows you to send HTTP requests to remote servers and receive responses asynchronously.
- Asynchronous HTTP requestsUtilize a Task-based API for performing HTTP requests asynchronously.
- Unity coroutine supportSeamlessly integrate with Unity's coroutine system for coroutine-based request handling.
- HTTP method supportSupport for various HTTP methods including GET, POST, PUT, DELETE, and more.
- Compression and decompressionAutomatic request and response compression and decompression for efficient data transfer.
- Timing informationCollect detailed timing information about the request for performance analysis.
- Upload and download supportSupport for uploading and downloading files with progress tracking.
- CustomizableExtensive options for customizing request headers, handling cookies, and more.
- Redirection handlingAutomatic handling of request redirections for a seamless experience.
- Proxy server supportAbility to route requests through proxy servers for enhanced privacy and security.
- AuthenticationAutomatic authentication handling using authenticators for secure communication.
- Cancellation supportAbility to cancel requests to prevent further processing and release resources.
Creates an HTTP GET request with the specified URL.
The URL of the request.
An HTTPRequest instance for the GET request.
Creates an HTTP GET request with the specified URI.
The URI of the request.
An HTTPRequest instance for the GET request.
Creates an HTTP GET request with the specified URL and registers a callback function to be called
when the request is fully processed.
The URL of the request.
A callback function to be called when the request is finished.
An HTTPRequest instance for the GET request.
Creates an HTTP GET request with the specified URI and registers a callback function to be called
when the request is fully processed.
The URI of the request.
A callback function to be called when the request is finished.
An HTTPRequest instance for the GET request.
Creates an HTTP POST request with the specified URL.
The URL of the request.
An HTTPRequest instance for the POST request.
Creates an HTTP POST request with the specified URI.
The URI of the request.
An HTTPRequest instance for the POST request.
Creates an HTTP POST request with the specified URL and registers a callback function to be called
when the request is fully processed.
The URL of the request.
A callback function to be called when the request is finished.
An HTTPRequest instance for the POST request.
Creates an HTTP POST request with the specified URI and registers a callback function to be called
when the request is fully processed.
The URI of the request.
A callback function to be called when the request is finished.
An HTTPRequest instance for the POST request.
Creates an HTTP PUT request with the specified URL.
The URL of the request.
An HTTPRequest instance for the PUT request.
Creates an HTTP PUT request with the specified URI.
The URI of the request.
An HTTPRequest instance for the PUT request.
Creates an HTTP PUT request with the specified URL and registers a callback function to be called
when the request is fully processed.
The URL of the request.
A callback function to be called when the request is finished.
An HTTPRequest instance for the PUT request.
Creates an HTTP PUT request with the specified URI and registers a callback function to be called
when the request is fully processed.
The URI of the request.
A callback function to be called when the request is finished.
An HTTPRequest instance for the PUT request.
Cached uppercase values to save some cpu cycles and GC alloc per request.
The method that how we want to process our request the server.
The original request's Uri.
If redirected it contains the RedirectUri.
A host-key that can be used to find the right host-variant for the request.
The response received from the server.
If an exception occurred during reading of the response stream or can't connect to the server, this will be null!
Download related options and settings.
Upload related options and settings.
Timeout settings for the request.
Retry settings for the request.
Proxy settings for the request.
Redirect settings for the request.
The callback function that will be called after the request is fully processed.
Indicates if is called on this request.
Gets the cancellation token source for this request.
Action called when function is invoked.
Stores any exception that occurs during processing of the request or response.
This property if for debugging purposes as seen here!
Any user-object that can be passed with the request.
Current state of this request.
Timing information about the request.
An IAuthenticator implementation that can be used to authenticate the request.
Out-of-the-box included authenticators are and .
Its value will be set to the XmlHTTPRequest's withCredentials field, required to send 3rd party cookies with the request.
More details can be found here:
- Mozilla Developer Networks - XMLHttpRequest.withCredentials
Logging context of the request.
Creates an HTTP GET request with the specified URL.
The URL of the request.
Creates an HTTP GET request with the specified URL and registers a callback function to be called
when the request is fully processed.
The URL of the request.
A callback function to be called when the request is finished.
Creates an HTTP GET request with the specified URL and HTTP method type.
The URL of the request.
The HTTP method type for the request (e.g., GET, POST, PUT).
Creates an HTTP request with the specified URL, HTTP method type, and registers a callback function to be called
when the request is fully processed.
The URL of the request.
The HTTP method type for the request (e.g., GET, POST, PUT).
A callback function to be called when the request is finished.
Creates an HTTP GET request with the specified URI.
The URI of the request.
Creates an HTTP GET request with the specified URI and registers a callback function to be called
when the request is fully processed.
The URI of the request.
A callback function to be called when the request is finished.
Creates an HTTP request with the specified URI and HTTP method type.
The URI of the request.
The HTTP method type for the request (e.g., GET, POST, PUT).
Creates an HTTP request with the specified URI, HTTP method type, and registers a callback function
to be called when the request is fully processed.
The URI of the request.
The HTTP method type for the request (e.g., GET, POST, PUT).
A callback function to be called when the request is finished.
Adds a header-value pair to the Headers. Use it to add custom headers to the request.
AddHeader("User-Agent', "FooBar 1.0")
For the given header name, removes any previously added values and sets the given one.
Removes the specified header and all of its associated values. Returns true, if the header found and succesfully removed.
Returns true if the given head name is already in the .
Returns the first header or null for the given header name.
Returns all header values for the given header or null.
Removes all headers.
Sets the Range header to download the content from the given byte position. See http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35
Start position of the download.
Sets the Range header to download the content from the given byte position to the given last position. See http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35
Start position of the download.
The end position of the download.
Starts processing the request.
Cancels any further processing of the HTTP request.
Resets the request for a state where switching MethodType is possible.
implementation, required for support.
implementation, required for support.
true if the request isn't finished yet.
implementation throwing , required for support.
Disposes of resources used by the HTTPRequest instance.
Represents an exception thrown during or as a result of a Task-based asynchronous HTTP operations.
Gets the status code of the server's response.
Gets the content sent by the server. This is usually an error page for 4xx or 5xx responses.
A collection of extension methods for working with HTTP requests asynchronously using .
Asynchronously sends an HTTP request and retrieves the response as an .
The to send.
A cancellation token that can be used to cancel the operation.
A Task that represents the asynchronous operation. The Task will complete with the retrieved AssetBundle
if the request succeeds. If the request fails or is canceled, the Task will complete with an exception.
Asynchronously sends an HTTP request and retrieves the raw .
This method is particularly useful when you want to access the raw response without any specific processing
like converting the data into a string, texture, or other formats. It provides flexibility in handling
the response for custom or advanced use cases.
The to send.
An optional that can be used to cancel the operation.
A that represents the asynchronous operation. The value of TResult is the raw .
If the request completes successfully, the task will return the HTTPResponse. If there's an error during the request or if
the request gets canceled, the task will throw an exception, which can be caught and processed by the calling method.
Thrown if there's an error in the request or if the server returns an error status code.
Asynchronously sends an and retrieves the response content as a string.
The to send.
A cancellation token that can be used to cancel the operation.
A Task that represents the asynchronous operation. The Task will complete with the retrieved string content
if the request succeeds. If the request fails or is canceled, the Task will complete with an exception.
Asynchronously sends an and retrieves the response content as a .
The to send.
A cancellation token that can be used to cancel the operation.
A Task that represents the asynchronous operation. The Task will complete with the retrieved
if the request succeeds. If the request fails or is canceled, the Task will complete with an exception.
Asynchronously sends an and retrieves the response content as a byte[].
The to send.
A cancellation token that can be used to cancel the operation.
A Task that represents the asynchronous operation. The Task will complete with the retrieved byte[]
if the request succeeds. If the request fails or is canceled, the Task will complete with an exception.
Asynchronously sends an and deserializes the response content into an object of type T using JSON deserialization.
The type to deserialize the JSON content into.
The to send.
A cancellation token that can be used to cancel the operation.
A Task that represents the asynchronous operation. The Task will complete with the deserialized object
if the request succeeds and the response content can be deserialized. If the request fails, is canceled, or
the response cannot be deserialized, the Task will complete with an exception.
Possible logical states of a HTTTPRequest object.
Initial status of a request. No callback will be called with this status.
The request queued for processing.
Processing of the request started. In this state the client will send the request, and parse the response. No callback will be called with this status.
The request finished without problem. Parsing the response done, the result can be used. The user defined callback will be called with a valid response object. The request’s Exception property will be null.
The request finished with an unexpected error. The user defined callback will be called with a null response object. The request's Exception property may contain more info about the error, but it can be null.
The request aborted by the client(HTTPRequest’s Abort() function). The user defined callback will be called with a null response. The request’s Exception property will be null.
Connecting to the server timed out. The user defined callback will be called with a null response. The request’s Exception property will be null.
The request didn't finished in the given time. The user defined callback will be called with a null response. The request’s Exception property will be null.
Represents parameters used when connecting through a proxy server.
The ProxyConnectParameters struct defines the parameters required when initiating a connection
through a proxy server. It includes information about the proxy, target URI, and callbacks for success and error handling.
This struct is commonly used during the negotiation steps in the class.
The maximum number of authentication attempts allowed during proxy connection.
The proxy server through which the connection is established.
The stream used for communication with the proxy server.
The target URI to reach through the proxy server.
A cancellation token that allows canceling the proxy connection operation.
The number of authentication attempts made during proxy connection.
Gets or sets a value indicating whether to create a proxy tunnel.
A proxy tunnel, also known as a TCP tunnel, is established when communication between the client and the target server
needs to be relayed through the proxy without modification. Setting this field to true indicates the intention
to create a tunnel, allowing the data to pass through the proxy without interpretation or alteration by the proxy.
This is typically used for protocols like HTTPS, where end-to-end encryption is desired, and the proxy should act as a
pass-through conduit.
The logging context for debugging purposes.
A callback to be executed upon successful proxy connection.
A callback to be executed upon encountering an error during proxy connection.
The callback includes parameters for the current connection parameters, the encountered exception,
and a flag indicating whether the connection should be retried for authentication.
Base class for proxy implementations, providing common proxy configuration and behavior.
The Proxy class serves as the base class for various proxy client implementations,
such as and . It provides a foundation for configuring proxy settings and handling
proxy-related functionality common to all proxy types, like connecting to a proxy, setting up a request to go through the proxy
and deciding whether an address is usable with the proxy or the plugin must connect directly.
Address of the proxy server. It has to be in the http://proxyaddress:port form.
Credentials for authenticating with the proxy server.
List of exceptions for which the proxy should not be used. Elements of this list are compared to the Host (DNS or IP address) part of the uri.
Initializes a new instance of the Proxy class with the specified proxy address and credentials.
The address of the proxy server.
The credentials for proxy authentication.
Initiates a connection through the proxy server. Used during the negotiation steps.
Parameters for the proxy connection.
Gets the request path to be used for proxy communication. In some cases with HTTPProxy, the request must send the whole uri as the request path.
The target URI.
The request path for proxy communication.
Sets up an HTTP request to use the proxy as needed.
The HTTP request to set up.
true if the request should use the proxy; otherwise, false.
Determines whether the proxy should be used for a specific address based on the configured exceptions.
The address to check for proxy usage.
true if the proxy should be used for the address; otherwise, false.
Authentication types that supported by Best.HTTP.
The authentication is defined by the server, so the Basic and Digest are not interchangeable. If you don't know what to use, the preferred way is to choose Unknow.
If the authentication type is not known this will do a challenge turn to receive what methode should be choosen.
The most basic authentication type. It's easy to do, and easy to crack, don't use it with plain http://
HTTP Digest authentication
Hold all information that required to authenticate to a remote server.
The type of the Authentication. If you don't know what to use, the preferred way is to choose Unknow.
The username to authenticate on the remote server.
The password to use in the authentication process. The password will be stored only in this class.
Set up the authentication credentials with the username and password. The Type will be set to Unknown.
Set up the authentication credentials with the given authentication type, username and password.
Internal class that stores all information that received from a server in a WWW-Authenticate and need to construct a valid Authorization header. Based on rfc 2617 (http://tools.ietf.org/html/rfc2617).
Used only internally by the plugin.
The Uri that this Digest is bound to.
A string to be displayed to users so they know which username and password to use.
This string should contain at least the name of the host performing the authentication and might additionally indicate the collection of users who might have access.
A flag, indicating that the previous request from the client was rejected because the nonce value was stale.
If stale is TRUE (case-insensitive), the client may wish to simply retry the request with a new encrypted response, without the user for a new username and password.
The server should only set stale to TRUE if it receives a request for which the nonce is invalid but with a valid digest for that nonce
(indicating that the client knows the correct username/password).
If stale is FALSE, or anything other than TRUE, or the stale directive is not present, the username and/or password are invalid, and new values must be obtained.
A server-specified data string which should be uniquely generated each time a 401 response is made.
Specifically, since the string is passed in the header lines as a quoted string, the double-quote character is not allowed.
A string of data, specified by the server, which should be returned by the client unchanged in the Authorization header of subsequent requests with URIs in the same protection space.
It is recommended that this string be base64 or data.
A string indicating a pair of algorithms used to produce the digest and a checksum. If this is not present it is assumed to be "MD5".
If the algorithm is not understood, the challenge should be ignored (and a different one used, if there is more than one).
List of URIs, as specified in RFC XURI, that define the protection space.
If a URI is an abs_path, it is relative to the canonical root URL (see section 1.2 above) of the server being accessed.
An absoluteURI in this list may refer to a different server than the one being accessed.
The client can use this list to determine the set of URIs for which the same authentication information may be sent:
any URI that has a URI in this list as a prefix (after both have been made absolute) may be assumed to be in the same protection space.
If this directive is omitted or its value is empty, the client should assume that the protection space consists of all URIs on the responding server.
If present, it is a quoted string of one or more tokens indicating the "quality of protection" values supported by the server.
The value "auth" indicates authentication. The value "auth-int" indicates authentication with integrity protection.
his MUST be specified if a qop directive is sent (see above), and MUST NOT be specified if the server did not send a qop directive in the WWW-Authenticate header field.
The nc-value is the hexadecimal count of the number of requests (including the current request) that the client has sent with the nonce value in this request.
Used to store the last HA1 that can be used in the next header generation when Algorithm is set to "md5-sess".
Parses a WWW-Authenticate header's value to retrive all information.
Generates a string that can be set to an Authorization header.
Stores and manages already received digest infos.
Array of algorithms that the plugin supports. It's in the order of priority(first has the highest priority).
It will retrieve or create a new Digest for the given Uri.
Used for parsing WWW-Authenticate headers:
`Digest realm="my realm", nonce="4664b327a2963503ba58bbe13ad672c0", qop=auth, opaque="f7e38bdc1c66fce214f9019ffe43117c"`
An implementation for Bearer Token authentication.
Bearer Token authentication is a method used to access protected resources on a server.
It involves including a bearer token in the Authorization header of an HTTP request to prove the identity of the requester.
Initializes a new instance of the BearerTokenAuthenticator class with the specified Bearer Token.
The Bearer Token to use for authentication.
Sets up the required Authorization header with the Bearer Token for the HTTP request.
The HTTP request for which the Authorization header should be added.
When sending an HTTP request to a server that requires Bearer Token authentication,
this method sets the Authorization header with the Bearer Token to prove the identity of the requester.
This allows the requester to access protected resources on the server.
Handles the server response with a 401 (Unauthorized) status code and a WWW-Authenticate header.
This authenticator does not handle challenges and always returns false.
The HTTP request that received the 401 response.
The HTTP response containing the 401 (Unauthorized) status.
false, as this authenticator does not handle challenges.
Bearer Token authentication typically does not require handling challenges,
as the Bearer Token is included directly in the Authorization header of the request.
This method always returns false, as no additional challenge processing is needed.
An implementation for HTTP Basic or Digest authentication.
Gets or sets the associated with this authenticator.
Initializes a new instance of the CrendetialAuthenticator class with the specified .
The to use for authentication.
Thrown if is null.
Sets up the required headers for the HTTP request based on the provided credentials.
The HTTP request for which headers should be added.
Handles the server response with a 401 (Unauthorized) status code and a WWW-Authenticate header.
The authenticator might determine the authentication method to use and initiate authentication if needed.
The HTTP request that received the 401 response.
The HTTP response containing the 401 (Unauthorized) status.
true if the challenge is handled by the authenticator and the request can be resent with authentication; otherwise, false.
Represents an interface for various authentication implementations used in HTTP requests.
Set required headers or content for the HTTP request. Called right before the request is sent out.
The SetupRequest method will be called every time the request is redirected or retried.
The HTTP request to which headers or content will be added.
Called when the server is sending a 401 (Unauthorized) response with an WWW-Authenticate header.
The authenticator might find additional knowledge about the authentication requirements (like what auth method it should use).
If the authenticator is confident it can successfully (re)authenticate the request it can return true and the request will be resent to the server.
More details can be found here:
- RFC-9110 - 401 Unauthorized
- RFC-9110 - WWW-Authenticate header
The HTTP request that received the 401 response.
The HTTP response containing the 401 (Unauthorized) status.
true if the challange is handled by the authenticator and the request can be re-sent with authentication.
Delegate for handling the event when headers are received in a response.
The object.
The object.
The headers received from the server.
Delegate for handling progress during the download.
The object.
The number of bytes downloaded so far.
The total length of the content being downloaded, or -1 if the length cannot be determined.
Delegate for handling the event when the download of content starts.
The object.
The object.
The used for receiving downloaded content.
Delegate for creating a new object.
The object.
The object.
An interface for notifying connections that the buffer has free space for downloading data.
The newly created .
Represents settings for configuring an HTTP request's download behavior.
Gets or sets the maximum number of bytes the will buffer before pausing the download until its buffer has free space again.
When the download content stream buffers data up to this specified limit, it will temporarily pause downloading until it has free space in its buffer.
Increasing this value may help reduce the frequency of pauses during downloads, but it also increases memory usage.
Gets or sets a value indicating whether caching should be enabled for this request.
Gets or sets a value indicating whether the response's should be populated with downloaded data or if the content should be written only to the local cache when available.
If set to true and the content isn't cacheable (e.g., it doesn't have any cache-related headers), the content will be downloaded but will be lost.
Gets or sets a value indicating whether the response's should be populated with downloaded data or if the content should be written only to the local cache when available.
If set to true and the content isn't cacheable (e.g., it doesn't have any cache-related headers), the content will be downloaded but will be lost.
This is because the downloaded data would be written exclusively to the local cache and will not be stored in memory or the response's for further use.
This event is called when the plugin received and parsed all headers.
Represents a function that creates a new object when needed for downloading content.
Event for handling the start of the download process for 2xx status code responses.
The object.
The object representing the response.
The containing the downloaded data. It might already be populated with some content.
This event is called when the plugin expects the server to send content. When called, the
might already be populated with some content. It is specifically meant for responses with 2xx status codes.
Gets or sets the event that is called when new data is downloaded from the server.
The first parameter is the original object itself, the second parameter is the downloaded bytes, and the third parameter is the content length.
There are download modes where we can't figure out the exact length of the final content. In these cases, we guarantee that the third parameter will be at least the size of the second one.
Represents settings related to using a proxy server for HTTP requests.
Checks if there is a proxy configured for the given URI.
The URI to check for proxy usage.
true if a proxy is configured and should be used for the URI; otherwise, false.
Gets or sets the proxy object used for the request.
Sets up the HTTP request for passing through a proxy server.
The HTTP request to set up.
Handles the proxy's response with status code 407.
The HTTP request that received a 407 response.
true to resend the request through the proxy; otherwise, false.
Adds the proxy address to a hash for the given request URI.
The request URI for which the proxy address is added to the hash.
The hash to which the proxy address is added.
Represents settings related to handling HTTP request redirection.
Indicates whether the request has been redirected.
A request's IsRedirected might be true while is zero if the redirection is made to the local cache.
The Uri that the request is redirected to.
How many redirection is supported for this request. The default is 10. Zero or a negative value means no redirections are supported.
Gets or sets the maximum number of redirections supported for this request. The default is 10.
A value of zero or a negative value means no redirections are supported.
Gets the number of times the request has been redirected.
Occurs before the plugin makes a new request to the new URI during redirection.
The return value of this event handler controls whether the redirection is aborted (false) or allowed (true).
This event is called on a thread other than the main Unity thread.
Initializes a new instance of the RedirectSettings class with the specified maximum redirections.
The maximum number of redirections allowed.
Resets and to their default values.
Represents settings related to request retry behavior.
Gets the number of times that the plugin has retried the request.
Gets or sets the maximum number of retry attempts allowed. To disable retries, set this value to 0.
The default value is 1 for GET requests, otherwise 0.
Initializes a new instance of the RetrySettings class with the specified maximum retry attempts.
The maximum number of retry attempts allowed.
Represents settings related to connection-timeouts and processing duration.
Gets the timestamp when the request was queued for processing.
Gets the timestamp when the processing of the request started by a connection.
Gets or sets the maximum time to wait for establishing the connection to the target server.
If set to TimeSpan.Zero or lower, no connect timeout logic is executed. Default value is 20 seconds.
Gets or sets the maximum time to wait for the request to finish after the connection is established.
Returns true if the request has been stuck in the connection phase for too long.
The current timestamp.
true if the connection has timed out; otherwise, false.
Returns true if the time has passed the specified Timeout setting since processing started or if the connection has timed out.
The current timestamp.
true if the request has timed out; otherwise, false.
Initializes a new instance of the TimeoutSettings class for a specific .
The associated with these timeout settings.
Options for sending the request headers and content, including upload progress monitoring.
might be called when redirected or retried!
Size of the internal buffer, and upload progress will be fired when this size of data sent to the wire. Its default value is 4 KiB.
The stream that the plugin will use to send data to the server.
The stream can be any regular implementation or a specialized one inheriting from :
- A specialized for data generated on-the-fly or periodically. The request remains active until the method is invoked, ensuring continuous data feed even during temporary empty states.
- An implementation to convert and upload the object as JSON data. It sets the "Content-Type" header to "application/json; charset=utf-8".
- An implementation representing a stream that prepares and sends data as URL-encoded form data in an HTTP request.
- An based implementation of the multipart/form-data Content-Type. It's very memory-effective, streams are read into memory in chunks.
Set to false if the plugin MUST NOT dispose after the request is finished.
Called periodically when data sent to the server.
This event is fired after the headers are sent to the server.
Called every time the request is sent out (redirected or retried).
The being prepared.
true if the can be fired.
Dispose of resources used by the UploadSettings instance.
Helper class to store, calculate and manage request related events and theirs duration, referenced by field.
When the TimingCollector instance created.
When the closing Finish event is sent.
List of added events.
Finish the last event.
Abort the currently running event.
When the event happened and for how long.
Struct to hold information about one timing event recorded for a . Timing events are managed by the .
Name of the event
Duration of the event.
When the event occurred.
Provides constants representing different, special body lengths for HTTP requests with upload streams.
The 's length is unknown and the plugin have to send data with 'chunked' transfer-encoding.
The 's length is unknown and the plugin have to send data as-is, without any encoding.
No content to send.
A specialized upload stream designed to handle data that's generated on-the-fly or periodically.
This implementation is designed to handle scenarios where data may not always be immediately available for upload.
The request will remain active until the method is invoked, ensuring that data can continue to be fed into the stream even if it's temporarily empty during a Read operation.
Gets the length of the upload stream.
This implementation returns a constant value of -1, indicating that the length of the data to be uploaded is unknown. When the processing connection encounters this value, it should utilize chunked uploading to handle the data transfer.
The constant value of -1, representing unknown length.
Gets the length of data currently buffered and ready for upload.
The length of buffered data in bytes.
Initializes a new instance of the DynamicUploadStream class with an optional content type.
The MIME type of the content to be uploaded. Defaults to "application/octet-stream" if not specified.
This constructor allows the caller to specify the content type of the data to be uploaded. If not provided, it defaults to a general binary data type.
Sets the necessary headers before sending the request.
Prepares the stream before the request body is sent.
Reads data from the stream to be uploaded.
The returned value indicates the state of the stream:
- -1More data is expected in the future, but isn't currently available. When new data is ready, the IThreadSignaler must be notified.
- 0The stream has been closed and no more data will be provided.
- Otherwise it returns with the number bytes copied to the buffer.
Note: A zero return value can come after a -1 return, indicating a transition from waiting to completion.
Writes data to the stream, making it available for upload.
After writing data to the stream using this method, the connection is signaled that data is available to send.
The array of unsigned bytes from which to copy count bytes to the current stream.
The zero-based byte offset in buffer at which to begin copying bytes to the current stream.
The number of bytes to be written to the current stream.
Thrown when trying to write after the stream has been marked as complete.
Writes a segment of data to the stream, making it available for upload.
A segment of data to be written to the stream.
Thrown when trying to write after the stream has been marked as complete.
After writing a segment to the stream using this method, the connection is signaled that data is available to send.
Marks the stream as complete, signaling that no more data will be added.
All remaining buffered data will be sent to the server.
An based implementation of the multipart/form-data Content-Type. It's very memory-effective, streams are read into memory in chunks.
The return value of is treated specially in the plugin:
-
Less than zero(-1) value
indicates that no data is currently available but more is expected in the future. In this case, when new data becomes available the IThreadSignaler object must be signaled.
-
Zero (0)
means that the stream is closed, no more data can be expected.
A zero value to signal stream closure can follow a less than zero value.
Gets the length of this multipart/form-data stream.
A random boundary generated in the constructor.
Initializes a new instance of the MultipartFormDataStream class.
Initializes a new instance of the MultipartFormDataStream class with a custom boundary.
Adds a textual field to the multipart/form-data stream.
The name of the field.
The textual value of the field.
The MultipartFormDataStream instance for method chaining.
Adds a textual field to the multipart/form-data stream.
The name of the field.
The textual value of the field.
The encoding to use for the value.
The MultipartFormDataStream instance for method chaining.
Adds a stream field to the multipart/form-data stream.
The name of the field.
The data containing the field data.
The MultipartFormDataStream instance for method chaining.
Adds a stream field to the multipart/form-data stream.
The stream containing the field data.
The name of the field.
The MultipartFormDataStream instance for method chaining.
Adds a stream field to the multipart/form-data stream.
The stream containing the field data.
The name of the field.
The name of the file, if applicable.
The MultipartFormDataStream instance for method chaining.
Adds a stream field to the multipart/form-data stream.
The stream containing the field data.
The name of the field.
The name of the file, if applicable.
The MIME type of the content.
The MultipartFormDataStream instance for method chaining.
Adds the final boundary to the multipart/form-data stream before sending the request body.
The HTTP request.
The thread signaler for handling asynchronous operations.
Reads data from the multipart/form-data stream into the provided buffer.
The buffer to read data into.
The starting offset in the buffer.
The maximum number of bytes to read.
The number of bytes read into the buffer.
Readonly struct to hold key -> value pairs, where the value is either textual or binary.
An implementation representing a stream that prepares and sends data as URL-encoded form data in an HTTP request.
This stream is used to send data as URL-encoded form data in an HTTP request. It sets the "Content-Type" header to "application/x-www-form-urlencoded".
URL-encoded form data is typically used for submitting form data to a web server. It is commonly used in HTTP POST requests to send data to a server, such as submitting HTML form data.
The return value of is treated specially in the plugin:
-
Less than zero(-1) value
indicates that no data is currently available but more is expected in the future. In this case, when new data becomes available the IThreadSignaler object must be signaled.
-
Zero (0)
means that the stream is closed, no more data can be expected.
A zero value to signal stream closure can follow a less than zero value.
While it's possible, it's not advised to send binary data url-encoded!
Gets the length of the stream.
A list that holds the form's fields.
Sets up the HTTP request by adding the "Content-Type" header as "application/x-www-form-urlencoded".
The HTTP request.
Adds binary data to the form. It is not advised to send binary data with an URL-encoded form due to the conversion cost of binary to text conversion.
The name of the field.
The binary data content.
The UrlEncodedStream instance for method chaining.
An implementation to convert and upload the object as JSON data. It sets the "Content-Type" header to "application/json; charset=utf-8".
The type of the object to be converted to JSON.
This stream keeps a reference to the object until the preparation in . This means, changes to the object after passing it to the constructor will be reflected in the sent data too.
The return value of is treated specially in the plugin:
-
Less than zero(-1) value
indicates that no data is currently available but more is expected in the future. In this case, when new data becomes available the IThreadSignaler object must be signaled.
-
Zero (0)
means that the stream is closed, no more data can be expected.
A zero value to signal stream closure can follow a less than zero value.
Initializes a new instance of the class with the specified object.
The object to be converted to JSON and uploaded.
Called before sending out the request's headers. It sets the "Content-Type" header to "application/json; charset=utf-8".
The HTTP request.
Reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.
An array of bytes. When this method returns, the buffer contains the specified byte array with the values between and ( + - 1) replaced by the bytes read from the current source.
The zero-based byte offset in at which to begin storing the data read from the current stream.
The maximum number of bytes to be read from the current stream.
The total number of bytes read into the buffer. This can be less than the number of bytes requested if that many bytes are not currently available, or zero (0) if the end of the stream has been reached.
Releases the unmanaged resources used by the and optionally releases the managed resources.
true to release both managed and unmanaged resources; false to release only unmanaged resources.
Abstract class to serve as a base for non-conventional streams used in HTTP requests.
The return value of is treated specially in the plugin:
-
Less than zero(-1)
indicates that no data is currently available but more is expected in the future. In this case, when new data becomes available the IThreadSignaler object must be signaled.
-
Zero (0)
means that the stream is closed, no more data can be expected.
- Otherwise it must return with the number bytes copied to the buffer.
A zero value to signal stream closure can follow a less than zero value.
Gets the object for signaling when new data is available.
Length in bytes that the stream will upload.
The return value of Length is treated specially in the plugin:
- -2The stream's length is unknown and the plugin have to send data with 'chunked' transfer-encoding.
- -1The stream's length is unknown and the plugin have to send data as-is, without any encoding.
- 0No content to send. The content-length header will contain zero (0).
- >0Length of the content is known, will be sent as-is, without any encoding. The content-length header will contain zero (0).
Constants for the first three points can be found in .
Called before sending out the request's headers. Perform content processing to calculate the final length if possible.
In this function the implementor can set headers and other parameters to the request.
Typically called on a thread.
The associated with the stream.
Called just before sending out the request's body, and saves the for signaling when new data is available.
The HTTPRequest associated with the stream.
The object to be used for signaling.
Typically called on a separate thread.
Called just before sending out the request's body, saves the that can be used for signaling when new data is available.
The HTTPRequest associated with the stream.
The object to be used for signaling.
Typically called on a separate thread.
A blocking variant of the that allows clients to wait for downloaded data when the buffer is empty but not completed.
The BlockingDownloadContentStream is a specialized variant of the designed to provide a blocking mechanism for clients waiting for downloaded data.
This class is particularly useful when clients need to read from the stream, but the buffer is temporarily empty due to ongoing downloads.
Key Features:
-
Blocking Data Retrieval
Provides a blocking method that allows clients to wait for data if the buffer is empty but not yet completed.
-
Timeout Support
The method accepts a timeout parameter, allowing clients to set a maximum wait time for data availability.
-
Exception Handling
Handles exceptions and errors that occur during download, ensuring that clients receive any relevant exception information.
Clients can use the method to retrieve data from the stream, and if the buffer is empty, the method will block until new data is downloaded or a timeout occurs.
This blocking behavior is particularly useful in scenarios where clients need to consume data sequentially but can't proceed until data is available.
When the download is completed or if an error occurs during download, this stream allows clients to inspect the completion status and any associated exceptions, just like the base .
Initializes a new instance of the class.
The HTTP response associated with this download stream.
The maximum size of the internal buffer.
Handler for notifying when buffer space becomes available.
Attempts to retrieve a downloaded content-segment from the stream, blocking if necessary until a segment is available.
When this method returns, contains the instance representing the data, if available; otherwise, contains the value of . This parameter is passed uninitialized.
true if a segment could be retrieved; otherwise, false.
The TryTake function provides a blocking approach to retrieve data from the stream.
If the stream has data available, it immediately returns the data.
If there's no data available, the method will block until new data is downloaded or the buffer is marked as completed.
This method is designed for scenarios where clients need to read from the stream sequentially and are willing to wait until data is available.
It ensures that clients receive data as soon as it becomes available, without having to repeatedly check or poll the stream.
Returns with a download content-segment. If the stream is currently empty but not completed the execution is blocked until new data downloaded.
A segment is an arbitrary length array of bytes the plugin could read in one operation, it can range from couple of bytes to kilobytes.
A BufferSegment holding a reference to the byte[] containing the downloaded data, offset and count of bytes in the array.
The stream is disposed.
The stream is empty and marked as completed.
Returns with a download content-segment. If the stream is currently empty but not completed the execution is blocked until new data downloaded or the timeout is reached.
A segment is an arbitrary length array of bytes the plugin could read in one operation, it can range from couple of bytes to kilobytes.
A TimeSpan that represents the number of milliseconds to wait, or a TimeSpan that represents -1 milliseconds to wait indefinitely.
A BufferSegment holding a reference to the byte[] containing the downloaded data, offset and count of bytes in the array. In case of a timeout, BufferSegment.Empty returned.
The stream is disposed.
The stream is empty and marked as completed.
Reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.
This override of the method provides blocking behavior, meaning if there are no bytes available in the stream, the method will block until new data is downloaded or until the stream completes. Once data is available, or if the stream completes, the method will return with the number of bytes read.
This behavior ensures that consumers of the stream can continue reading data sequentially, even if the stream's internal buffer is temporarily empty due to ongoing downloads.
An array of bytes. When this method returns, the buffer contains the specified byte array with the values between and ( + - 1) replaced by the bytes read from the current source.
The zero-based byte offset in at which to begin storing the data read from the current stream.
The maximum number of bytes to be read from the current stream.
The total number of bytes read into the buffer. This can be less than the number of bytes requested if that many bytes are not currently available, or zero if the end of the stream is reached.
Instead of calling WaitOne once for the total duration of the timeout,
periodically check whether we are disposed or not.
A read-only stream that the plugin uses to store the downloaded content. This stream is designed to buffer downloaded data efficiently and provide it to consumers.
The DownloadContentStream serves as a storage medium for content downloaded during HTTP requests.
It buffers the downloaded data in segments and allows clients to read from the buffer as needed.
This buffering mechanism is essential for optimizing download performance, especially in scenarios where the download rate may vary or be faster than the rate at which data is consumed.
The stream operates in conjunction with the interface, which is used to signal connections when buffer space becomes available.
Connections can then transfer additional data into the buffer for processing.
-
Efficient Buffering
The stream efficiently buffers downloaded content, ensuring that data is readily available for reading without extensive delays.
-
Dynamic Resizing
The internal buffer dynamically resizes to accommodate varying amounts of downloaded data, optimizing memory usage.
-
Asynchronous Signal Handling
Asynchronous signaling mechanisms are used to notify connections when buffer space is available, enabling efficient data transfer.
-
Error Handling
The stream captures and propagates errors that occur during download, allowing clients to handle exceptions gracefully.
-
Blocking Variant
A blocking variant, , allows clients to wait for data when the buffer is empty but not completed.
Clients can read from this stream using standard stream reading methods, and the stream will release memory segments as data is read.
When the download is completed or if an error occurs during download, this stream allows clients to inspect the completion status and any associated exceptions.
Gets the HTTP response from which this download stream originated.
Gets a value indicating whether the download is completed, and there's no more data buffered in the stream to read.
Gets a reference to an exception if the download completed with an error.
Gets the length of the buffered data. Because downloads happen in parallel, a call can return with more data after checking Length.
Gets the maximum size of the internal buffer of this stream.
In some cases, the plugin may put more data into the stream than the specified size.
Gets a value indicating whether the internal buffer holds at least the amount of data.
Gets or sets whether the stream is detached from the / when is used before the request is finished.
When the stream is detached from the response object, their lifetimes are not bound together,
meaning that the stream isn't disposed automatically, and the client code is responsible for calling the stream's function.
There are cases where the plugin have to put more data into the buffer than its previously set maximum.
For example when the underlying connection is closed, but the content provider still have buffered data,
in witch case we have to push all processed data to the user facing download stream.
Count of consecutive calls with DoFullCheck that found the stream fully buffered.
Initializes a new instance of the DownloadContentStream class.
The HTTP response associated with this download stream.
The maximum size of the internal buffer.
Handler for notifying when buffer space becomes available.
Completes the download stream with an optional error. Called when the download is finished.
The exception that occurred during download, if any.
Tries to remove a downloaded segment from the stream. If the stream is empty, it returns immediately with false.
A containing the reference to a byte[] and the offset and count of the data in the array.
true if a downloaded segment was available and could return with, otherwise false
A non-blocking Read function. When it returns 0, it doesn't mean the download is complete. If the download interrupted before completing, the next Read call can throw an exception.
The buffer to read data into.
The zero-based byte offset in the buffer at which to begin copying bytes.
The maximum number of bytes to read.
The number of bytes copied to the buffer, or zero if no downloaded data is available at the time of the call.
If the stream is already disposed.
Writes a downloaded data segment to the stream.
The downloaded data segment to write.
Checks whether the stream is fully buffered and increases a counter if it's full, resetting it otherwise.
The limit for the full check counter.
true if the counter is equal to or larger than the limit parameter; otherwise false.
Disposes of the stream, releasing any resources held by it.
true to release both managed and unmanaged resources; false to release only unmanaged resources.
Provides constants representing various HTTP status codes.
Represents an HTTP response received from a remote server, containing information about the response status, headers, and data.
The HTTPResponse class represents an HTTP response received from a remote server. It contains information about the response status, headers, and the data content.
Key Features:
-
Response Properties
Provides access to various properties such as , , , and more, to inspect the response details.
-
Data Access
Allows access to the response data in various forms, including raw bytes, UTF-8 text, and as a for image data.
-
Header Management
Provides methods to add, retrieve, and manipulate HTTP headers associated with the response, making it easy to inspect and work with header information.
-
Caching Support
Supports response caching, enabling the storage of downloaded data in local cache storage for future use.
-
Stream Management
Manages the download process and data streaming through a () to optimize memory usage and ensure efficient handling of large response bodies.
Gets the version of the HTTP protocol with which the response was received. Typically, this is HTTP/1.1 for local file and cache responses, even if the original response received with a different version.
Gets the HTTP status code sent from the server, indicating the outcome of the HTTP request.
Gets the message sent along with the status code from the server. This message can add some details, but it's empty for HTTP/2 responses.
Gets a value indicating whether the response represents a successful HTTP request. Returns true if the status code is in the range of [200..300[ or 304 (Not Modified).
Gets a value indicating whether the response body is read from the cache.
Gets the headers sent from the server as key-value pairs. You can use additional methods to manage and retrieve header information.
The Headers property provides access to the headers sent by the server in the HTTP response. You can use the following methods to work with headers:
- Adds an HTTP header with the specified name and value to the response headers.
- Retrieves the list of values for a given header name as received from the server.
- Retrieves the first value for a given header name as received from the server.
- Checks if a header with the specified name and value exists in the response headers.
- Checks if a header with the specified name exists in the response headers.
- Parses the 'Content-Range' header's value and returns a object representing the byte range of the response content.
The data that downloaded from the server. All Transfer and Content encodings decoded if any(eg. chunked, gzip, deflate).
The normal HTTP protocol is upgraded to an other.
Cached, converted data.
The data converted to an UTF8 string.
Cached converted data.
The data loaded to a Texture2D.
Reference to the instance that contains the downloaded data.
IProtocol.LoggingContext implementation.
The original request that this response is created for.
Adds an HTTP header with the specified name and value to the response headers.
The name of the header.
The value of the header.
Retrieves the list of values for a given header name as received from the server.
The name of the header.
A list of header values if the header exists and contains values; otherwise, returns null.
Retrieves the first value for a given header name as received from the server.
The name of the header.
The first header value if the header exists and contains values; otherwise, returns null.
Checks if a header with the specified name and value exists in the response headers.
The name of the header to check.
The value to check for in the header.
true if a header with the given name and value exists in the response headers; otherwise, false.
Checks if a header with the specified name exists in the response headers.
The name of the header to check.
true if a header with the given name exists in the response headers; otherwise, false.
Parses the 'Content-Range' header's value and returns a object representing the byte range of the response content.
If the server ignores a byte-range-spec because it is syntactically invalid, the server SHOULD treat the request as if the invalid Range header field did not exist.
(Normally, this means return a 200 response containing the full entity). In this case because there are no 'Content-Range' header values, this function will return null.
A object representing the byte range of the response content, or null if no 'Content-Range' header is found.
Add data to the fragments list.
The buffer to be added.
The position where we start copy the data.
How many data we want to copy.
IDisposable implementation.
Describes the state of a future.
The future hasn't begun to resolve a value.
The future is working on resolving a value.
The future has a value ready.
The future failed to resolve a value.
Defines the interface of an object that can be used to track a future value.
The type of object being retrieved.
Gets the state of the future.
Gets the value if the State is Success.
Gets the failure exception if the State is Error.
Adds a new callback to invoke when an intermediate result is known.
The callback to invoke.
The future so additional calls can be chained together.
Adds a new callback to invoke if the future value is retrieved successfully.
The callback to invoke.
The future so additional calls can be chained together.
Adds a new callback to invoke if the future has an error.
The callback to invoke.
The future so additional calls can be chained together.
Adds a new callback to invoke if the future value is retrieved successfully or has an error.
The callback to invoke.
The future so additional calls can be chained together.
Defines the signature for callbacks used by the future.
The future.
An implementation of that can be used internally by methods that return futures.
Methods should always return the interface when calling code requests a future.
This class is intended to be constructed internally in the method to provide a simple implementation of
the interface. By returning the interface instead of the class it ensures the implementation can change
later on if requirements change, without affecting the calling code.
The type of object being retrieved.
Gets the state of the future.
Gets the value if the State is Success.
Gets the failure exception if the State is Error.
Initializes a new instance of the class.
Adds a new callback to invoke if the future value is retrieved successfully.
The callback to invoke.
The future so additional calls can be chained together.
Adds a new callback to invoke if the future has an error.
The callback to invoke.
The future so additional calls can be chained together.
Adds a new callback to invoke if the future value is retrieved successfully or has an error.
The callback to invoke.
The future so additional calls can be chained together.
Begins running a given function on a background thread to resolve the future's value, as long
as it is still in the Pending state.
The function that will retrieve the desired value.
Allows manually assigning a value to a future, as long as it is still in the pending state.
There are times where you may not need to do background processing for a value. For example,
you may have a cache of values and can just hand one out. In those cases you still want to
return a future for the method signature, but can just call this method to fill in the future.
The value to assign the future.
Allows manually failing a future, as long as it is still in the pending state.
As with the Assign method, there are times where you may know a future value is a failure without
doing any background work. In those cases you can simply fail the future manually and return it.
The exception to use to fail the future.
This enum describes the action that caused a CollectionChanged event.
One or more items were added to the collection.
One or more items were removed from the collection.
One or more items were replaced in the collection.
One or more items were moved within the collection.
The contents of the collection changed dramatically.
Arguments for the CollectionChanged event.
A collection that supports INotifyCollectionChangedThis raises this event
whenever an item is added or removed, or when the contents of the collection
changes dramatically.
Construct a NotifyCollectionChangedEventArgs that describes a reset change.
The action that caused the event (must be Reset).
Construct a NotifyCollectionChangedEventArgs that describes a one-item change.
The action that caused the event; can only be Reset, Add or Remove action.
The item affected by the change.
Construct a NotifyCollectionChangedEventArgs that describes a one-item change.
The action that caused the event.
The item affected by the change.
The index where the change occurred.
Construct a NotifyCollectionChangedEventArgs that describes a multi-item change.
The action that caused the event.
The items affected by the change.
Construct a NotifyCollectionChangedEventArgs that describes a multi-item change (or a reset).
The action that caused the event.
The items affected by the change.
The index where the change occurred.
Construct a NotifyCollectionChangedEventArgs that describes a one-item Replace event.
Can only be a Replace action.
The new item replacing the original item.
The original item that is replaced.
Construct a NotifyCollectionChangedEventArgs that describes a one-item Replace event.
Can only be a Replace action.
The new item replacing the original item.
The original item that is replaced.
The index of the item being replaced.
Construct a NotifyCollectionChangedEventArgs that describes a multi-item Replace event.
Can only be a Replace action.
The new items replacing the original items.
The original items that are replaced.
Construct a NotifyCollectionChangedEventArgs that describes a multi-item Replace event.
Can only be a Replace action.
The new items replacing the original items.
The original items that are replaced.
The starting index of the items being replaced.
Construct a NotifyCollectionChangedEventArgs that describes a one-item Move event.
Can only be a Move action.
The item affected by the change.
The new index for the changed item.
The old index for the changed item.
Construct a NotifyCollectionChangedEventArgs that describes a multi-item Move event.
The action that caused the event.
The items affected by the change.
The new index for the changed items.
The old index for the changed items.
Construct a NotifyCollectionChangedEventArgs with given fields (no validation). Used by WinRT marshaling.
The action that caused the event.
The items affected by the change.
The old items affected by the change (for Replace events).
The index where the change occurred.
The old index where the change occurred (for Move events).