Skip to content

ads-github-cache: ignore letter case of http response headers #68

@salewski

Description

@salewski

The ads-github-cache program is currently comparing the Link: HTTP response header in a case-sensitive fashion: it recognizes 'Link:' but not 'link:'. Sometime in the past few days GitHub's API responses started using all lowercase letters for the HTTP header names in at least some responses. For example:

    link: <https://api.github.com/user/repos?page=2&per_page=100>; rel="next", <https://api.github.com/user/repos?page=19&per_page=100>; rel="last"

Since the responses are cached "as is", the ads-github-cache(1) program is no longer able to locate the entry from the cached value:

    $ ads-github-cache --verbose --update
    ads-github-cache (info): attempting to update 1 item
    ads-github-cache (info): updating item 1 of 1: https://api.github.com/user/repos
    ads-github-cache (error): was error while extracting Link: header from (compressed) "paged collection" metadata file: /path/to/.ads-github-tools.d/cache/gh-user-salewski/c-v1/gh-api-v3/user--repos/af/5aebf8765867b59e7b689b251e0e779dcea8e87af8cef3c91bfdad23cc146f/HEAD-meta.zst; bailing out

The use of lowercase headers is consistent with RFC 7230 section 3.2 ("Header Fields"), so the bug is not upstream.

The ads-github-cache program should be modified to treat HTTP headers in a case-insensitive fashion.

Version:

    $ ads-github-cache --version
    ads-github-cache 0.3.2  (built: 2020-10-29 19:50:12)

    Copyright (C) 2020 Alan D. Salewski <ads@salewski.email>
    License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>.
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.

    Written by Alan D. Salewski.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions