Changeset 29 in code for trunk


Ignore:
Timestamp:
Nov 23, 2016, 4:57:17 PM (9 years ago)
Author:
alex
Message:

[fix] #20 : <meta http-equiv='refresh'> : URL with simple quotes or doubles quote are proxified correctly.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/morty.go

    r28 r29  
    492492        if bytes.Equal(http_equiv, []byte("refresh")) && urlIndex != -1 {
    493493                contentUrl := content[urlIndex+4:]
     494                // special case of <meta http-equiv="refresh" content="0; url='example.com/url.with.quote.outside'">
     495                if len(contentUrl)>=2 && (contentUrl[0] == byte('\'') || contentUrl[0] == byte('"')) {
     496                        if contentUrl[0] == contentUrl[len(contentUrl)-1] {
     497                                contentUrl=contentUrl[1:len(contentUrl)-1]
     498                        }
     499                }
     500                // output proxify result
    494501                if uri, err := rc.ProxifyURI(string(contentUrl)); err == nil {
    495502                        fmt.Fprintf(out, ` http-equiv="refresh" content="%surl=%s"`, content[:urlIndex], uri)
Note: See TracChangeset for help on using the changeset viewer.