<commit_before>package http

import (
	"encoding/json"
	"fmt"
	"io"
	"net/http"
	"net/url"
	"strings"

	"github.com/hashicorp/vault/logical"
	"github.com/hashicorp/vault/vault"
)

// AuthHeaderName is the name of the header containing the token.
const AuthHeaderName = "X-Vault-Token"

// Handler returns an http.Handler for the API. This can be used on
// its own to mount the Vault API within another web server.
func Handler(core *vault.Core) http.Handler {
	// Create the muxer to handle the actual endpoints
	mux := http.NewServeMux()
	mux.Handle("/v1/sys/init", handleSysInit(core))
	mux.Handle("/v1/sys/seal-status", handleSysSealStatus(core))
	mux.Handle("/v1/sys/seal", handleSysSeal(core))
	mux.Handle("/v1/sys/unseal", handleSysUnseal(core))
	mux.Handle("/v1/sys/mounts", proxySysRequest(core))
	mux.Handle("/v1/sys/mounts/", proxySysRequest(core))
	mux.Handle("/v1/sys/remount", proxySysRequest(core))
	mux.Handle("/v1/sys/policy", handleSysListPolicies(core))
	mux.Handle("/v1/sys/policy/", handleSysPolicy(core))
	mux.Handle("/v1/sys/renew/", proxySysRequest(core))
	mux.Handle("/v1/sys/revoke/", proxySysRequest(core))
	mux.Handle("/v1/sys/revoke-prefix/", proxySysRequest(core))
	mux.Handle("/v1/sys/auth", proxySysRequest(core))
	mux.Handle("/v1/sys/auth/", proxySysRequest(core))
	mux.Handle("/v1/sys/audit-hash/", proxySysRequest(core))
	mux.Handle("/v1/sys/audit", proxySysRequest(core))
	mux.Handle("/v1/sys/audit/", proxySysRequest(core))
	mux.Handle("/v1/sys/leader", handleSysLeader(core))
	mux.Handle("/v1/sys/health", handleSysHealth(core))
	mux.Handle("/v1/sys/rotate", proxySysRequest(core))
	mux.Handle("/v1/sys/key-status", proxySysRequest(core))
	mux.Handle("/v1/sys/rekey/init", handleSysRekeyInit(core))
	mux.Handle("/v1/sys/rekey/backup", proxySysRequest(core))
	mux.Handle("/v1/sys/rekey/update", handleSysRekeyUpdate(core))
	mux.Handle("/v1/", handleLogical(core, false))
<commit_msg>Have 'sys/renew' return the value provided in Secret.<commit_after>package http

import (
	"encoding/json"
	"fmt"
	"io"
	"net/http"
	"net/url"
	"strings"

	"github.com/hashicorp/vault/logical"
	"github.com/hashicorp/vault/vault"
)

// AuthHeaderName is the name of the header containing the token.
const AuthHeaderName = "X-Vault-Token"

// Handler returns an http.Handler for the API. This can be used on
// its own to mount the Vault API within another web server.
func Handler(core *vault.Core) http.Handler {
	// Create the muxer to handle the actual endpoints
	mux := http.NewServeMux()
	mux.Handle("/v1/sys/init", handleSysInit(core))
	mux.Handle("/v1/sys/seal-status", handleSysSealStatus(core))
	mux.Handle("/v1/sys/seal", handleSysSeal(core))
	mux.Handle("/v1/sys/unseal", handleSysUnseal(core))
	mux.Handle("/v1/sys/mounts", proxySysRequest(core))
	mux.Handle("/v1/sys/mounts/", proxySysRequest(core))
	mux.Handle("/v1/sys/remount", proxySysRequest(core))
	mux.Handle("/v1/sys/policy", handleSysListPolicies(core))
	mux.Handle("/v1/sys/policy/", handleSysPolicy(core))
	mux.Handle("/v1/sys/renew/", handleLogical(core, false))
	mux.Handle("/v1/sys/revoke/", proxySysRequest(core))
	mux.Handle("/v1/sys/revoke-prefix/", proxySysRequest(core))
	mux.Handle("/v1/sys/auth", proxySysRequest(core))
	mux.Handle("/v1/sys/auth/", proxySysRequest(core))
	mux.Handle("/v1/sys/audit-hash/", proxySysRequest(core))
	mux.Handle("/v1/sys/audit", proxySysRequest(core))
	mux.Handle("/v1/sys/audit/", proxySysRequest(core))
	mux.Handle("/v1/sys/leader", handleSysLeader(core))
	mux.Handle("/v1/sys/health", handleSysHealth(core))
	mux.Handle("/v1/sys/rotate", proxySysRequest(core))
	mux.Handle("/v1/sys/key-status", proxySysRequest(core))
	mux.Handle("/v1/sys/rekey/init", handleSysRekeyInit(core))
	mux.Handle("/v1/sys/rekey/backup", proxySysRequest(core))
	mux.Handle("/v1/sys/rekey/update", handleSysRekeyUpdate(core))
	mux.Handle("/v1/", handleLogical(core, false))

{'fraction_non_alphanumeric': 0.18146718146718147, 'fraction_numerical': 0.01287001287001287, 'mean_word_length': 5.31869918699187, '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': '3462336', 'n_tokens_mistral': 1453, 'n_tokens_neox': 1441, 'n_words': 232}