예제 #1
0
        public HttpMessageInvoker(HttpMessageHandler handler, bool disposeHandler)
        {
            if (NetEventSource.Log.IsEnabled())
            {
                NetEventSource.Enter(NetEventSource.ComponentType.Http, this, ".ctor", handler);
            }

            if (handler == null)
            {
                throw new ArgumentNullException("handler");
            }

            if (HttpEventSource.Log.IsEnabled())
            {
                HttpEventSource.Associate(this, handler);
            }

            _handler        = handler;
            _disposeHandler = disposeHandler;

            if (NetEventSource.Log.IsEnabled())
            {
                NetEventSource.Exit(NetEventSource.ComponentType.Http, this, ".ctor", null);
            }
        }
예제 #2
0
        public StreamContent(Stream content, int bufferSize)
        {
            if (content == null)
            {
                throw new ArgumentNullException(nameof(content));
            }
            if (bufferSize <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(bufferSize));
            }

            _content = content;
            _bufferSize = bufferSize;
            if (content.CanSeek)
            {
                _start = content.Position;
            }
            if (HttpEventSource.Log.IsEnabled()) HttpEventSource.Associate(this, content);
        }