<commit_before>package urltest

import (
	log "github.com/Sirupsen/logrus"
	"net/http"
)

// TestUrlIsLockedDown checks a URL to see if it returns a 401 or has
// X-Auto-Login headers
func TestUrlIsLockedDown(url string) (bool, error) {

	lockeddown := false
	resp, err := http.Get(url)
	if err != nil {
		log.WithFields(log.Fields{"err": err}).Fatal("Failed to get URL")
	}

	// HTTP 401, or User Service login
	if (resp.StatusCode == 401) || (len(resp.Header["X-Auto-Login"]) > 0) {
		lockeddown = true
	}

	log.Debug("url: ", url, ", lockeddown: ", lockeddown)

	return lockeddown, err
}<commit_msg>Made urltest more flexible to allow for connections reset by peer<commit_after>package urltest

import (
	log "github.com/Sirupsen/logrus"
	"net/http"
)

// TestUrlIsLockedDown checks a URL to see if it returns a 401 or has
// X-Auto-Login headers
func TestUrlIsLockedDown(url string) (bool, error) {

	lockeddown := false
	resp, err := http.Get(url)
	if err != nil {
		log.Warnf("Failed to get URL [%s]:\n%s", resp.Status, err)
		return lockeddown, err
	}

	// HTTP 401, or User Service login
	if (resp.StatusCode == 401) || (len(resp.Header["X-Auto-Login"]) > 0) {
		lockeddown = true
	}

	log.Debug("url: ", url, ", lockeddown: ", lockeddown)

	return lockeddown, err
}
{'fraction_non_alphanumeric': 0.14364207221350078, 'fraction_numerical': 0.015698587127158554, 'mean_word_length': 3.9038461538461537, 'pattern_counts': {'":': 1, '<': 3, '<?xml version=': 0, '>': 5, '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': '7615986', 'n_tokens_mistral': 476, 'n_tokens_neox': 446, 'n_words': 133}