a303c0b6dc
`nix flake info` calls the github 'commits' API, which requires authorization when the repository is private. Currently this request fails with a 404. This commit adds an authorization header when calling the 'commits' API. It also changes the way that the 'tarball' API authenticates, moving the user's token from a query parameter into the Authorization header. The query parameter method is recently deprecated and will be disallowed in November 2020. Using them today triggers a warning email.
36 lines
571 B
C++
36 lines
571 B
C++
#pragma once
|
|
|
|
#include "ref.hh"
|
|
|
|
#include <list>
|
|
#include <set>
|
|
#include <map>
|
|
#include <vector>
|
|
|
|
namespace nix {
|
|
|
|
using std::list;
|
|
using std::set;
|
|
using std::vector;
|
|
using std::string;
|
|
|
|
typedef list<string> Strings;
|
|
typedef set<string> StringSet;
|
|
typedef std::map<string, string> StringMap;
|
|
|
|
/* Paths are just strings. */
|
|
|
|
typedef string Path;
|
|
typedef list<Path> Paths;
|
|
typedef set<Path> PathSet;
|
|
|
|
typedef vector<std::pair<string, string>> Headers;
|
|
|
|
/* Helper class to run code at startup. */
|
|
template<typename T>
|
|
struct OnStartup
|
|
{
|
|
OnStartup(T && t) { t(); }
|
|
};
|
|
|
|
}
|