Example #1
0
        /// <summary>
        /// Instantiate the object without supplying a stream.  Useful for HEAD responses.
        /// </summary>
        /// <param name="ctx">S3 context.</param>
        public S3Response(S3Context ctx)
        {
            if (ctx == null)
            {
                throw new ArgumentNullException(nameof(ctx));
            }

            _HttpResponse = ctx.Http.Response;
            _S3Request    = ctx.Request;
        }
Example #2
0
        /// <summary>
        /// Instantiate.
        /// </summary>
        /// <param name="ctx">HTTP context.</param>
        /// <param name="baseDomains">List of base domains, if any.</param>
        /// <param name="metadata">User metadata, provided by your application.</param>
        /// <param name="logger">Method to invoke to send log messages.</param>
        public S3Context(HttpContext ctx, List <string> baseDomains = null, object metadata = null, Action <string> logger = null)
        {
            if (ctx == null)
            {
                throw new ArgumentNullException(nameof(ctx));
            }

            Metadata = metadata;
            Http     = ctx;
            Request  = new S3Request(this, baseDomains, logger);
            Response = new S3Response(this);
        }
Example #3
0
        /// <summary>
        /// Instantiate the object without supplying a stream.  Useful for HEAD responses.
        /// </summary>
        /// <param name="ctx">S3 context.</param>
        /// <param name="statusCode">HTTP status code.</param>
        /// <param name="contentType">Content-type.</param>
        /// <param name="headers">HTTP headers.</param>
        /// <param name="contentLength">Content length.</param>
        public S3Response(S3Context ctx, int statusCode = 200, string contentType = "text/plain", Dictionary <string, string> headers = null, long contentLength = 0)
        {
            if (ctx == null)
            {
                throw new ArgumentNullException(nameof(ctx));
            }

            _HttpResponse = ctx.Http.Response;
            _S3Request    = ctx.Request;

            StatusCode    = statusCode;
            ContentType   = contentType;
            ContentLength = contentLength;
            Chunked       = _S3Request.Chunked;
        }