Skip to content
This repository has been archived by the owner on Jan 25, 2021. It is now read-only.

Link-header gets overwritten by two values #234

Closed
sebsel opened this issue May 21, 2017 · 3 comments
Closed

Link-header gets overwritten by two values #234

sebsel opened this issue May 21, 2017 · 3 comments
Labels
Milestone

Comments

@sebsel
Copy link
Contributor

sebsel commented May 21, 2017

This URL has two Link-headers, and I am interested in the first: https://www.svenknebel.de/posts/2017/5/13/

HTTP/1.1 401 UNAUTHORIZED
Server: nginx/1.9.10
Date: Sun, 21 May 2017 15:49:14 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 13
Connection: close
Link: <https://www.svenknebel.de/post_token>; rel="token_endpoint"
Link: </webmention>; rel="webmention"
WWW-Authenticate: Bearer

auth required

The remote::head() overwrites the Link header when it sees a second one.

  ["headers"]=>
  array(7) {
    ["Server"]=>
    string(12) "nginx/1.9.10"
    ["Date"]=>
    string(29) "Sun, 21 May 2017 16:17:00 GMT"
    ["Content-Type"]=>
    string(24) "text/html; charset=utf-8"
    ["Content-Length"]=>
    string(2) "13"
    ["Connection"]=>
    string(10) "keep-alive"
    ["Link"]=>
    string(31) "</webmention>; rel="webmention""
    ["WWW-Authenticate"]=>
    string(6) "Bearer"
  }
@aaronpk
Copy link

aaronpk commented May 21, 2017

This is a common problem when parsing HTTP Link headers. Feel free to use this code or test cases: https://github.com/indieweb/link-rel-parser-php

@lukasbestle
Copy link
Member

You are right, that's a bug. What do you think: Should we return an array of Link headers in that case?

Also, thanks Aaron for the link.

@lukasbestle lukasbestle added this to the 2.4.2 milestone May 28, 2017
Zegnat added a commit to Zegnat/toolkit that referenced this issue May 30, 2017
Fixes getkirby-v2#234 per discussion in getkirby-v2#235. No header field name normalisation,
but no more loss of data.
@lukasbestle
Copy link
Member

Fixed by #237. But this will be in 2.5 as it's a breaking change.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants