<commit_before>﻿using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Web;
using Sitecore.Configuration;
using Sitecore.StringExtensions;
using Unicorn.Configuration;
using Unicorn.ControlPanel.Remote.Logging;
using Unicorn.ControlPanel.Security;
using Unicorn.Data;
using Unicorn.Logging;
using Unicorn.Predicates;

namespace Unicorn.ControlPanel.Remote
{
	public class UnicornRemotePipelineProcessor : UnicornControlPanelPipelineProcessor
	{
		protected static readonly string CurrentVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
		private static readonly IUnicornAuthenticationProvider AuthenticationProvider = (IUnicornAuthenticationProvider)Factory.CreateObject("/sitecore/unicorn/authenticationProvider", true);

		public UnicornRemotePipelineProcessor(string activationUrl) : base(activationUrl)
		{
		}

		public override void ProcessRequest(HttpContext context)
		{
			context.Server.ScriptTimeout = 86400;

			var verb = (context.Request.QueryString["verb"] ?? string.Empty).ToLowerInvariant();

			if (verb == "Challenge")
			{
				context.Response.ContentType = "text/plain";
				context.Response.Write(AuthenticationProvider.GetChallengeToken());
				context.Response.End();
				return;
			}

			if (!Authorization.IsAllowed)
			{
				context.Response.StatusCode = 401;
				context.Response.StatusDescription = "Not Authorized";
			}<commit_msg>fix casing for remote api challenge verb<commit_after>﻿using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Web;
using Sitecore.Configuration;
using Sitecore.StringExtensions;
using Unicorn.Configuration;
using Unicorn.ControlPanel.Remote.Logging;
using Unicorn.ControlPanel.Security;
using Unicorn.Data;
using Unicorn.Logging;
using Unicorn.Predicates;

namespace Unicorn.ControlPanel.Remote
{
	public class UnicornRemotePipelineProcessor : UnicornControlPanelPipelineProcessor
	{
		protected static readonly string CurrentVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
		private static readonly IUnicornAuthenticationProvider AuthenticationProvider = (IUnicornAuthenticationProvider)Factory.CreateObject("/sitecore/unicorn/authenticationProvider", true);

		public UnicornRemotePipelineProcessor(string activationUrl) : base(activationUrl)
		{
		}

		public override void ProcessRequest(HttpContext context)
		{
			context.Server.ScriptTimeout = 86400;

			var verb = (context.Request.QueryString["verb"] ?? string.Empty).ToLowerInvariant();

			if (verb == "challenge")
			{
				context.Response.ContentType = "text/plain";
				context.Response.Write(AuthenticationProvider.GetChallengeToken());
				context.Response.End();
				return;
			}

			if (!Authorization.IsAllowed)
			{
				context.Response.StatusCode = 401;
				context.Response.StatusDescription = "Not Authorized";
			}
{'fraction_non_alphanumeric': 0.095368782161235, 'fraction_numerical': 0.005488850771869639, 'mean_word_length': 5.7972027972027975, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5711761', 'n_tokens_mistral': 896, 'n_tokens_neox': 768, 'n_words': 160}