Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Domain overrides settings #35 #106

Merged
merged 15 commits into from
Sep 6, 2021
Merged

Domain overrides settings #35 #106

merged 15 commits into from
Sep 6, 2021

Conversation

fabiocicerchia
Copy link
Owner

Domain overrides settings #35

@fabiocicerchia fabiocicerchia added bug Something isn't working enhancement New feature or request labels Sep 1, 2021
@fabiocicerchia fabiocicerchia self-assigned this Sep 1, 2021
@lgtm-com
Copy link

lgtm-com bot commented Sep 2, 2021

This pull request introduces 1 alert when merging 2bbb7e5 into 5ec0065 - view on LGTM.com

new alerts:

  • 1 for Useless assignment to field

server/server.go Show resolved Hide resolved
server/server.go Outdated Show resolved Hide resolved
server/response/response.go Outdated Show resolved Hide resolved
server/response/response.go Outdated Show resolved Hide resolved
server/handler/http.go Outdated Show resolved Hide resolved
server/handler/etag.go Outdated Show resolved Hide resolved
@lgtm-com
Copy link

lgtm-com bot commented Sep 3, 2021

This pull request introduces 1 alert when merging e1fa2bd into 5ec0065 - view on LGTM.com

new alerts:

  • 1 for Useless assignment to field

@lgtm-com
Copy link

lgtm-com bot commented Sep 3, 2021

This pull request introduces 1 alert when merging 7b7e3ae into 5ec0065 - view on LGTM.com

new alerts:

  • 1 for Useless assignment to field

@fabiocicerchia
Copy link
Owner Author

  • new: Added RequestID in the logs (useful to trace the request easily)
  • fix: data race in redis client
  • chg: injecting logger instance to avoid global usage
  • chg: refactored tests + improved coverage
  • chg: refactored to avoid global config
  • chg: refactored ETag handling
  • chg: refactored GZip handling
  • new: added HTTP header X-Go-Proxy-Cache-Force-Fresh for bypassing cached content
  • chg: refactored LoggedResponseWriter
  • chg: removed middleware and integrate them in response flow

@@ -135,7 +136,9 @@ func (c Object) handleMetadata(domainID string, targetURL url.URL, expiration ti
// StoreFullPage - Stores the whole page response in cache.
func (c Object) StoreFullPage(expiration time.Duration) (bool, error) {
if !c.IsStatusAllowed() || !c.IsMethodAllowed() || expiration < 1 {
log.Debugf(
log.WithFields(log.Fields{
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inject the logger?

server/server.go Outdated
// timeout middleware
// NOTE: THIS IS FOR EVERY DOMAIN, NO DOMAIN OVERRIDE.
// WHEN SHARING SAME PORT NO CUSTOM OVERRIDES ON CRITICAL SETTINGS.
timeout := config.Config.Server.Timeout
// TODO! CONVERT FOR DOMAIN CONFIG
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix todo

)

// LoggedResponseWriter - Decorator for http.ResponseWriter.
func (lwr LoggedResponseWriter) GetLogger() *log.Entry {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try to inject


// GetLogger - Get logger instance with RequestID.
func (rc RequestCall) GetLogger() *log.Entry {
return log.WithFields(log.Fields{
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inject the logger?

func initRequestParams(res http.ResponseWriter, req *http.Request) (RequestCall, error) {
var configFound bool

reqID := xid.New().String()
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extract and test

@lgtm-com
Copy link

lgtm-com bot commented Sep 3, 2021

This pull request introduces 1 alert when merging b63caa2 into 5ec0065 - view on LGTM.com

new alerts:

  • 1 for Useless assignment to field

@fabiocicerchia fabiocicerchia marked this pull request as ready for review September 4, 2021 07:12
server/handler/etag.go Outdated Show resolved Hide resolved
// HandleRequestWithETag - Add HTTP header ETag only on HTTP(S) requests.
func WrapResponseForGZip(res *response.LoggedResponseWriter, req *http.Request) {
if !strings.Contains(req.Header.Get(headers.AcceptEncoding), "gzip") {
return // TODO! COVER
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cover

server/handler/http.go Outdated Show resolved Hide resolved
proxy.ServeHTTP(rc.Response, rc.Request)
serveNotModified := rc.GetResponseWithETag(proxy)
if serveNotModified {
rc.Response.SendNotModifiedResponse() // TODO! COVER
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cover

server/response/model.go Show resolved Hide resolved
@lgtm-com
Copy link

lgtm-com bot commented Sep 5, 2021

This pull request introduces 1 alert when merging 55b599a into 5ec0065 - view on LGTM.com

new alerts:

  • 1 for Useless assignment to field

@lgtm-com
Copy link

lgtm-com bot commented Sep 5, 2021

This pull request introduces 1 alert when merging 5e54cb8 into 5ec0065 - view on LGTM.com

new alerts:

  • 1 for Useless assignment to field

@fabiocicerchia fabiocicerchia merged commit 19190b5 into main Sep 6, 2021
@fabiocicerchia fabiocicerchia deleted the fix/issue-35 branch March 29, 2022 06:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant