<commit_before>package handlers

import (
	"encoding/json"
	"log"
	"net/http"

	"github.com/gorilla/mux"
	"github.com/play-with-docker/play-with-docker/pwd"
)

func SessionSetup(rw http.ResponseWriter, req *http.Request) {
	vars := mux.Vars(req)
	sessionId := vars["sessionId"]

	body := pwd.SessionSetupConf{}

	json.NewDecoder(req.Body).Decode(&body)

	s := core.SessionGet(sessionId)

	s.Host = req.Host
	err := core.SessionSetup(s, body)
	if err != nil {
		if pwd.SessionNotEmpty(err) {
			log.Println("Cannot setup a session that contains instances")
			rw.WriteHeader(http.StatusConflict)
			rw.Write([]byte("Cannot setup a session that contains instances"))
			return
		}
		log.Println(err)
		rw.WriteHeader(http.StatusInternalServerError)
		return
	}
}
<commit_msg>Don't change session host!<commit_after>package handlers

import (
	"encoding/json"
	"log"
	"net/http"

	"github.com/gorilla/mux"
	"github.com/play-with-docker/play-with-docker/pwd"
)

func SessionSetup(rw http.ResponseWriter, req *http.Request) {
	vars := mux.Vars(req)
	sessionId := vars["sessionId"]

	body := pwd.SessionSetupConf{}

	json.NewDecoder(req.Body).Decode(&body)

	s := core.SessionGet(sessionId)

	err := core.SessionSetup(s, body)
	if err != nil {
		if pwd.SessionNotEmpty(err) {
			log.Println("Cannot setup a session that contains instances")
			rw.WriteHeader(http.StatusConflict)
			rw.Write([]byte("Cannot setup a session that contains instances"))
			return
		}
		log.Println(err)
		rw.WriteHeader(http.StatusInternalServerError)
		return
	}
}

{'fraction_non_alphanumeric': 0.1396103896103896, 'fraction_numerical': 0.0, 'mean_word_length': 4.503571428571429, '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': '1519862', 'n_tokens_mistral': 582, 'n_tokens_neox': 538, 'n_words': 103}