func HandleImport(w http.ResponseWriter, r *http.Request) {
	log.Println("START handling", r.URL)
	log.Println("Proto", r.Proto, "TLS", r.TLS, "Host", r.Host)

	/*if r.TLS == nil && r.Host != "localhost:8080" {
		log.Println("ERROR: Not handling non-https outside localhost", r.URL)
		return
	}*/

	currentTime := time.Now()
	requestTime := fmt.Sprintf("%02d:%02d:%02d", currentTime.Hour(), currentTime.Minute(), currentTime.Second())
	log.Println("Time", requestTime)

	w.Header().Add("Content-type", "application/json")
	ctx, bucket, _ := prepareContext()
	urls := readUrlFile(ctx, bucket)

	letter := r.URL.Query().Get("letter")
	n := r.URL.Query().Get("n")
	max, err := strconv.Atoi(r.URL.Query().Get("max"))
	if err != nil {
		log.Fatal("Unable to get the max number of files from query: ", err, requestTime)
	}

	importData := getAndProcessFiles(ctx, bucket, urls, n, letter, max, requestTime)

	importData.UrlsFilename = urlsFictionFilename
	resultJson, err := json.Marshal(importData)

	if err != nil {
		log.Fatal("Error when JSONing the result: ", err, requestTime)
	}

	w.Write(resultJson)

	log.Println("DONE handling", r.URL, requestTime)
}
// HandleImport handles the /import URL
HandleImport handles the /import URL
// HandleImport handles the / import URL
func HandleImport(w http.ResponseWriter, r *http.Request) {
	log.Println("START handling", r.URL)
	log.Println("Proto", r.Proto, "TLS", r.TLS, "Host", r.Host)
	currentTime := time.Now()
	requestTime := fmt.Sprintf("%02d:%02d:%02d", currentTime.Hour(), currentTime.Minute(), currentTime.Second())
	log.Println("Time", requestTime)
	w.Header().Add("Content-type", "application/json")
	ctx, bucket, _ := prepareContext()
	urls := readUrlFile(ctx, bucket)
	letter := r.URL.Query().Get("letter")
	n := r.URL.Query().Get("n")
	max, err := strconv.Atoi(r.URL.Query().Get("max"))
	if err != nil {
		log.Fatal("Unable to get the max number of files from query: ", err, requestTime)
	}
	importData := getAndProcessFiles(ctx, bucket, urls, n, letter, max, requestTime)
	importData.UrlsFilename = urlsFictionFilename
	resultJson, err := json.Marshal(importData)
	if err != nil {
		log.Fatal("Error when JSONing the result: ", err, requestTime)
	}
	w.Write(resultJson)
	log.Println("DONE handling", r.URL, requestTime)
}
func HandleImport ( w http . ResponseWriter , r * http . Request ) { log . Println ( " " , r . URL ) log . Println ( " " , r . Proto , " " , r . TLS , " " , r . Host ) currentTime := time . Now ( ) requestTime := fmt . Sprintf ( " " , currentTime . Hour ( ) , currentTime . Minute ( ) , currentTime . Second ( ) ) log . Println ( " " , requestTime ) w . Header ( ) . Add ( " " , " " ) ctx , bucket , _ := prepareContext ( ) urls := readUrlFile ( ctx , bucket ) letter := r . URL . Query ( ) . Get ( " " ) n := r . URL . Query ( ) . Get ( " " ) max , err := strconv . Atoi ( r . URL . Query ( ) . Get ( " " ) ) if err != nil { log . Fatal ( " " , err , requestTime ) } importData := getAndProcessFiles ( ctx , bucket , urls , n , letter , max , requestTime ) importData . UrlsFilename = urlsFictionFilename resultJson , err := json . Marshal ( importData ) if err != nil { log . Fatal ( " " , err , requestTime ) } w . Write ( resultJson ) log . Println ( " " , r . URL , requestTime ) }
HandleImport handles the /import URL
HandleImport handles the / import URL
/*if r.TLS == nil && r.Host != "localhost:8080" {
		log.Println("ERROR: Not handling non-https outside localhost", r.URL)
		return
	}*/