Git Product home page Git Product logo

link's People

Contributors

peterhellberg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

link's Issues

Doesn't work for multiple Link headers

If multiple Links are given as multiple headers rather than a single comma separated value, only the first value is returned.

github.com/golang/gddo/httputil/header.ParseList might be useful here.

Parse panics on input without double quotes

(Reporting in case it is helpful.)

The following input causes Parse to panic:

link.Parse(`</example.png>;rel=preload;as=image`)

(Playground link: https://go.dev/play/p/yZcgx_-7G_4.)

The input comes from the real world and may or may not be valid. (From a quick look over RFC 5988, it seems that it might be okay.)

The panic can be minified to link.Parse("</example.png>; rel=preload"). It seems it happens when there aren't double quotes around the rel value.

I suspect PR #5 may fix it. (CC @AlaricWhitney)

Fails parsing some link headers

Link header from: http://www.w3.org/wiki/LinkHeader

Link: <//www.w3.org/wiki/LinkHeader>; rel="original latest-version",<//www.w3.org/wiki/Special:TimeGate/LinkHeader>; rel="timegate",<//www.w3.org/wiki/Special:TimeMap/LinkHeader>; rel="timemap"; type="application/link-format"; from="Mon, 03 Sep 2007 14:52:48 GMT"; until="Tue, 16 Jun 2015 22:59:23 GMT",<//www.w3.org/wiki/index.php?title=LinkHeader&oldid=10152>; rel="first memento"; datetime="Mon, 03 Sep 2007 14:52:48 GMT",<//www.w3.org/wiki/index.php?title=LinkHeader&oldid=84697>; rel="last memento"; datetime="Tue, 16 Jun 2015 22:59:23 GMT"
runtime error: index out of range
github.com/peterhellberg/link.Parse(0xc82015a000, 0x21b, 0x1)
        /go/src/github.com/peterhellberg/link/link.go:83 +0x66c
github.com/peterhellberg/link.ParseHeader(0xc8200f4840, 0x0)
        /go/src/github.com/peterhellberg/link/link.go:54 +0xd0
github.com/peterhellberg/link.ParseResponse(0xc82011c1b0, 0x4a3959)
        /go/src/github.com/peterhellberg/link/link.go:48 +0x3a
main.main.func3(0xc82011c1b0, 0xc820110050, 0xc8200cb901)
        /go/src/app/main.go:42 +0x28

I think this being caused by the commas in datetime values.

http://play.golang.org/p/LX7drOkmNK

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.