This file is indexed.

/usr/include/modp_burl.h is in libmodpbase64-dev 3.10.3-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 4 -*- */
/* vi: set expandtab shiftwidth=4 tabstop=4: */

/**
 * \file
 * <PRE>
 * High Performance URL Encoder/Decoder
 *
 * Copyright &copy; 2006, 2007  Nick Galbreath -- nickg [at] modp [dot] com
 * All rights reserved.
 *
 * http://code.google.com/p/stringencoders/
 *
 * Released under bsd license.  See bfast64.c for details.
 * </PRE>
 */

#ifndef COM_MODP_STRINGENCODERS_BURL
#define COM_MODP_STRINGENCODERS_BURL

#ifdef __cplusplus
#define BEGIN_C extern "C" {
#define END_C }
#else
#define BEGIN_C
#define END_C
#endif

BEGIN_C

/**
 * Url encode a string.  This uses a very strict definition of url
 * encoding.  The only characters NOT encoded are A-Z, a-z, 0-9, "-",
 * "_", ".", along with the space char getting mapped to "+".
 * Everything else is escaped using "%HEXHEX" format.  This is
 * identical to the implementation of php's urlencode and nearly
 * identical to Java's UrlEncoder class (they do not escape '*' for
 * some reason).
 *
 * \param[out] dest output string.  Must
 * \param[in] str The input string
 * \param[in] len  The length of the input string, excluding any
 *   final null byte.
 */
int modp_burl_encode(char* dest, const char* str, int len);

/**
 * Url encode a string.  This uses a minimal definition of url
 * encoding.  This works similar to the previous function except '~',
 * '!', '$', '\'', '(', ')', '*', ',', ';', ':', '@', '/', '?' are NOT
 * escaped.  This will allow decoding by standard url-decoders and
 * make the encoded urls more readable.
 *
 * \param[out] dest output string.  Must
 * \param[in] str The input string
 * \param[in] len  The length of the input string, excluding any
 *   final null byte.
 */
int modp_burl_min_encode(char* dest, const char* str, int len);

/** \brief get size of output string w/o doing actual encoding
 *
 * \param[in] src input string, not null
 * \param[in] len length of input string
 * \return length of output string NOT including any final null byte
 */
int modp_burl_min_encode_strlen(const char* src, const int len);

/**
 * Provides the maximum size for output string given
 * and input size of A bytes.
 */
#define modp_burl_encode_len(A) (3*A + 1)

/**
 * Given the exact size of output string.
 *
 * Can be used to allocate the right amount of memory for
 * modp_burl_encode.  Be sure to add 1 byte for final null.
 *
 * This is somewhat expensive since it examines every character
 *  in the input string
 *
 * \param[in] str  The input string
 * \param[in] len  THe length of the input string, excluding any
 *   final null byte (i.e. strlen(str))
 * \return the size of the output string, excluding the final
 *   null byte.
 */
int modp_burl_encode_strlen(const char* str, const int len);

/**
 * URL Decode a string
 *
 * \param[out] dest  The output string.  Must be at least (len + 1)
 *  bytes allocated.  This may be the same as the input buffer.
 * \param[in] str The input string that is URL encoded.
 * \param[in] len The length of the input string (excluding final
 *   null byte)
 * \return the strlen of the output string.
 */
int modp_burl_decode(char* dest, const char* str, int len);

/**
 * Returns memory required to decoded a url-encoded
 * string of length A.
 *
 */
#define modp_burl_decode_len(A) (A + 1)

END_C

#ifdef __cplusplus
#include <cstring>
#include <string>

namespace modp {

    inline std::string url_encode(const char* s, size_t len)
    {
        std::string x(modp_burl_encode_len(len), '\0');
        int d = modp_burl_encode(const_cast<char*>(x.data()), s, len);
        x.erase(d, std::string::npos);
        return x;
    }

    inline std::string url_encode(const char* s)
    {
        return url_encode(s, strlen(s));
    }

    inline std::string url_encode(const std::string& s)
    {
        return url_encode(s.data(), s.size());
    }

    /**
     * Standard (maximal) url encoding.
     *
     * \param[in,out] s the string to be encoded
     * \return a reference to the input string
     */
    inline std::string& url_encode(std::string& s)
    {
        std::string x(url_encode(s.data(), s.size()));
        s.swap(x);
        return s;
    }

    /**
     * Minimal Url Encoding
     *
     * \param[in,out] s the string to be encoded
     * \return a reference to the input string
     */
    inline std::string& url_min_encode(std::string& s)
    {
        std::string x(modp_burl_encode_len(s.size()), '\0');
        int d = modp_burl_min_encode(const_cast<char*>(x.data()), s.data(), s.size());
        x.erase(d, std::string::npos);
        s.swap(x);
        return s;
    }

    inline std::string url_min_encode(const std::string& s)
    {
        std::string x(modp_burl_encode_len(s.size()), '\0');
        int d = modp_burl_min_encode(const_cast<char*>(x.data()), s.data(), s.size());
        x.erase(d, std::string::npos);
        return x;
    }

    /**
     * Url decode a string.
     * This function does not allocate memory.
     *
     * \param[in,out] s the string to be decoded
     * \return a reference to the input string.
     *      There is no error case, bad characters are passed through
     */
    inline std::string& url_decode(std::string& s)
    {
        int d = modp_burl_decode(const_cast<char*>(s.data()), s.data(), s.size());
        s.erase(d, std::string::npos);
        return s;
    }

    inline std::string url_decode(const char* str)
    {
        std::string s(str);
        url_decode(s);
        return s;
    }

    inline std::string url_decode(const char* str, size_t len)
    {
        std::string s(str, len);
        url_decode(s);
        return s;
    }

    inline std::string url_decode(const std::string& s)
    {
        std::string x(s);
        url_decode(x);
        return x;
    }
}
#endif

#endif