|
@@ -32,7 +32,6 @@ import (
|
|
"io"
|
|
"io"
|
|
"log"
|
|
"log"
|
|
"net/http"
|
|
"net/http"
|
|
- "net/textproto"
|
|
|
|
"strings"
|
|
"strings"
|
|
"sync"
|
|
"sync"
|
|
)
|
|
)
|
|
@@ -75,17 +74,24 @@ func (c *Controller) RequestGeneric(method string, host string, path string, hdr
|
|
if err != nil {
|
|
if err != nil {
|
|
return nil, nil, 500, err
|
|
return nil, nil, 500, err
|
|
}
|
|
}
|
|
- altPage := c.pageMod(b)
|
|
|
|
- resp.Header.Set(textproto.CanonicalMIMEHeaderKey("content-length"), string(len(altPage)))
|
|
|
|
|
|
+ var data []byte
|
|
|
|
+
|
|
|
|
+ _, ok := c.PageMods.Bypass[path]
|
|
|
|
+ if ok {
|
|
|
|
+ data = b
|
|
|
|
+ } else {
|
|
|
|
+ data = c.pageMod(b)
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
|
|
if !strings.Contains(path, "?") {
|
|
if !strings.Contains(path, "?") {
|
|
if resp.StatusCode == 200 {
|
|
if resp.StatusCode == 200 {
|
|
if method == "GET" {
|
|
if method == "GET" {
|
|
- c.CacheResource(path, NewCachedResource(altPage, &resp.Header, resp.StatusCode))
|
|
|
|
|
|
+ c.CacheResource(path, NewCachedResource(data, &resp.Header, resp.StatusCode))
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- return altPage, &resp.Header, resp.StatusCode, nil
|
|
|
|
|
|
+ return data, &resp.Header, resp.StatusCode, nil
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|