public ChannelUpstreamRequest(HttpContext context, AsyncCallback asyncCallback, object extraData, ProtoProxyClient client)
            : base(context, asyncCallback, extraData)
        {
            _client = client;

            _client.Touch();

            HandleRequest();

            SetAsCompleted(null, true);
        }
        public StreamDownloadRequest(HttpContext context, AsyncCallback asyncCallback, object extraData, ProtoProxyClient client, int associationId)
            : base(context, asyncCallback, extraData)
        {
            Require.NotNull(client, "client");

            _client = client;
            _associationId = associationId;

            _client.Touch();

            HandleRequest();
        }
Ejemplo n.º 3
0
        public StreamUploadRequest(HttpContext context, AsyncCallback asyncCallback, object extraData, ProtoProxyClient client, int? associationId)
            : base(context, asyncCallback, extraData)
        {
            Require.NotNull(client, "client");

            _client = client;
            _associationId = associationId;

            _client.Touch();

            if (context.Request.Files.Count == 0)
                SetAsCompleted(null, true);
            else
                HandleRequest();

            _inConstructor = false;
        }
        public ChannelDownstreamRequest(HttpContext context, AsyncCallback asyncCallback, object extraData, ProtoProxyClient client)
            : base(context, asyncCallback, extraData)
        {
            Created = DateTime.Now;

            _client = client;

            _client.Touch();

            string downstreamIdString = Context.Request.QueryString["DID"];

            if (downstreamIdString != null)
            {
                int downstreamId;

                if (!int.TryParse(downstreamIdString, NumberStyles.None, CultureInfo.InvariantCulture, out downstreamId))
                    throw new ProtoChannelException("Invalid DID query string parameter");

                _downstreamId = downstreamId;
            }

            if (_downstreamId.HasValue)
            {
                // For IE, we communicate through framed JSON. This requires
                // us to set the content type to text/html. Ensure that dynamic
                // compression is disabled in web.config.

                Context.Response.ContentType = "text/html";

                // Send 1K in padding.

                Context.Response.Write(IframePadding);
                Context.Response.Flush();
            }
            else
            {
                // Below content type is not gzipped by default. Gzipping the response
                // has the effect that chunked transport encoding doesn't work anymore.

                Context.Response.ContentType = "application/octet-stream";
            }

            _client.AssignDownstream(this);
        }