Changeset 124 in code for trunk/morty.go
- Timestamp:
- Jul 14, 2020, 9:22:08 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/morty.go
r123 r124 184 184 185 185 type RequestConfig struct { 186 Key []byte 187 BaseURL *url.URL 186 Key []byte 187 BaseURL *url.URL 188 BodyInjected bool 188 189 } 189 190 … … 455 456 sanitizeCSS(&RequestConfig{Key: p.Key, BaseURL: parsedURI}, ctx, responseBody) 456 457 case contentType.SubType == "html" && contentType.Suffix == "": 457 sanitizeHTML(&RequestConfig{Key: p.Key, BaseURL: parsedURI}, ctx, responseBody) 458 rc := &RequestConfig{Key: p.Key, BaseURL: parsedURI} 459 sanitizeHTML(rc, ctx, responseBody) 460 if !rc.BodyInjected { 461 p := HTMLBodyExtParam{rc.BaseURL.String(), false} 462 if len(rc.Key) > 0 { 463 p.HasMortyKey = true 464 } 465 err := HTML_BODY_EXTENSION.Execute(ctx, p) 466 if err != nil { 467 if DEBUG { 468 fmt.Println("failed to inject body extension", err) 469 } 470 } 471 } 458 472 default: 459 473 if contentDispositionBytes != nil { … … 679 693 } 680 694 } 695 rc.BodyInjected = true 681 696 case "style": 682 697 state = STATE_DEFAULT
Note:
See TracChangeset
for help on using the changeset viewer.