<commit_before>package cas

import (
	"crypto/rand"
	"fmt"
	"io/ioutil"
	"net/http"
	"net/url"
	"sync"

	"github.com/golang/glog"
)

// Client configuration options
type Options struct {
	URL   *url.URL    // URL to the CAS service
	Store TicketStore // Custom TicketStore, if nil a MemoryStore will be used
}

// Client implements the main protocol
type Client struct {
	url     *url.URL
	tickets TicketStore
	client  *http.Client

	mu       sync.Mutex
	sessions map[string]string
}

// NewClient creates a Client with the provided Options.
func NewClient(options *Options) *Client {
	if glog.V(2) {
		glog.Infof("cas: new client with options %v", options)
	}

	var tickets TicketStore
	if options.Store != nil {
		tickets = options.Store
	} else {
		tickets = &MemoryStore{}
	}

	return &Client{
		url:      options.URL,
		tickets:  tickets,
		client:   &http.Client{},
		sessions: make(map[string]string),
	}
}

// Handle wraps a http.Handler to provide CAS authentication for the handler.
func (c *Client) Handle(h http.Handler) http.Handler {
	return &clientHandler{
		c: c,<commit_msg>Options extended for custom http.Client<commit_after>package cas

import (
	"crypto/rand"
	"fmt"
	"io/ioutil"
	"net/http"
	"net/url"
	"sync"

	"github.com/golang/glog"
)

// Client configuration options
type Options struct {
	URL    *url.URL     // URL to the CAS service
	Store  TicketStore  // Custom TicketStore, if nil a MemoryStore will be used
	Client *http.Client // Custom http client to allow options for http connections
}

// Client implements the main protocol
type Client struct {
	url     *url.URL
	tickets TicketStore
	client  *http.Client

	mu       sync.Mutex
	sessions map[string]string
}

// NewClient creates a Client with the provided Options.
func NewClient(options *Options) *Client {
	if glog.V(2) {
		glog.Infof("cas: new client with options %v", options)
	}

	var tickets TicketStore
	if options.Store != nil {
		tickets = options.Store
	} else {
		tickets = &MemoryStore{}
	}

	var client *http.Client
	if options.Client != nil {
		client = options.Client
	} else {
		client = &http.Client{}
	}

	return &Client{
		url:      options.URL,
		tickets:  tickets,
		client:   client,
		sessions: make(map[string]string),
	}
}

// Handle wraps a http.Handler to provide CAS authentication for the handler.
func (c *Client) Handle(h http.Handler) http.Handler {
	return &clientHandler{
		c: c,
{'fraction_non_alphanumeric': 0.10607321131447588, 'fraction_numerical': 0.0008319467554076539, 'mean_word_length': 3.4047619047619047, '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': '4275581', 'n_tokens_mistral': 837, 'n_tokens_neox': 803, 'n_words': 255}