<commit_before>package main
import "fmt"
import "net/http"
import "time"
import "strings"
import "os"
import "io"

type Gok struct {
    w http.ResponseWriter;
    r *http.Request;
};

func (self *Gok) Echo(a ...interface{}) {
    fmt.Fprint(self.w, a...);
}
/*- >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> $_SERVER <<<<<<<<<<<<<<<<<<<<<<<<<<<<<< -*/
func (self *Gok) ServerSelf() string {
    return self.r.URL.Path;
}
func (self *Gok) ServerHttpUserAgent() string {
    return strings.Join(self.r.Header["User-Agent"], "\n");
}
func (self *Gok) ServerHttpReferer() string {
    return strings.Join(self.r.Header["Referer"], "\n");
}

func (self *Gok) ServerHttps() bool {
    return self.r.URL.Scheme == "https";
}
func (self *Gok) ServerRemoteAddr() string {
    return strings.Split(self.r.RemoteAddr, ":")[0];
}
func (self *Gok) ServerRemotePort() string {
    return strings.Split(self.r.RemoteAddr, ":")[1];
}
func (self *Gok) ServerPort() int {
    return 80;
}
func (self *Gok) ServerHttpAcceptEncoding() string {
    return strings.Join(self.r.Header["Accept-Encoding"], "\n");
}
func (self *Gok) ServerProtocol() string {
    return self.r.Proto;
}
func (self *Gok) ServerRequestMethod() string {
    return self.r.Method;
}
func (self *Gok) ServerQueryString() string {
    return self.r.URL.RawQuery
}
func (self *Gok) ServerHttpAccept() string {
    return strings.Join(self.r.Header["Accept"], "\n");
}
func (self *Gok) ServerHttpAcceptCharset() string {
    return strings.Join(self.r.Header["Accept-Charset"], "\n");
}
func (self *Gok) ServerHttpAcceptLanguage() string {
    return strings.Join(self.r.Header["Accept-Language"], "\n");
}
func (self *Gok) ServerHttpConnection() string {
    return strings.Join(self.r.Header["Connection"], "\n");
}
func (self *Gok) ServerHttpHost() string {
    return self.r.Host;
}


/*- >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> $_GET && $_POST <<<<<<<<<<<<<<<<<<<<<<<<<<< -*/

func (self *Gok) Post(name string) []byte {
    return nil;
}
func (self *Gok) Get(name string) string {
    return "";
}

/*- >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>  $_COOKIE <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< -*/
func (self *Gok) Cookie(name string) string {
    if cookie, err := self.r.Cookie(name); err == http.ErrNoCookie {
        return "";
    } else if cookie != nil {
        return cookie.Raw;
    }
    return "";
}
func (self *Gok) SetCookie(name string, value string, expires *time.Time) {
}
func (self *Gok) SetCookie_4(name string, value string, expires *time.Time, path string){
}
func (self *Gok) SetCookie_5(name string, value string, expires *time.Time, path string,
                            domain string){
}
func (self *Gok) SetCookie_7(name string, value string, expires *time.Time, path string,
                            domain string, secure bool, httpOnly bool) {
}
func (self *Gok) UnSetCookie(name string) {
}

/*- $_FILE -*/
func (self *Gok) File(name string) (string, string, string, int64) {
    f, fHeader, err := self.r.FormFile(name);
    if err != nil {
        return "", "", "", 0;
    }
    defer f.Close();
    fileName := genRandName();
    f2, err := os.Create(fileName);
    if err != nil {
        return "", "", "", 0;
    }
    defer f2.Close();
    size, err := io.Copy(f2, f);
    if err != nil {
        return "", "", "", 0;
    }
    if len(fHeader.Header["Content-Type"]) == 0 {
        return fileName, fHeader.Filename, "", size;
    }
    return fileName, fHeader.Filename, fHeader.Header["Content-Type"][0], size;
}

/*- Headers -*/
func (self *Gok) Header(header string) {
    h := strings.Split(header, ":");
    if len(h) != 2 {<commit_msg>standard<commit_after>package main
import "fmt"
import "net/http"
import "time"
import "strings"
import "os"
import "io"

type Gok struct {
    w http.ResponseWriter;
    r *http.Request;
};

func (self *Gok) Echo(a ...interface{}) {
    fmt.Fprint(self.w, a...);
}
/*- >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> $_SERVER <<<<<<<<<<<<<<<<<<<<<<<<<<<<<< -*/
func (self *Gok) ServerSelf() string {
    return self.r.URL.Path;
}
func (self *Gok) ServerHttpUserAgent() string {
    return strings.Join(self.r.Header["User-Agent"], "\n");
}
func (self *Gok) ServerHttpReferer() string {
    return strings.Join(self.r.Header["Referer"], "\n");
}

func (self *Gok) ServerHttps() bool {
    return self.r.URL.Scheme == "https";
}
func (self *Gok) ServerRemoteAddr() string {
    return strings.Split(self.r.RemoteAddr, ":")[0];
}
func (self *Gok) ServerRemotePort() string {
    return strings.Split(self.r.RemoteAddr, ":")[1];
}
func (self *Gok) ServerPort() int {
    return 80;
}
func (self *Gok) ServerHttpAcceptEncoding() string {
    return strings.Join(self.r.Header["Accept-Encoding"], "\n");
}
func (self *Gok) ServerProtocol() string {
    return self.r.Proto;
}
func (self *Gok) ServerRequestMethod() string {
    return self.r.Method;
}
func (self *Gok) ServerQueryString() string {
    return self.r.URL.RawQuery
}
func (self *Gok) ServerHttpAccept() string {
    return strings.Join(self.r.Header["Accept"], "\n");
}
func (self *Gok) ServerHttpAcceptCharset() string {
    return strings.Join(self.r.Header["Accept-Charset"], "\n");
}
func (self *Gok) ServerHttpAcceptLanguage() string {
    return strings.Join(self.r.Header["Accept-Language"], "\n");
}
func (self *Gok) ServerHttpConnection() string {
    return strings.Join(self.r.Header["Connection"], "\n");
}
func (self *Gok) ServerHttpHost() string {
    return self.r.Host;
}


/*- >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> $_GET && $_POST <<<<<<<<<<<<<<<<<<<<<<<<<<< -*/

func (self *Gok) Post(name string) []byte {
    return nil;
}
func (self *Gok) Get(name string) string {
    return "";
}

/*- >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>  $_COOKIE <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< -*/
func (self *Gok) Cookie(name string) string {
    if cookie, err := self.r.Cookie(name); err == http.ErrNoCookie {
        return "";
    } else if cookie != nil {
        return cookie.Name+"="+cookie.Value;
    }
    return "";
}
func (self *Gok) SetCookie(name string, value string, duration int64) {
    if (len(name) == 0) || (len(value) == 0) {
        return;
    }
    cookie := new(http.Cookie);
    cookie.Name = name;
    cookie.Value = value;
    if duration != 0 {
        cookie.Expires = time.Now().Add(duration * time.Second);
    }
    http.SetCookie(w, cookie);
}

func (self *Gok) SetCookie_4(name string, value string, duration int64,
                                urlPath string){
    if (len(name) == 0) || (len(value) == 0) {
        return;
    }
    cookie := new(http.Cookie);
    cookie.Name = name;
    cookie.Value = value;
    if duration != 0 {
        cookie.Expires = time.Now().Add(duration * time.Second);
    }
    if len(urlPath) {
        cookie.Path = urlPath;
    }
    http.SetCookie(w, cookie);
}
func (self *Gok) SetCookie_5(name string, value string, duration int64,
                                urlPath string, domain string) {
    if (len(name) == 0) || (len(value) == 0) {
        return;
    }
    cookie := new(http.Cookie);
    cookie.Name = name;
    cookie.Value = value;
    if duration != 0 {
        cookie.Expires = time.Now().Add(duration * time.Second);
    }
    if len(urlPath) {
        cookie.Path = urlPath;
    }
    if len(domain) {
        cookie.Domain = domain;
    }
    http.SetCookie(w, cookie);
}
func (self *Gok) SetCookie_7(name string, value string, duration int64, path string,
                            domain string, secure bool, httpOnly bool) {
    if (len(name) == 0) || (len(value) == 0) {
        return;
    }
    cookie := new(http.Cookie);
    cookie.Name = name;
    cookie.Value = value;
    if duration != 0 {
        cookie.Expires = time.Now().Add(duration * time.Second)
    }
}

/*- $_FILE -*/
func (self *Gok) File(name string) (string, string, string, int64) {
    f, fHeader, err := self.r.FormFile(name);
    if err != nil {
        return "", "", "", 0;
    }
    defer f.Close();
    fileName := genRandName();
    f2, err := os.Create(fileName);
    if err != nil {
        return "", "", "", 0;
    }
    defer f2.Close();
    size, err := io.Copy(f2, f);
    if err != nil {
        return "", "", "", 0;
    }
    if len(fHeader.Header["Content-Type"]) == 0 {
        return fileName, fHeader.Filename, "", size;
    }
    return fileName, fHeader.Filename, fHeader.Header["Content-Type"][0], size;
}

/*- Headers -*/
func (self *Gok) Header(header string) {
    h := strings.Split(header, ":");
    if len(h) != 2 {
{'fraction_non_alphanumeric': 0.21066289219155462, 'fraction_numerical': 0.006605331446095777, 'mean_word_length': 3.112027158098933, 'pattern_counts': {'":': 6, '<': 185, '<?xml version=': 0, '>': 207, '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': '2789241', 'n_tokens_mistral': 2925, 'n_tokens_neox': 2881, 'n_words': 703}