<commit_before>﻿namespace Stumps.Http
{

    using System;
    using System.Globalization;
    using System.Net;
    using Stumps.Utility;

    /// <summary>
    ///     A class that represents an incomming HTTP request.
    /// </summary>
    internal sealed class StumpsHttpRequest : IStumpsHttpRequest
    {

        private byte[] _bodyBuffer;

        /// <summary>
        ///     Initializes a new instance of the <see cref="T:Stumps.Http.StumpsHttpRequest"/> class.
        /// </summary>
        public StumpsHttpRequest()
        {
            _bodyBuffer = new byte[0];
            this.Headers = new HeaderDictionary();
        }

        /// <summary>
        ///     Gets the length of the HTTP request body.
        /// </summary>
        /// <value>
        ///     The length of the HTTP request body.
        /// </value>
        public int BodyLength
        {
            get { return _bodyBuffer.Length; }
        }

        /// <summary>
        ///     Gets the collection of HTTP headers.
        /// </summary>
        /// <value>
        ///     The collection of HTTP headers.
        /// </value>
        public IHeaderDictionary Headers
        {
            get;
            private set;
        }

        /// <summary>
        ///     Gets the HTTP data transfer method used by the client.
        /// </summary>
        /// <value>
        ///     The HTTP data transfer method used by the client.
        /// </value>
        public string HttpMethod
        {
            get;
            private set;
        }

        /// <summary>
        ///     Gets the local end point where the HTTP request was received on.
        /// </summary>
        /// <value>
        ///     The local end point where the HTTP request was received on.
        /// </value>
        public IPEndPoint LocalEndPoint
        {
            get;
            private set;
        }

        /// <summary>
        ///     Gets the HTTP protocol version.
        /// </summary>
        /// <value>
        ///     The HTTP protocol version.
        /// </value>
        public string ProtocolVersion
        {
            get;
            private set;
        }

        /// <summary>
        ///     Gets the raw URL of the current request.
        /// </summary>
        /// <value>
        ///     The raw URL of the current request.
        /// </value>
        public string RawUrl
        {
            get;
            private set;
        }

        /// <summary>
        ///     Gets the remote end point the HTTP request came from.
        /// </summary>
        /// <value>
        ///     The remote end point where the HTTP request came from.
        /// </value>
        public IPEndPoint RemoteEndPoint
        {
            get;
            private set;
        }

        /// <summary>
        ///     Gets the body for the HTTP request.
        /// </summary>
        /// <returns>
        ///     The body for the HTTP request
        /// </returns>
        public byte[] GetBody()
        {
            return _bodyBuffer;
        }

        /// <summary>
        ///     Initializes the instance using the specified <see cref="T:System.Net.HttpListenerRequest"/>.
        /// </summary>
        /// <param name="request">The <see cref="T:System.Net.HttpListenerRequest"/> used to initilize the instance.</param>
        public void InitializeInstance(HttpListenerRequest request)
        {

            // Setup the standard values
            this.HttpMethod = request.HttpMethod;
            this.LocalEndPoint = request.LocalEndPoint;
            this.ProtocolVersion = string.Format(
                CultureInfo.InvariantCulture, "{0}.{1}", request.ProtocolVersion.Major, request.ProtocolVersion.Minor);
            this.RawUrl = request.RawUrl;
            this.RemoteEndPoint = request.RemoteEndPoint;

            // Setup the body
            _bodyBuffer = StreamUtility.ConvertStreamToByteArray(request.InputStream);

            // Setup the headers
            foreach (var key in request.Headers.AllKeys)
            {
                this.Headers.AddOrUpdate(key, request.Headers[key]);
            }

        }

    }

}<commit_msg>Minor cleanup for StyleCop.<commit_after>﻿namespace Stumps.Http
{

    using System;
    using System.Globalization;
    using System.Net;
    using Stumps.Utility;

    /// <summary>
    ///     A class that represents an incomming HTTP request.
    /// </summary>
    internal sealed class StumpsHttpRequest : IStumpsHttpRequest
    {

        private byte[] _bodyBuffer;

        /// <summary>
        ///     Initializes a new instance of the <see cref="T:Stumps.Http.StumpsHttpRequest"/> class.
        /// </summary>
        public StumpsHttpRequest()
        {
            _bodyBuffer = new byte[0];
            this.Headers = new HeaderDictionary();
        }

        /// <summary>
        ///     Gets the length of the HTTP request body.
        /// </summary>
        /// <value>
        ///     The length of the HTTP request body.
        /// </value>
        public int BodyLength
        {
            get { return _bodyBuffer.Length; }
        }

        /// <summary>
        ///     Gets the collection of HTTP headers.
        /// </summary>
        /// <value>
        ///     The collection of HTTP headers.
        /// </value>
        public IHeaderDictionary Headers
        {
            get;
            private set;
        }

        /// <summary>
        ///     Gets the HTTP data transfer method used by the client.
        /// </summary>
        /// <value>
        ///     The HTTP data transfer method used by the client.
        /// </value>
        public string HttpMethod
        {
            get;
            private set;
        }

        /// <summary>
        ///     Gets the local end point where the HTTP request was received on.
        /// </summary>
        /// <value>
        ///     The local end point where the HTTP request was received on.
        /// </value>
        public IPEndPoint LocalEndPoint
        {
            get;
            private set;
        }

        /// <summary>
        ///     Gets the HTTP protocol version.
        /// </summary>
        /// <value>
        ///     The HTTP protocol version.
        /// </value>
        public string ProtocolVersion
        {
            get;
            private set;
        }

        /// <summary>
        ///     Gets the raw URL of the current request.
        /// </summary>
        /// <value>
        ///     The raw URL of the current request.
        /// </value>
        public string RawUrl
        {
            get;
            private set;
        }

        /// <summary>
        ///     Gets the remote end point the HTTP request came from.
        /// </summary>
        /// <value>
        ///     The remote end point where the HTTP request came from.
        /// </value>
        public IPEndPoint RemoteEndPoint
        {
            get;
            private set;
        }

        /// <summary>
        ///     Gets the body for the HTTP request.
        /// </summary>
        /// <returns>
        ///     The body for the HTTP request.
        /// </returns>
        public byte[] GetBody()
        {
            return _bodyBuffer;
        }

        /// <summary>
        ///     Initializes the instance using the specified <see cref="T:System.Net.HttpListenerRequest"/>.
        /// </summary>
        /// <param name="request">The <see cref="T:System.Net.HttpListenerRequest"/> used to initilize the instance.</param>
        public void InitializeInstance(HttpListenerRequest request)
        {

            // Setup the standard values
            this.HttpMethod = request.HttpMethod;
            this.LocalEndPoint = request.LocalEndPoint;
            this.ProtocolVersion = string.Format(
                CultureInfo.InvariantCulture, "{0}.{1}", request.ProtocolVersion.Major, request.ProtocolVersion.Minor);
            this.RawUrl = request.RawUrl;
            this.RemoteEndPoint = request.RemoteEndPoint;

            // Setup the body
            _bodyBuffer = StreamUtility.ConvertStreamToByteArray(request.InputStream);

            // Setup the headers
            foreach (var key in request.Headers.AllKeys)
            {
                this.Headers.AddOrUpdate(key, request.Headers[key]);
            }

        }

    }

}
{'fraction_non_alphanumeric': 0.11043384725708139, 'fraction_numerical': 0.0007171029042667623, 'mean_word_length': 1.2555256064690028, 'pattern_counts': {'":': 0, '<': 89, '<?xml version=': 0, '>': 89, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3517872', 'n_tokens_mistral': 2081, 'n_tokens_neox': 2057, 'n_words': 617}