Project

General

Profile

« Previous | Next » 

Revision 7796e554

Added by jahoti about 2 years ago

Add the beginnings of a test suite

View differences:

copyright
56 56
   2021 jahoti <jahoti@tilde.team>
57 57
License: GPL-2+
58 58

  
59
Files: test/proxy_core.py test/init.sh
60
Copyright: 2015, inaz2
61
   2021 jahoti <jahoti@tilde.team>
62
License: BSD-3
63
 Redistribution and use in source and binary forms, with or without
64
 modification, are permitted provided that the following conditions are met:
65
 .
66
 * Redistributions of source code must retain the above copyright notice, this
67
   list of conditions and the following disclaimer.
68
 .
69
 * Redistributions in binary form must reproduce the above copyright notice,
70
   this list of conditions and the following disclaimer in the documentation
71
   and/or other materials provided with the distribution.
72
 .
73
 * Neither the name of proxy2 nor the names of its
74
   contributors may be used to endorse or promote products derived from
75
   this software without specific prior written permission.
76
 .
77
 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
78
 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
79
 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
80
 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
81
 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
82
 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
83
 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
84
 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
85
 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
86
 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
87

  
59 88
Files: licenses/*
60 89
Copyright: 2001, 2002, 2011-2013 Creative Commons
61 90
License: CC-BY-4.0
......
68 97
License: CC0
69 98
 See `licenses/cc0.txt'
70 99

  
71
Files: licenses/gpl-2.txt licenses/gpl-3.0.txt
100
Files: licenses/gpl-2.txt licenses/gpl-3.0.txt licenses/agpl-3.0.txt
72 101
Copyright: 2007 Free Software Foundation, Inc. <https://fsf.org/>
73 102
License: no-changing
74 103
 Everyone is permitted to copy and distribute verbatim copies of
......
134 163

  
135 164
License: CC-BY-4.0
136 165
 See `licenses/cc-by-4.0.txt'
166

  
167
License: AGPL-3+
168
 This program is free software; you can redistribute it and/or modify
169
 it under the terms of the GNU Affero General Public License as
170
 published by the Free Software Foundation; either version 3 of
171
 the License, or (at your option) any later version.
172
 .
173
 This program is distributed in the hope that it will be useful,
174
 but WITHOUT ANY WARRANTY; without even the implied warranty of
175
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
176
 GNU Affero General Public License for more details.
177
 .
178
 You should have received a copy of the
179
 GNU Affero General Public License along with this program; if not,
180
 you can get it from  `https://www.gnu.org/licenses/agpl-3.0.html'.
licenses/agpl-3.0.txt
1
GNU AFFERO GENERAL PUBLIC LICENSE
2

  
3
Version 3, 19 November 2007
4

  
5
Copyright © 2007 Free Software Foundation, Inc. <http://fsf.org/>
6
Everyone is permitted to copy and distribute verbatim copies of this
7
license document, but changing it is not allowed.
8

  
9
Preamble
10

  
11
The GNU Affero General Public License is a free, copyleft license for
12
software and other kinds of works, specifically designed to ensure
13
cooperation with the community in the case of network server software.
14

  
15
The licenses for most software and other practical works are designed to
16
take away your freedom to share and change the works. By contrast, our
17
General Public Licenses are intended to guarantee your freedom to share and
18
change all versions of a program--to make sure it remains free software for
19
all its users.
20

  
21
When we speak of free software, we are referring to freedom, not price. Our
22
General Public Licenses are designed to make sure that you have the freedom
23
to distribute copies of free software (and charge for them if you wish),
24
that you receive source code or can get it if you want it, that you can
25
change the software or use pieces of it in new free programs, and that you
26
know you can do these things.
27

  
28
Developers that use our General Public Licenses protect your rights with
29
two steps: (1) assert copyright on the software, and (2) offer you this
30
License which gives you legal permission to copy, distribute and/or modify
31
the software.
32

  
33
A secondary benefit of defending all users' freedom is that improvements
34
made in alternate versions of the program, if they receive widespread use,
35
become available for other developers to incorporate. Many developers of
36
free software are heartened and encouraged by the resulting cooperation.
37
However, in the case of software used on network servers, this result may
38
fail to come about. The GNU General Public License permits making a
39
modified version and letting the public access it on a server without ever
40
releasing its source code to the public.
41

  
42
The GNU Affero General Public License is designed specifically to ensure
43
that, in such cases, the modified source code becomes available to the
44
community. It requires the operator of a network server to provide the
45
source code of the modified version running there to the users of that
46
server. Therefore, public use of a modified version, on a publicly
47
accessible server, gives the public access to the source code of the
48
modified version.
49

  
50
An older license, called the Affero General Public License and published by
51
Affero, was designed to accomplish similar goals. This is a different
52
license, not a version of the Affero GPL, but Affero has released a new
53
version of the Affero GPL which permits relicensing under this license.
54

  
55
The precise terms and conditions for copying, distribution and modification
56
follow.
57

  
58
TERMS AND CONDITIONS
59

  
60
0. Definitions.
61

  
62
"This License" refers to version 3 of the GNU Affero General Public
63
License.
64

  
65
"Copyright" also means copyright-like laws that apply to other kinds of
66
works, such as semiconductor masks.
67

  
68
"The Program" refers to any copyrightable work licensed under this License.
69
Each licensee is addressed as "you". "Licensees" and "recipients" may be
70
individuals or organizations.
71

  
72
To "modify" a work means to copy from or adapt all or part of the work in a
73
fashion requiring copyright permission, other than the making of an exact
74
copy. The resulting work is called a "modified version" of the earlier work
75
or a work "based on" the earlier work.
76

  
77
A "covered work" means either the unmodified Program or a work based on the
78
Program.
79

  
80
To "propagate" a work means to do anything with it that, without
81
permission, would make you directly or secondarily liable for infringement
82
under applicable copyright law, except executing it on a computer or
83
modifying a private copy. Propagation includes copying, distribution (with
84
or without modification), making available to the public, and in some
85
countries other activities as well.
86

  
87
To "convey" a work means any kind of propagation that enables other parties
88
to make or receive copies. Mere interaction with a user through a computer
89
network, with no transfer of a copy, is not conveying.
90

  
91
An interactive user interface displays "Appropriate Legal Notices" to the
92
extent that it includes a convenient and prominently visible feature that
93
(1) displays an appropriate copyright notice, and (2) tells the user that
94
there is no warranty for the work (except to the extent that warranties are
95
provided), that licensees may convey the work under this License, and how
96
to view a copy of this License. If the interface presents a list of user
97
commands or options, such as a menu, a prominent item in the list meets
98
this criterion.
99

  
100
1. Source Code.
101

  
102
The "source code" for a work means the preferred form of the work for
103
making modifications to it. "Object code" means any non-source form of a
104
work.
105

  
106
A "Standard Interface" means an interface that either is an official
107
standard defined by a recognized standards body, or, in the case of
108
interfaces specified for a particular programming language, one that is
109
widely used among developers working in that language.
110

  
111
The "System Libraries" of an executable work include anything, other than
112
the work as a whole, that (a) is included in the normal form of packaging a
113
Major Component, but which is not part of that Major Component, and (b)
114
serves only to enable use of the work with that Major Component, or to
115
implement a Standard Interface for which an implementation is available to
116
the public in source code form. A "Major Component", in this context, means
117
a major essential component (kernel, window system, and so on) of the
118
specific operating system (if any) on which the executable work runs, or a
119
compiler used to produce the work, or an object code interpreter used to
120
run it.
121

  
122
The "Corresponding Source" for a work in object code form means all the
123
source code needed to generate, install, and (for an executable work) run
124
the object code and to modify the work, including scripts to control those
125
activities. However, it does not include the work's System Libraries, or
126
general-purpose tools or generally available free programs which are used
127
unmodified in performing those activities but which are not part of the
128
work. For example, Corresponding Source includes interface definition files
129
associated with source files for the work, and the source code for shared
130
libraries and dynamically linked subprograms that the work is specifically
131
designed to require, such as by intimate data communication or control flow
132
between those subprograms and other parts of the work.
133

  
134
The Corresponding Source need not include anything that users can
135
regenerate automatically from other parts of the Corresponding Source.
136

  
137
The Corresponding Source for a work in source code form is that same work.
138

  
139
2. Basic Permissions.
140

  
141
All rights granted under this License are granted for the term of copyright
142
on the Program, and are irrevocable provided the stated conditions are met.
143
This License explicitly affirms your unlimited permission to run the
144
unmodified Program. The output from running a covered work is covered by
145
this License only if the output, given its content, constitutes a covered
146
work. This License acknowledges your rights of fair use or other
147
equivalent, as provided by copyright law.
148

  
149
You may make, run and propagate covered works that you do not convey,
150
without conditions so long as your license otherwise remains in force. You
151
may convey covered works to others for the sole purpose of having them make
152
modifications exclusively for you, or provide you with facilities for
153
running those works, provided that you comply with the terms of this
154
License in conveying all material for which you do not control copyright.
155
Those thus making or running the covered works for you must do so
156
exclusively on your behalf, under your direction and control, on terms that
157
prohibit them from making any copies of your copyrighted material outside
158
their relationship with you.
159

  
160
Conveying under any other circumstances is permitted solely under the
161
conditions stated below. Sublicensing is not allowed; section 10 makes it
162
unnecessary.
163

  
164
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
165

  
166
No covered work shall be deemed part of an effective technological measure
167
under any applicable law fulfilling obligations under article 11 of the
168
WIPO copyright treaty adopted on 20 December 1996, or similar laws
169
prohibiting or restricting circumvention of such measures.
170

  
171
When you convey a covered work, you waive any legal power to forbid
172
circumvention of technological measures to the extent such circumvention is
173
effected by exercising rights under this License with respect to the
174
covered work, and you disclaim any intention to limit operation or
175
modification of the work as a means of enforcing, against the work's users,
176
your or third parties' legal rights to forbid circumvention of
177
technological measures.
178

  
179
4. Conveying Verbatim Copies.
180

  
181
You may convey verbatim copies of the Program's source code as you receive
182
it, in any medium, provided that you conspicuously and appropriately
183
publish on each copy an appropriate copyright notice; keep intact all
184
notices stating that this License and any non-permissive terms added in
185
accord with section 7 apply to the code; keep intact all notices of the
186
absence of any warranty; and give all recipients a copy of this License
187
along with the Program.
188

  
189
You may charge any price or no price for each copy that you convey, and you
190
may offer support or warranty protection for a fee.
191

  
192
5. Conveying Modified Source Versions.
193

  
194
You may convey a work based on the Program, or the modifications to produce
195
it from the Program, in the form of source code under the terms of section
196
4, provided that you also meet all of these conditions:
197

  
198
  • a) The work must carry prominent notices stating that you modified it,
199
    and giving a relevant date.
200
  • b) The work must carry prominent notices stating that it is released
201
    under this License and any conditions added under section 7. This
202
    requirement modifies the requirement in section 4 to "keep intact all
203
    notices".
204
  • c) You must license the entire work, as a whole, under this License to
205
    anyone who comes into possession of a copy. This License will therefore
206
    apply, along with any applicable section 7 additional terms, to the
207
    whole of the work, and all its parts, regardless of how they are
208
    packaged. This License gives no permission to license the work in any
209
    other way, but it does not invalidate such permission if you have
210
    separately received it.
211
  • d) If the work has interactive user interfaces, each must display
212
    Appropriate Legal Notices; however, if the Program has interactive
213
    interfaces that do not display Appropriate Legal Notices, your work
214
    need not make them do so.
215

  
216
A compilation of a covered work with other separate and independent works,
217
which are not by their nature extensions of the covered work, and which are
218
not combined with it such as to form a larger program, in or on a volume of
219
a storage or distribution medium, is called an "aggregate" if the
220
compilation and its resulting copyright are not used to limit the access or
221
legal rights of the compilation's users beyond what the individual works
222
permit. Inclusion of a covered work in an aggregate does not cause this
223
License to apply to the other parts of the aggregate.
224

  
225
6. Conveying Non-Source Forms.
226

  
227
You may convey a covered work in object code form under the terms of
228
sections 4 and 5, provided that you also convey the machine-readable
229
Corresponding Source under the terms of this License, in one of these ways:
230

  
231
  • a) Convey the object code in, or embodied in, a physical product
232
    (including a physical distribution medium), accompanied by the
233
    Corresponding Source fixed on a durable physical medium customarily
234
    used for software interchange.
235
  • b) Convey the object code in, or embodied in, a physical product
236
    (including a physical distribution medium), accompanied by a written
237
    offer, valid for at least three years and valid for as long as you
238
    offer spare parts or customer support for that product model, to give
239
    anyone who possesses the object code either (1) a copy of the
240
    Corresponding Source for all the software in the product that is
241
    covered by this License, on a durable physical medium customarily used
242
    for software interchange, for a price no more than your reasonable cost
243
    of physically performing this conveying of source, or (2) access to
244
    copy the Corresponding Source from a network server at no charge.
245
  • c) Convey individual copies of the object code with a copy of the
246
    written offer to provide the Corresponding Source. This alternative is
247
    allowed only occasionally and noncommercially, and only if you received
248
    the object code with such an offer, in accord with subsection 6b.
249
  • d) Convey the object code by offering access from a designated place
250
    (gratis or for a charge), and offer equivalent access to the
251
    Corresponding Source in the same way through the same place at no
252
    further charge. You need not require recipients to copy the
253
    Corresponding Source along with the object code. If the place to copy
254
    the object code is a network server, the Corresponding Source may be on
255
    a different server (operated by you or a third party) that supports
256
    equivalent copying facilities, provided you maintain clear directions
257
    next to the object code saying where to find the Corresponding Source.
258
    Regardless of what server hosts the Corresponding Source, you remain
259
    obligated to ensure that it is available for as long as needed to
260
    satisfy these requirements.
261
  • e) Convey the object code using peer-to-peer transmission, provided you
262
    inform other peers where the object code and Corresponding Source of
263
    the work are being offered to the general public at no charge under
264
    subsection 6d.
265

  
266
A separable portion of the object code, whose source code is excluded from
267
the Corresponding Source as a System Library, need not be included in
268
conveying the object code work.
269

  
270
A "User Product" is either (1) a "consumer product", which means any
271
tangible personal property which is normally used for personal, family, or
272
household purposes, or (2) anything designed or sold for incorporation into
273
a dwelling. In determining whether a product is a consumer product,
274
doubtful cases shall be resolved in favor of coverage. For a particular
275
product received by a particular user, "normally used" refers to a typical
276
or common use of that class of product, regardless of the status of the
277
particular user or of the way in which the particular user actually uses,
278
or expects or is expected to use, the product. A product is a consumer
279
product regardless of whether the product has substantial commercial,
280
industrial or non-consumer uses, unless such uses represent the only
281
significant mode of use of the product.
282

  
283
"Installation Information" for a User Product means any methods,
284
procedures, authorization keys, or other information required to install
285
and execute modified versions of a covered work in that User Product from a
286
modified version of its Corresponding Source. The information must suffice
287
to ensure that the continued functioning of the modified object code is in
288
no case prevented or interfered with solely because modification has been
289
made.
290

  
291
If you convey an object code work under this section in, or with, or
292
specifically for use in, a User Product, and the conveying occurs as part
293
of a transaction in which the right of possession and use of the User
294
Product is transferred to the recipient in perpetuity or for a fixed term
295
(regardless of how the transaction is characterized), the Corresponding
296
Source conveyed under this section must be accompanied by the Installation
297
Information. But this requirement does not apply if neither you nor any
298
third party retains the ability to install modified object code on the User
299
Product (for example, the work has been installed in ROM).
300

  
301
The requirement to provide Installation Information does not include a
302
requirement to continue to provide support service, warranty, or updates
303
for a work that has been modified or installed by the recipient, or for the
304
User Product in which it has been modified or installed. Access to a
305
network may be denied when the modification itself materially and adversely
306
affects the operation of the network or violates the rules and protocols
307
for communication across the network.
308

  
309
Corresponding Source conveyed, and Installation Information provided, in
310
accord with this section must be in a format that is publicly documented
311
(and with an implementation available to the public in source code form),
312
and must require no special password or key for unpacking, reading or
313
copying.
314

  
315
7. Additional Terms.
316

  
317
"Additional permissions" are terms that supplement the terms of this
318
License by making exceptions from one or more of its conditions. Additional
319
permissions that are applicable to the entire Program shall be treated as
320
though they were included in this License, to the extent that they are
321
valid under applicable law. If additional permissions apply only to part of
322
the Program, that part may be used separately under those permissions, but
323
the entire Program remains governed by this License without regard to the
324
additional permissions.
325

  
326
When you convey a copy of a covered work, you may at your option remove any
327
additional permissions from that copy, or from any part of it. (Additional
328
permissions may be written to require their own removal in certain cases
329
when you modify the work.) You may place additional permissions on
330
material, added by you to a covered work, for which you have or can give
331
appropriate copyright permission.
332

  
333
Notwithstanding any other provision of this License, for material you add
334
to a covered work, you may (if authorized by the copyright holders of that
335
material) supplement the terms of this License with terms:
336

  
337
  • a) Disclaiming warranty or limiting liability differently from the
338
    terms of sections 15 and 16 of this License; or
339
  • b) Requiring preservation of specified reasonable legal notices or
340
    author attributions in that material or in the Appropriate Legal
341
    Notices displayed by works containing it; or
342
  • c) Prohibiting misrepresentation of the origin of that material, or
343
    requiring that modified versions of such material be marked in
344
    reasonable ways as different from the original version; or
345
  • d) Limiting the use for publicity purposes of names of licensors or
346
    authors of the material; or
347
  • e) Declining to grant rights under trademark law for use of some trade
348
    names, trademarks, or service marks; or
349
  • f) Requiring indemnification of licensors and authors of that material
350
    by anyone who conveys the material (or modified versions of it) with
351
    contractual assumptions of liability to the recipient, for any
352
    liability that these contractual assumptions directly impose on those
353
    licensors and authors.
354

  
355
All other non-permissive additional terms are considered "further
356
restrictions" within the meaning of section 10. If the Program as you
357
received it, or any part of it, contains a notice stating that it is
358
governed by this License along with a term that is a further restriction,
359
you may remove that term. If a license document contains a further
360
restriction but permits relicensing or conveying under this License, you
361
may add to a covered work material governed by the terms of that license
362
document, provided that the further restriction does not survive such
363
relicensing or conveying.
364

  
365
If you add terms to a covered work in accord with this section, you must
366
place, in the relevant source files, a statement of the additional terms
367
that apply to those files, or a notice indicating where to find the
368
applicable terms.
369

  
370
Additional terms, permissive or non-permissive, may be stated in the form
371
of a separately written license, or stated as exceptions; the above
372
requirements apply either way.
373

  
374
8. Termination.
375

  
376
You may not propagate or modify a covered work except as expressly provided
377
under this License. Any attempt otherwise to propagate or modify it is
378
void, and will automatically terminate your rights under this License
379
(including any patent licenses granted under the third paragraph of section
380
11).
381

  
382
However, if you cease all violation of this License, then your license from
383
a particular copyright holder is reinstated (a) provisionally, unless and
384
until the copyright holder explicitly and finally terminates your license,
385
and (b) permanently, if the copyright holder fails to notify you of the
386
violation by some reasonable means prior to 60 days after the cessation.
387

  
388
Moreover, your license from a particular copyright holder is reinstated
389
permanently if the copyright holder notifies you of the violation by some
390
reasonable means, this is the first time you have received notice of
391
violation of this License (for any work) from that copyright holder, and
392
you cure the violation prior to 30 days after your receipt of the notice.
393

  
394
Termination of your rights under this section does not terminate the
395
licenses of parties who have received copies or rights from you under this
396
License. If your rights have been terminated and not permanently
397
reinstated, you do not qualify to receive new licenses for the same
398
material under section 10.
399

  
400
9. Acceptance Not Required for Having Copies.
401

  
402
You are not required to accept this License in order to receive or run a
403
copy of the Program. Ancillary propagation of a covered work occurring
404
solely as a consequence of using peer-to-peer transmission to receive a
405
copy likewise does not require acceptance. However, nothing other than this
406
License grants you permission to propagate or modify any covered work.
407
These actions infringe copyright if you do not accept this License.
408
Therefore, by modifying or propagating a covered work, you indicate your
409
acceptance of this License to do so.
410

  
411
10. Automatic Licensing of Downstream Recipients.
412

  
413
Each time you convey a covered work, the recipient automatically receives a
414
license from the original licensors, to run, modify and propagate that
415
work, subject to this License. You are not responsible for enforcing
416
compliance by third parties with this License.
417

  
418
An "entity transaction" is a transaction transferring control of an
419
organization, or substantially all assets of one, or subdividing an
420
organization, or merging organizations. If propagation of a covered work
421
results from an entity transaction, each party to that transaction who
422
receives a copy of the work also receives whatever licenses to the work the
423
party's predecessor in interest had or could give under the previous
424
paragraph, plus a right to possession of the Corresponding Source of the
425
work from the predecessor in interest, if the predecessor has it or can get
426
it with reasonable efforts.
427

  
428
You may not impose any further restrictions on the exercise of the rights
429
granted or affirmed under this License. For example, you may not impose a
430
license fee, royalty, or other charge for exercise of rights granted under
431
this License, and you may not initiate litigation (including a cross-claim
432
or counterclaim in a lawsuit) alleging that any patent claim is infringed
433
by making, using, selling, offering for sale, or importing the Program or
434
any portion of it.
435

  
436
11. Patents.
437

  
438
A "contributor" is a copyright holder who authorizes use under this License
439
of the Program or a work on which the Program is based. The work thus
440
licensed is called the contributor's "contributor version".
441

  
442
A contributor's "essential patent claims" are all patent claims owned or
443
controlled by the contributor, whether already acquired or hereafter
444
acquired, that would be infringed by some manner, permitted by this
445
License, of making, using, or selling its contributor version, but do not
446
include claims that would be infringed only as a consequence of further
447
modification of the contributor version. For purposes of this definition,
448
"control" includes the right to grant patent sublicenses in a manner
449
consistent with the requirements of this License.
450

  
451
Each contributor grants you a non-exclusive, worldwide, royalty-free patent
452
license under the contributor's essential patent claims, to make, use,
453
sell, offer for sale, import and otherwise run, modify and propagate the
454
contents of its contributor version.
455

  
456
In the following three paragraphs, a "patent license" is any express
457
agreement or commitment, however denominated, not to enforce a patent (such
458
as an express permission to practice a patent or covenant not to sue for
459
patent infringement). To "grant" such a patent license to a party means to
460
make such an agreement or commitment not to enforce a patent against the
461
party.
462

  
463
If you convey a covered work, knowingly relying on a patent license, and
464
the Corresponding Source of the work is not available for anyone to copy,
465
free of charge and under the terms of this License, through a publicly
466
available network server or other readily accessible means, then you must
467
either (1) cause the Corresponding Source to be so available, or (2)
468
arrange to deprive yourself of the benefit of the patent license for this
469
particular work, or (3) arrange, in a manner consistent with the
470
requirements of this License, to extend the patent license to downstream
471
recipients. "Knowingly relying" means you have actual knowledge that, but
472
for the patent license, your conveying the covered work in a country, or
473
your recipient's use of the covered work in a country, would infringe one
474
or more identifiable patents in that country that you have reason to
475
believe are valid.
476

  
477
If, pursuant to or in connection with a single transaction or arrangement,
478
you convey, or propagate by procuring conveyance of, a covered work, and
479
grant a patent license to some of the parties receiving the covered work
480
authorizing them to use, propagate, modify or convey a specific copy of the
481
covered work, then the patent license you grant is automatically extended
482
to all recipients of the covered work and works based on it.
483

  
484
A patent license is "discriminatory" if it does not include within the
485
scope of its coverage, prohibits the exercise of, or is conditioned on the
486
non-exercise of one or more of the rights that are specifically granted
487
under this License. You may not convey a covered work if you are a party to
488
an arrangement with a third party that is in the business of distributing
489
software, under which you make payment to the third party based on the
490
extent of your activity of conveying the work, and under which the third
491
party grants, to any of the parties who would receive the covered work from
492
you, a discriminatory patent license (a) in connection with copies of the
493
covered work conveyed by you (or copies made from those copies), or (b)
494
primarily for and in connection with specific products or compilations that
495
contain the covered work, unless you entered into that arrangement, or that
496
patent license was granted, prior to 28 March 2007.
497

  
498
Nothing in this License shall be construed as excluding or limiting any
499
implied license or other defenses to infringement that may otherwise be
500
available to you under applicable patent law.
501

  
502
12. No Surrender of Others' Freedom.
503

  
504
If conditions are imposed on you (whether by court order, agreement or
505
otherwise) that contradict the conditions of this License, they do not
506
excuse you from the conditions of this License. If you cannot convey a
507
covered work so as to satisfy simultaneously your obligations under this
508
License and any other pertinent obligations, then as a consequence you may
509
not convey it at all. For example, if you agree to terms that obligate you
510
to collect a royalty for further conveying from those to whom you convey
511
the Program, the only way you could satisfy both those terms and this
512
License would be to refrain entirely from conveying the Program.
513

  
514
13. Remote Network Interaction; Use with the GNU General Public License.
515

  
516
Notwithstanding any other provision of this License, if you modify the
517
Program, your modified version must prominently offer all users interacting
518
with it remotely through a computer network (if your version supports such
519
interaction) an opportunity to receive the Corresponding Source of your
520
version by providing access to the Corresponding Source from a network
521
server at no charge, through some standard or customary means of
522
facilitating copying of software. This Corresponding Source shall include
523
the Corresponding Source for any work covered by version 3 of the GNU
524
General Public License that is incorporated pursuant to the following
525
paragraph.
526

  
527
Notwithstanding any other provision of this License, you have permission to
528
link or combine any covered work with a work licensed under version 3 of
529
the GNU General Public License into a single combined work, and to convey
530
the resulting work. The terms of this License will continue to apply to the
531
part which is the covered work, but the work with which it is combined will
532
remain governed by version 3 of the GNU General Public License.
533

  
534
14. Revised Versions of this License.
535

  
536
The Free Software Foundation may publish revised and/or new versions of the
537
GNU Affero General Public License from time to time. Such new versions will
538
be similar in spirit to the present version, but may differ in detail to
539
address new problems or concerns.
540

  
541
Each version is given a distinguishing version number. If the Program
542
specifies that a certain numbered version of the GNU Affero General Public
543
License "or any later version" applies to it, you have the option of
544
following the terms and conditions either of that numbered version or of
545
any later version published by the Free Software Foundation. If the Program
546
does not specify a version number of the GNU Affero General Public License,
547
you may choose any version ever published by the Free Software Foundation.
548

  
549
If the Program specifies that a proxy can decide which future versions of
550
the GNU Affero General Public License can be used, that proxy's public
551
statement of acceptance of a version permanently authorizes you to choose
552
that version for the Program.
553

  
554
Later license versions may give you additional or different permissions.
555
However, no additional obligations are imposed on any author or copyright
556
holder as a result of your choosing to follow a later version.
557

  
558
15. Disclaimer of Warranty.
559

  
560
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE
561
LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
562
OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND,
563
EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
564
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
565
ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.
566
SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY
567
SERVICING, REPAIR OR CORRECTION.
568

  
569
16. Limitation of Liability.
570

  
571
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL
572
ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE
573
PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
574
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
575
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
576
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
577
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
578
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
579
SUCH DAMAGES.
580

  
581
17. Interpretation of Sections 15 and 16.
582

  
583
If the disclaimer of warranty and limitation of liability provided above
584
cannot be given local legal effect according to their terms, reviewing
585
courts shall apply local law that most closely approximates an absolute
586
waiver of all civil liability in connection with the Program, unless a
587
warranty or assumption of liability accompanies a copy of the Program in
588
return for a fee.
589

  
590
END OF TERMS AND CONDITIONS
591

  
592
How to Apply These Terms to Your New Programs
593

  
594
If you develop a new program, and you want it to be of the greatest
595
possible use to the public, the best way to achieve this is to make it free
596
software which everyone can redistribute and change under these terms.
597

  
598
To do so, attach the following notices to the program. It is safest to
599
attach them to the start of each source file to most effectively state the
600
exclusion of warranty; and each file should have at least the "copyright"
601
line and a pointer to where the full notice is found.
602

  
603
    <one line to give the program's name and a brief idea of what it does.>
604
    Copyright (C) <year>  <name of author>
605

  
606
    This program is free software: you can redistribute it and/or modify
607
    it under the terms of the GNU Affero General Public License as
608
    published by the Free Software Foundation, either version 3 of the
609
    License, or (at your option) any later version.
610

  
611
    This program is distributed in the hope that it will be useful,
612
    but WITHOUT ANY WARRANTY; without even the implied warranty of
613
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
614
    GNU Affero General Public License for more details.
615

  
616
    You should have received a copy of the GNU Affero General Public License
617
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
618

  
619
Also add information on how to contact you by electronic and paper mail.
620

  
621
If your software can interact with users remotely through a computer
622
network, you should also make sure that it provides a way for users to get
623
its source. For example, if your program is a web application, its
624
interface could display a "Source" link that leads users to an archive of
625
the code. There are many ways you could offer source, and different
626
solutions will be better for different programs; see section 13 for the
627
specific requirements.
628

  
629
You should also get your employer (if you work as a programmer) or school,
630
if any, to sign a "copyright disclaimer" for the program, if necessary. For
631
more information on this, and how to apply and follow the GNU AGPL, see <
632
http://www.gnu.org/licenses/>.
633

  
test/init.sh
1
#!/bin/sh
2
#
3
# Copyright (c) 2015, inaz2
4
# Copyright (C) 2021 jahoti <jahoti@tilde.team>
5
# Licensing information is collated in the `copyright` file
6

  
7
# Initialize the root certificate for the tests proxy server
8
# Make sure this is run in the directory where they will be put!
9

  
10
openssl genrsa -out ca.key 2048
11
openssl genrsa -out cert.key 2048
12
openssl req -new -x509 -days 3650 -key ca.key -out ca.crt -subj "/CN=Hachette Test"
test/proxy_core.py
1
#!/usr/bin/env python3
2
#
3
# Copyright (c) 2015, inaz2
4
# Copyright (C) 2021 jahoti <jahoti@tilde.team>
5
# Licensing information is collated in the `copyright` file
6

  
7
"""
8
The core for a "virtual network" proxy
9

  
10
Be sure to run this inside your intended certificates directory.
11
"""
12

  
13
import os, socket, ssl, sys, threading, time
14
from http.server import HTTPServer, BaseHTTPRequestHandler
15
from socketserver import ThreadingMixIn
16
from subprocess import Popen, PIPE
17

  
18
gen_cert_req, lock = 'openssl req -new -key cert.key -subj /CN=%s', threading.Lock()
19
sign_cert_req = 'openssl x509 -req -days 3650 -CA ca.crt -CAkey ca.key -set_serial %d -out %s'
20

  
21

  
22
class ProxyRequestHandler(BaseHTTPRequestHandler):
23
	"""Handles a network request made to the proxy"""
24
	
25
	def log_error(self, format, *args):
26
		# suppress "Request timed out: timeout('timed out',)"
27
		if isinstance(args[0], socket.timeout):
28
			return
29

  
30
		self.log_message(format, *args)
31

  
32
	def do_CONNECT(self):
33
		hostname = self.path.split(':')[0]
34
		certpath = '%s.crt' % (hostname if hostname != 'ca' else 'CA')
35

  
36
		with lock:
37
			if not os.path.isfile(certpath):
38
				p1 = Popen((gen_cert_req % hostname).split(' '), stdout=PIPE).stdout
39
				Popen((sign_cert_req % (time.time() * 1000, certpath)).split(' '), stdin=p1, stderr=PIPE).communicate()
40

  
41
		self.wfile.write('HTTP/1.1 200 Connection Established\r\n')
42
		self.end_headers()
43

  
44
		self.connection = ssl.wrap_socket(self.connection, keyfile='cert.key', certfile=certpath, server_side=True)
45
		self.rfile = self.connection.makefile('rb', self.rbufsize)
46
		self.wfile = self.connection.makefile('wb', self.wbufsize)
47

  
48
		self.close_connection = int(self.headers.get('Proxy-Connection', '').lower() == 'close')
49

  
50
	def proxy(self):
51
		if self.path == 'http://hachette.test/':
52
			with open('ca.crt', 'rb') as f:
53
				data = f.read()
54

  
55
			self.wfile.write('HTTP/1.1 200 OK\r\n')
56
			self.send_header('Content-Type', 'application/x-x509-ca-cert')
57
			self.send_header('Content-Length', len(data))
58
			self.send_header('Connection', 'close')
59
			self.end_headers()
60
			self.wfile.write(data)
61
			return
62

  
63
		content_length = int(self.headers.get('Content-Length', 0))
64
		req_body = self.rfile.read(content_length) if content_length else None
65

  
66
		if self.path[0] == '/':
67
			if isinstance(self.connection, ssl.SSLSocket):
68
				self.path = 'https://%s%s' % (self.headers['Host'], self.path)
69
			else:
70
				self.path = 'http://%s%s' % (self.headers['Host'], self.path)
71

  
72
		self.handle_request(req_body)
73

  
74
	do_OPTIONS = do_DELETE = do_PUT = do_HEAD = do_POST = do_GET = proxy
75

  
76
	def handle_request(self, req_body):
77
		pass
78

  
79

  
80
class ThreadingHTTPServer(ThreadingMixIn, HTTPServer):
81
	"""The actual proxy server"""
82
	address_family, daemon_threads, handler = socket.AF_INET6, True, ProxyRequestHandler
83

  
84
	def handle_error(self, request, client_address):
85
		# suppress socket/ssl related errors
86
		cls, e = sys.exc_info()[:2]
87
		if not (cls is socket.error or cls is ssl.SSLError):
88
			return HTTPServer.handle_error(self, request, client_address)
89

  
90

  
91
def start(server_class, port=1337):
92
	"""Start up the proxy/server"""
93
	
94
	print('Serving HTTP Proxy')
95
	httpd = server_class(('::1', port), ProxyRequestHandler)
96
	httpd.serve_forever()

Also available in: Unified diff