forked from lexiforest/curl-impersonate
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcurl.patch
More file actions
11611 lines (11316 loc) · 406 KB
/
Copy pathcurl.patch
File metadata and controls
11611 lines (11316 loc) · 406 KB
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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
diff --git a/AGENTS.md b/AGENTS.md
new file mode 100644
index 0000000000..37a7786605
--- /dev/null
+++ b/AGENTS.md
@@ -0,0 +1,97 @@
+# Repository Guidelines
+
+## Project Structure & Module Organization
+`curl-chrome` follows curl's upstream layout.
+
+- `lib/`: libcurl core (protocols, connection logic, TLS in `lib/vtls/`, QUIC in `lib/vquic/`).
+- `src/`: curl CLI sources.
+- `include/curl/`: public headers installed for libcurl users.
+- `tests/`: regression and integration suites (`tests/data/`, `tests/libtest/`, `tests/unit/`, `tests/http/`).
+- `docs/`: user/developer docs (`docs/internals/` for contributor-facing internals).
+- `scripts/`: maintenance and lint helpers.
+- `CMake/` and top-level `CMakeLists.txt`: CMake build support.
+
+## Fork Delta (vs `curl-8_21_0`)
+Baseline check: `git diff --stat curl-8_21_0`.
+Current delta: **72 files changed, +7788/-462**.
+
+- Impersonation core: `lib/impersonate.c` + `lib/impersonate.h` with 38 preset targets (Chrome/Edge/Firefox/Safari/Tor/OkHttp variants).
+- Public API additions: `curl_easy_impersonate()` and new `CURLOPT_*` for TLS/HTTP2 fingerprints (`CURLOPT_IMPERSONATE`, `CURLOPT_HTTPBASEHEADER`, `CURLOPT_HTTP2_SETTINGS`, `CURLOPT_TLS_EXTENSION_ORDER`, etc.).
+- Tooling additions: `curl-impersonate` and tuning flags such as `--impersonate`, `--http2-pseudo-headers-order`, `--tls-permute-extensions`, and `--proxy-credential-no-reuse`.
+- Network behavior changes: HTTP/2 priority/pseudo-header ordering, browser-style header merge, WebSocket impersonation, HTTP/3 fingerprint switching, and QUIC-over-SOCKS5 UDP ASSOCIATE (`socks5h` included).
+- TLS/QUIC fingerprinting includes signature algorithms, extension order, ALPS codepoint selection, certificate compression, record/key-share limits, transport parameters, and session-cache separation for fingerprint-sensitive settings.
+- Build/package rename: artifacts are emitted as `curl-impersonate`, `libcurl-impersonate`, `curl-impersonate-config`, and `libcurl-impersonate.pc`.
+
+## Build, Test, and Development Commands
+
+Do not build unless the user explicitly requests it. The user normally builds
+and tests manually.
+
+The packaging build consumes this repository as a generated patch. Always
+propagate changes with `./export.sh`; never edit
+`../curl-impersonate/build/deps/src/curl` directly.
+
+```sh
+./export.sh
+cd ../curl-impersonate
+make build
+```
+
+An existing CMake ExternalProject source tree does not automatically reapply a
+changed patch. When a clean patch application is required, clean the generated
+outputs after exporting, then rebuild:
+
+```sh
+cd ../curl-impersonate
+make build CMAKE_BUILD_ARGS="--target clean"
+make build
+```
+
+## Coding Style & Naming Conventions
+- C code style is defined in `docs/internals/CODE_STYLE.md`.
+- Use spaces only, 2-space indentation, max 79 columns.
+- Keep to C89 style (`/* comments */`, not `//`).
+- Prefer clear lower-case names; make file-local helpers `static`.
+- Run `make checksrc` before submitting.
+
+## Testing Guidelines
+
+DO NOT TEST unless the user explicitly requests it; the user normally tests
+manually.
+
+## Commit & Pull Request Guidelines
+- Commit subject format: `[area]: short effect` (imperative, present tense, no trailing period).
+- Keep commit body wrapped at 72 columns and explain *why*.
+- Use relevant trailers when applicable: `Fixes #...`, `Closes #...`, `Ref: ...`, `Reviewed-by: ...`.
+- Keep PRs focused, include tests/docs updates for changed behavior, and ensure CI is green before requesting review.
+
+## Adding new options for impersonating
+
+For libcurl:
+
+- Add the field in `lib/impersonate.h` and preset values in
+ `lib/impersonate.c`.
+- Add `CURLOPT_XXX` in `include/curl/curl.h`.
+- Add storage in `lib/urldata.h`. For strings, also update `struct dupstring`.
+- Add the option to `lib/easyoptions.c` in alphabetical order and update the
+ option count at the end.
+- Implement it in `lib/setopt.c`: use `setopt_long` for integers/booleans and
+ `setopt_cptr` for strings.
+- Apply preset values in `lib/easy.c` and use `long` values for long options.
+- Implement protocol behavior in the appropriate layer, normally
+ `lib/vtls/openssl.c`, `lib/http2.c`, `lib/ws.c`, or `lib/vquic/`.
+- For TLS-affecting configuration, review copy, completeness, matching, free,
+ connection reuse, and session-cache key handling in `lib/vtls/`.
+
+For curl:
+
+- Add storage and cleanup in `src/tool_cfgable.h` and
+ `src/tool_cfgable.c`.
+- Add the option identifier in `src/tool_getparam.h`.
+- Add both the option-table entry and parser case in `src/tool_getparam.c`,
+ using the correct argument type such as `ARG_BOOL` or `ARG_STRG`.
+- Apply it in `src/config2setopts.c`. Use `my_setopt_long` for long/boolean
+ values and `MY_SETOPT_STR` for strings so errors are handled.
+- Touch `src/tool_operate.c` only when the option needs transfer-lifecycle
+ behavior; ordinary option application belongs in `config2setopts.c`.
+- Keep generated/help option lists in their required alphabetical order.
diff --git a/CMake/Macros.cmake b/CMake/Macros.cmake
index 953c1c6ee6..1174eb4181 100644
--- a/CMake/Macros.cmake
+++ b/CMake/Macros.cmake
@@ -45,7 +45,7 @@ macro(curl_internal_test _curl_test)
${PROJECT_BINARY_DIR}
"${CMAKE_CURRENT_SOURCE_DIR}/CMake/CurlTests.c"
COMPILE_DEFINITIONS "-D${_curl_test}" ${CURL_TEST_DEFINES} ${CMAKE_REQUIRED_FLAGS} ${CMAKE_REQUIRED_DEFINITIONS}
- LINK_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}"
+ LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}
OUTPUT_VARIABLE CURL_TEST_OUTPUT)
if(${_curl_test})
set(${_curl_test} 1 CACHE INTERNAL "curl test")
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e459b3d076..1bc3795713 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -153,8 +153,8 @@ if(CURL_PATCHSTAMP)
set(CURL_PATCHSTAMP "\"${CURL_PATCHSTAMP}\"")
endif()
-set(LIB_NAME "libcurl")
-set(EXE_NAME "curl")
+set(LIB_NAME "libcurl-impersonate")
+set(EXE_NAME "curl-impersonate")
set_property(DIRECTORY APPEND PROPERTY INCLUDE_DIRECTORIES "${PROJECT_SOURCE_DIR}/include")
@@ -858,9 +858,15 @@ if(CURL_USE_OPENSSL)
message(WARNING "AWS-LC/BoringSSL requires POSIX Threads.")
endif()
endif()
- if(OPENSSL_USE_STATIC_LIBS AND CMAKE_C_COMPILER_ID MATCHES "Clang")
- list(APPEND CURL_LIBS "stdc++")
- list(APPEND CMAKE_REQUIRED_LIBRARIES "stdc++")
+ if(OPENSSL_USE_STATIC_LIBS AND
+ CMAKE_C_COMPILER_ID MATCHES "Clang" AND NOT MSVC)
+ if(APPLE OR BSD OR ANDROID)
+ set(_cxx_runtime_lib "c++")
+ else()
+ set(_cxx_runtime_lib "stdc++")
+ endif()
+ list(APPEND CURL_LIBS "${_cxx_runtime_lib}")
+ list(APPEND CMAKE_REQUIRED_LIBRARIES "${_cxx_runtime_lib}")
endif()
endif()
@@ -2105,7 +2111,7 @@ endif()
if(NOT CURL_DISABLE_INSTALL)
- # curl-config needs the following options to be set.
+ # curl-impersonate-config needs the following options to be set.
set(CC "${CMAKE_C_COMPILER}")
set(CONFIGURE_OPTIONS "")
set(CURLVERSION "${_curl_version}")
@@ -2303,7 +2309,7 @@ if(NOT CURL_DISABLE_INSTALL)
set(ENABLE_STATIC "no")
endif()
- # Generate a "curl-config" matching this config.
+ # Generate a "curl-impersonate-config" matching this config.
# Consumed variables:
# CC
# CONFIGURE_OPTIONS
@@ -2325,8 +2331,8 @@ if(NOT CURL_DISABLE_INSTALL)
# VERSIONNUM
configure_file(
"${PROJECT_SOURCE_DIR}/curl-config.in"
- "${PROJECT_BINARY_DIR}/curl-config" @ONLY)
- install(FILES "${PROJECT_BINARY_DIR}/curl-config"
+ "${PROJECT_BINARY_DIR}/curl-impersonate-config" @ONLY)
+ install(FILES "${PROJECT_BINARY_DIR}/curl-impersonate-config"
DESTINATION ${CMAKE_INSTALL_BINDIR}
PERMISSIONS
OWNER_READ OWNER_WRITE OWNER_EXECUTE
@@ -2463,7 +2469,7 @@ if(NOT CURL_DISABLE_INSTALL)
endif()
if(BUILD_CURL_EXE)
- install(FILES "${PROJECT_SOURCE_DIR}/scripts/wcurl"
+ install(FILES "${PROJECT_SOURCE_DIR}/scripts/wcurl-impersonate"
DESTINATION ${CMAKE_INSTALL_BINDIR}
PERMISSIONS
OWNER_READ OWNER_WRITE OWNER_EXECUTE
diff --git a/Makefile.am b/Makefile.am
index 83fdadf035..c2224a74fe 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -68,13 +68,13 @@ EXTRA_DIST = CHANGES.md COPYING RELEASE-NOTES Dockerfile .clang-tidy.yml .editor
DISTCLEANFILES = buildinfo.txt
-bin_SCRIPTS = curl-config
+bin_SCRIPTS = curl-impersonate-config
SUBDIRS = lib docs src scripts
DIST_SUBDIRS = $(SUBDIRS) tests projects include docs
pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = libcurl.pc
+pkgconfig_DATA = libcurl-impersonate.pc
dist-hook:
rm -rf $(top_builddir)/tests/log
diff --git a/configure.ac b/configure.ac
index a21847ea66..c39b6f4726 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1631,7 +1631,11 @@ if test "x$OPT_BROTLI" != "xno"; then
CPPFLAGS="$CPPFLAGS $CPP_BROTLI"
LIBS="$LIB_BROTLI $LIBS"
- AC_CHECK_LIB(brotlidec, BrotliDecoderDecompress)
+ AC_CHECK_LIB(brotlidec, BrotliDecoderDecompress,
+ # curl-impersonate: Define 'action-if-found' explicitly to prevent
+ # -lbrotlidec from being added to LIBS (already added before)
+ AC_DEFINE(HAVE_LIBBROTLI, 1, [Define to 1 if libbrotli exists])
+ )
AC_CHECK_HEADERS(brotli/decode.h,
curl_brotli_msg="enabled (libbrotlidec)"
@@ -5447,6 +5451,8 @@ SUPPORT_PROTOCOLS=`echo $SUPPORT_PROTOCOLS | tr ' ' '\012' | sort | tr '\012' '
AC_SUBST(SUPPORT_PROTOCOLS)
+AC_CHECK_FUNCS([SSL_set_alps_use_new_codepoint])
+
dnl squeeze whitespace out of some variables
squeeze CFLAGS
@@ -5495,9 +5501,10 @@ AC_CONFIG_FILES([\
tests/http/Makefile \
projects/Makefile \
projects/vms/Makefile \
- libcurl.pc
+ libcurl-impersonate.pc:libcurl.pc.in
])
-AC_CONFIG_FILES([curl-config], [chmod +x curl-config])
+AC_CONFIG_FILES([curl-impersonate-config:curl-config.in],
+ [chmod +x curl-impersonate-config])
AC_OUTPUT
SUPPORT_PROTOCOLS_LOWER=`echo "$SUPPORT_PROTOCOLS" | tr A-Z a-z`
diff --git a/curl-config.in b/curl-config.in
index a1c8185875..b64f79a926 100644
--- a/curl-config.in
+++ b/curl-config.in
@@ -155,9 +155,9 @@ while test "$#" -gt 0; do
curllibdir=''
fi
if test '@ENABLE_SHARED@' = 'no'; then
- echo "${curllibdir}-lcurl @LIBCURL_PC_LIBS_PRIVATE@"
+ echo "${curllibdir}-lcurl-impersonate @LIBCURL_PC_LIBS_PRIVATE@"
else
- echo "${curllibdir}-lcurl"
+ echo "${curllibdir}-lcurl-impersonate"
fi
;;
@@ -167,7 +167,7 @@ while test "$#" -gt 0; do
--static-libs)
if test '@ENABLE_STATIC@' != 'no'; then
- echo "@libdir@/libcurl.@libext@ @LIBCURL_PC_LDFLAGS_PRIVATE@ @LIBCURL_PC_LIBS_PRIVATE@"
+ echo "@libdir@/libcurl-impersonate.@libext@ @LIBCURL_PC_LDFLAGS_PRIVATE@ @LIBCURL_PC_LIBS_PRIVATE@"
else
echo 'curl was built with static libraries disabled' >&2
exit 1
diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt
index 9c02530193..79395d0e55 100644
--- a/docs/CMakeLists.txt
+++ b/docs/CMakeLists.txt
@@ -32,7 +32,7 @@ endif()
if(BUILD_MISC_DOCS)
set(_man_targets "curl-config" "mk-ca-bundle")
if(BUILD_CURL_EXE)
- list(APPEND _man_targets "wcurl")
+ list(APPEND _man_targets "wcurl-impersonate")
endif()
foreach(_man_misc IN LISTS _man_targets)
diff --git a/docs/Makefile.am b/docs/Makefile.am
index fdc4511b5c..f0857aaeef 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -28,10 +28,10 @@ if BUILD_DOCS
# if we disable man page building, ignore these
MK_CA_DOCS = mk-ca-bundle.1
CURLCONF_DOCS = curl-config.1
-man_MANS = curl-config.1 wcurl.1
+man_MANS = curl-config.1 wcurl-impersonate.1
endif
-CURLPAGES = curl-config.md mk-ca-bundle.md wcurl.md runtests.md testcurl.md
+CURLPAGES = curl-config.md mk-ca-bundle.md wcurl-impersonate.md runtests.md testcurl.md
SUBDIRS = . cmdline-opts libcurl
DIST_SUBDIRS = $(SUBDIRS) examples
@@ -150,7 +150,7 @@ curl-config.1: curl-config.md
mk-ca-bundle.1: mk-ca-bundle.md
-wcurl.1: wcurl.md
+wcurl-impersonate.1: wcurl-impersonate.md
distclean:
rm -f $(CLEANFILES)
diff --git a/docs/libcurl/curl_easy_getinfo.md b/docs/libcurl/curl_easy_getinfo.md
index 6fc5555b38..fcd0c3adf4 100644
--- a/docs/libcurl/curl_easy_getinfo.md
+++ b/docs/libcurl/curl_easy_getinfo.md
@@ -250,6 +250,11 @@ CURLINFO_QUEUE_TIME_T(3)
Total number of redirects that were followed. See CURLINFO_REDIRECT_COUNT(3)
+## CURLINFO_REDIRECT_HISTORY
+
+Status codes and request URLs for redirects followed during the latest
+transfer. See CURLINFO_REDIRECT_HISTORY(3)
+
## CURLINFO_REDIRECT_TIME
The time it took for all redirection steps include name lookup, connect,
diff --git a/docs/libcurl/opts/CURLINFO_REDIRECT_HISTORY.md b/docs/libcurl/opts/CURLINFO_REDIRECT_HISTORY.md
new file mode 100644
index 0000000000..c1429c6c01
--- /dev/null
+++ b/docs/libcurl/opts/CURLINFO_REDIRECT_HISTORY.md
@@ -0,0 +1,87 @@
+---
+c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
+SPDX-License-Identifier: curl
+Title: CURLINFO_REDIRECT_HISTORY
+Section: 3
+Source: libcurl
+See-also:
+ - CURLINFO_EFFECTIVE_URL (3)
+ - CURLINFO_REDIRECT_COUNT (3)
+ - CURLINFO_RESPONSE_CODE (3)
+ - CURLOPT_FOLLOWLOCATION (3)
+ - curl_easy_getinfo (3)
+ - curl_slist_free_all (3)
+Protocol:
+ - HTTP
+Added-in: 8.21.0
+---
+
+# NAME
+
+CURLINFO_REDIRECT_HISTORY - get followed HTTP redirect responses
+
+# SYNOPSIS
+
+~~~c
+#include <curl/curl.h>
+
+CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_REDIRECT_HISTORY,
+ struct curl_slist **historyp);
+~~~
+
+# DESCRIPTION
+
+Pass a pointer to a *struct curl_slist * to receive the HTTP redirect
+responses followed during the latest transfer, in request order.
+
+Each list item uses this format, separated by a single ASCII tab:
+
+~~~text
+<status-code>\t<url>
+~~~
+
+The URL is the request URL that returned the status code. The final response
+is not part of the history; retrieve its URL with CURLINFO_EFFECTIVE_URL(3)
+and its status with CURLINFO_RESPONSE_CODE(3). Authentication challenges and
+automatic transport retries are not included.
+
+The returned list is newly allocated. The application must free it with
+curl_slist_free_all(3). If no redirects were followed, the returned list is
+NULL.
+
+# %PROTOCOLS%
+
+# EXAMPLE
+
+~~~c
+int main(void)
+{
+ CURL *curl = curl_easy_init();
+ if(curl) {
+ CURLcode result;
+ curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
+ curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
+ result = curl_easy_perform(curl);
+ if(result == CURLE_OK) {
+ struct curl_slist *history;
+ result = curl_easy_getinfo(curl, CURLINFO_REDIRECT_HISTORY, &history);
+ if(result == CURLE_OK) {
+ struct curl_slist *item;
+ for(item = history; item; item = item->next)
+ printf("%s\n", item->data);
+ curl_slist_free_all(history);
+ }
+ }
+ curl_easy_cleanup(curl);
+ }
+}
+~~~
+
+# %AVAILABILITY%
+
+# RETURN VALUE
+
+curl_easy_getinfo(3) returns a CURLcode indicating success or error.
+
+CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
+libcurl-errors(3).
diff --git a/docs/libcurl/opts/Makefile.inc b/docs/libcurl/opts/Makefile.inc
index 1eb628b800..fbf28a21e6 100644
--- a/docs/libcurl/opts/Makefile.inc
+++ b/docs/libcurl/opts/Makefile.inc
@@ -71,6 +71,7 @@ man_MANS = \
CURLINFO_PROXYAUTH_USED.3 \
CURLINFO_QUEUE_TIME_T.3 \
CURLINFO_REDIRECT_COUNT.3 \
+ CURLINFO_REDIRECT_HISTORY.3 \
CURLINFO_REDIRECT_TIME.3 \
CURLINFO_REDIRECT_TIME_T.3 \
CURLINFO_REDIRECT_URL.3 \
diff --git a/docs/libcurl/symbols-in-versions b/docs/libcurl/symbols-in-versions
index 5bad9a9842..60c8a40b9f 100644
--- a/docs/libcurl/symbols-in-versions
+++ b/docs/libcurl/symbols-in-versions
@@ -480,6 +480,7 @@ CURLINFO_PROXYAUTH_USED 8.12.0
CURLINFO_PTR 7.54.1
CURLINFO_QUEUE_TIME_T 8.6.0
CURLINFO_REDIRECT_COUNT 7.9.7
+CURLINFO_REDIRECT_HISTORY 8.21.0
CURLINFO_REDIRECT_TIME 7.9.7
CURLINFO_REDIRECT_TIME_T 7.61.0
CURLINFO_REDIRECT_URL 7.18.2
diff --git a/docs/wcurl-impersonate.md b/docs/wcurl-impersonate.md
new file mode 100644
index 0000000000..b285a0fc9e
--- /dev/null
+++ b/docs/wcurl-impersonate.md
@@ -0,0 +1,160 @@
+---
+c: Copyright (C) Samuel Henrique <samueloph@debian.org>, Sergio Durigan Junior <sergiodj@debian.org> and many contributors, see the AUTHORS file.
+SPDX-License-Identifier: curl
+Title: wcurl-impersonate
+Section: 1
+Source: wcurl-impersonate
+See-also:
+ - curl (1)
+ - trurl (1)
+Added-in: n/a
+---
+
+# NAME
+
+**wcurl-impersonate** - a simple wrapper around curl-impersonate to easily
+download files.
+
+# SYNOPSIS
+
+**wcurl-impersonate \<URL\>...**
+
+**wcurl-impersonate [--curl-options \<CURL_OPTIONS\>]... [--dry-run] [--no-decode-filename] [-o|-O|--output \<PATH\>] [--] \<URL\>...**
+
+**wcurl-impersonate [--curl-options=\<CURL_OPTIONS\>]... [--dry-run] [--no-decode-filename] [--output=\<PATH\>] [--] \<URL\>...**
+
+**wcurl-impersonate -V|--version**
+
+**wcurl-impersonate -h|--help**
+
+# DESCRIPTION
+
+**wcurl-impersonate** is a simple curl wrapper which lets you use
+curl-impersonate to download files without having to remember any parameters.
+
+Call **wcurl-impersonate** with a list of URLs you want to download and
+**wcurl-impersonate** picks sane defaults.
+
+If you need anything more complex, you can provide any of curl-impersonate's
+supported parameters via the **--curl-options** option. Beware that you likely
+should be using curl-impersonate directly if your use case is not covered.
+
+By default, **wcurl-impersonate** does:
+
+## * Percent-encode whitespace in URLs;
+
+## * Download multiple URLs in parallel
+ if the installed curl-impersonate's version is \>= 7.66.0 (--parallel);
+
+## * Use a total number of 5 parallel connections to the same protocol + hostname + port number target
+ if the installed curl-impersonate's version is \>= 8.16.0 (--parallel-max-host);
+
+## * Follow redirects;
+
+## * Automatically choose a filename as output;
+
+## * Avoid overwriting files
+ if the installed curl-impersonate's version is \>= 7.83.0 (--no-clobber);
+
+## * Perform retries;
+
+## * Set the downloaded file timestamp
+ to the value provided by the server, if available;
+
+## * Default to https
+ if the URL does not contain any scheme;
+
+## * Disable curl-impersonate's URL globbing parser
+ so {} and [] characters in URLs are not treated specially;
+
+## * Percent-decode the resulting filename;
+
+## * Use 'index.html' as the default filename
+ if there is none in the URL.
+
+# OPTIONS
+
+## --curl-options, --curl-options=\<CURL_OPTIONS\>...
+
+Specify extra options to be passed when invoking curl-impersonate. May be
+specified more than once.
+
+## -o, -O, --output, --output=\<PATH\>
+
+Use the provided output path instead of getting it from the URL. If multiple
+URLs are provided, resulting files share the same name with a number appended to
+the end (curl-impersonate \>= 7.83.0). If this option is provided multiple
+times, only the last value is considered.
+
+## --no-decode-filename
+
+Do not percent-decode the output filename, even if the percent-encoding in the
+URL was done by **wcurl-impersonate**, e.g.: The URL contained whitespace.
+
+## --dry-run
+
+Do not actually execute curl-impersonate, print what would be invoked.
+
+## -V, \--version
+
+Print version information.
+
+## -h, \--help
+
+Print help message.
+
+# CURL_OPTIONS
+
+Any option supported by curl-impersonate can be set here. This is not used by
+**wcurl-impersonate**; it is instead forwarded to the curl-impersonate
+invocation.
+
+# URL
+
+URL to be downloaded. Anything that is not a parameter is considered
+an URL. Whitespace is percent-encoded and the URL is passed to
+curl-impersonate, which then performs the parsing. May be specified more than
+once.
+
+# EXAMPLES
+
+Download a single file:
+
+**wcurl-impersonate example.com/filename.txt**
+
+Download two files in parallel:
+
+**wcurl-impersonate example.com/filename1.txt example.com/filename2.txt**
+
+Download a file passing the **--progress-bar** and **--http2** flags to
+curl-impersonate:
+
+**wcurl-impersonate --curl-options="--progress-bar --http2" example.com/filename.txt**
+
+Resume from an interrupted download. The options necessary to resume the
+download (`--clobber --continue-at -`) must be the **last** options specified in
+`--curl-options`. Note that the only way to resume interrupted downloads is to
+allow wcurl-impersonate to overwrite the destination file:
+
+**wcurl-impersonate --curl-options="--clobber --continue-at -" example.com/filename.txt**
+
+Download multiple files without a limit of concurrent connections per host
+(the default limit is 5):
+
+**wcurl-impersonate --curl-options="--parallel-max-host 0" example.com/filename1.txt example.com/filename2.txt**
+
+# AUTHORS
+
+ Samuel Henrique \<samueloph@debian.org\>
+ Sergio Durigan Junior \<sergiodj@debian.org\>
+ and many contributors, see the AUTHORS file.
+
+# REPORTING BUGS
+
+If you experience any problems with **wcurl-impersonate** that you do not
+experience with curl-impersonate, submit an issue on GitHub:
+https://github.com/curl/wcurl
+
+# COPYRIGHT
+
+**wcurl-impersonate** is licensed under the curl license
diff --git a/docs/wcurl.md b/docs/wcurl.md
deleted file mode 100644
index f0ed42baf2..0000000000
--- a/docs/wcurl.md
+++ /dev/null
@@ -1,154 +0,0 @@
----
-c: Copyright (C) Samuel Henrique <samueloph@debian.org>, Sergio Durigan Junior <sergiodj@debian.org> and many contributors, see the AUTHORS file.
-SPDX-License-Identifier: curl
-Title: wcurl
-Section: 1
-Source: wcurl
-See-also:
- - curl (1)
- - trurl (1)
-Added-in: n/a
----
-
-# NAME
-
-**wcurl** - a simple wrapper around curl to easily download files.
-
-# SYNOPSIS
-
-**wcurl \<URL\>...**
-
-**wcurl [--curl-options \<CURL_OPTIONS\>]... [--dry-run] [--no-decode-filename] [-o|-O|--output \<PATH\>] [--] \<URL\>...**
-
-**wcurl [--curl-options=\<CURL_OPTIONS\>]... [--dry-run] [--no-decode-filename] [--output=\<PATH\>] [--] \<URL\>...**
-
-**wcurl -V|--version**
-
-**wcurl -h|--help**
-
-# DESCRIPTION
-
-**wcurl** is a simple curl wrapper which lets you use curl to download files
-without having to remember any parameters.
-
-Call **wcurl** with a list of URLs you want to download and **wcurl**
-picks sane defaults.
-
-If you need anything more complex, you can provide any of curl's supported
-parameters via the **--curl-options** option. Beware that you likely should be
-using curl directly if your use case is not covered.
-
-By default, **wcurl** does:
-
-## * Percent-encode whitespace in URLs;
-
-## * Download multiple URLs in parallel
- if the installed curl's version is \>= 7.66.0 (--parallel);
-
-## * Use a total number of 5 parallel connections to the same protocol + hostname + port number target
- if the installed curl's version is \>= 8.16.0 (--parallel-max-host);
-
-## * Follow redirects;
-
-## * Automatically choose a filename as output;
-
-## * Avoid overwriting files
- if the installed curl's version is \>= 7.83.0 (--no-clobber);
-
-## * Perform retries;
-
-## * Set the downloaded file timestamp
- to the value provided by the server, if available;
-
-## * Default to https
- if the URL does not contain any scheme;
-
-## * Disable curl's URL globbing parser
- so {} and [] characters in URLs are not treated specially;
-
-## * Percent-decode the resulting filename;
-
-## * Use 'index.html' as the default filename
- if there is none in the URL.
-
-# OPTIONS
-
-## --curl-options, --curl-options=\<CURL_OPTIONS\>...
-
-Specify extra options to be passed when invoking curl. May be specified more
-than once.
-
-## -o, -O, --output, --output=\<PATH\>
-
-Use the provided output path instead of getting it from the URL. If multiple
-URLs are provided, resulting files share the same name with a number appended to
-the end (curl \>= 7.83.0). If this option is provided multiple times, only the
-last value is considered.
-
-## --no-decode-filename
-
-Do not percent-decode the output filename, even if the percent-encoding in the
-URL was done by **wcurl**, e.g.: The URL contained whitespace.
-
-## --dry-run
-
-Do not actually execute curl, print what would be invoked.
-
-## -V, \--version
-
-Print version information.
-
-## -h, \--help
-
-Print help message.
-
-# CURL_OPTIONS
-
-Any option supported by curl can be set here. This is not used by **wcurl**; it
-is instead forwarded to the curl invocation.
-
-# URL
-
-URL to be downloaded. Anything that is not a parameter is considered
-an URL. Whitespace is percent-encoded and the URL is passed to curl, which
-then performs the parsing. May be specified more than once.
-
-# EXAMPLES
-
-Download a single file:
-
-**wcurl example.com/filename.txt**
-
-Download two files in parallel:
-
-**wcurl example.com/filename1.txt example.com/filename2.txt**
-
-Download a file passing the **--progress-bar** and **--http2** flags to curl:
-
-**wcurl --curl-options="--progress-bar --http2" example.com/filename.txt**
-
-Resume from an interrupted download. The options necessary to resume the download
-(`--clobber --continue-at -`) must be the **last** options specified in `--curl-options`.
-Note that the only way to resume interrupted downloads is to allow wcurl to overwrite
-the destination file:
-
-**wcurl --curl-options="--clobber --continue-at -" example.com/filename.txt**
-
-Download multiple files without a limit of concurrent connections per host (the default limit is 5):
-
-**wcurl --curl-options="--parallel-max-host 0" example.com/filename1.txt example.com/filename2.txt**
-
-# AUTHORS
-
- Samuel Henrique \<samueloph@debian.org\>
- Sergio Durigan Junior \<sergiodj@debian.org\>
- and many contributors, see the AUTHORS file.
-
-# REPORTING BUGS
-
-If you experience any problems with **wcurl** that you do not experience with
-curl, submit an issue on GitHub: https://github.com/curl/wcurl
-
-# COPYRIGHT
-
-**wcurl** is licensed under the curl license
diff --git a/export.sh b/export.sh
new file mode 100755
index 0000000000..bc1a07122f
--- /dev/null
+++ b/export.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+# TODO: use cmake to generate mingw makefile, see:
+#
+# 1. https://github.com/curl/curl/pull/13244/files
+# 2. https://everything.curl.dev/build/windows.html
+
+git df curl-8_21_0 -- . ':(exclude)tests/**' > chrome.patch
+mv chrome.patch ../curl-impersonate/patches/curl.patch
diff --git a/include/curl/curl.h b/include/curl/curl.h
index 7e59e43c4d..0310d464e7 100644
--- a/include/curl/curl.h
+++ b/include/curl/curl.h
@@ -185,6 +185,10 @@ typedef enum {
/* Only use the custom method in the first request, always reset in the next */
#define CURLFOLLOW_FIRSTONLY 3L
+/* curl-impersonate: Follow redirects, but reject redirects to
+ internal/private IP addresses (SSRF protection) */
+#define CURLFOLLOW_SAFE 4L
+
struct curl_httppost {
struct curl_httppost *next; /* next entry in the list */
char *name; /* pointer to allocated name */
@@ -2262,6 +2266,153 @@ typedef enum {
/* set TLS supported signature algorithms */
CURLOPT(CURLOPT_SSL_SIGNATURE_ALGORITHMS, CURLOPTTYPE_STRINGPOINT, 328),
+ /* curl-impersonate: The master option for setting an impersonate target.
+ * Impersonation target format is "name[:yes|no]".
+ * The optional suffix controls default browser headers. */
+ CURLOPT(CURLOPT_IMPERSONATE, CURLOPTTYPE_STRINGPOINT, 999),
+
+ /* curl-impersonate: A list of headers used by the impersonated browser.
+ * If given, merged with CURLOPT_HTTPHEADER. */
+ CURLOPT(CURLOPT_HTTPBASEHEADER, CURLOPTTYPE_SLISTPOINT, 1000),
+
+ /* curl-impersonate: A list of TLS signature hash algorithms.
+ * This has been implemented by curl as option 328, but we will keep it for compatibility.
+ * See https://datatracker.ietf.org/doc/html/rfc5246#section-7.4.1.4.1 */
+ CURLOPT(CURLOPT_SSL_SIG_HASH_ALGS, CURLOPTTYPE_STRINGPOINT, 1001),
+
+ /* curl-impersonate: Whether to enable ALPS in TLS or not.
+ * See https://datatracker.ietf.org/doc/html/draft-vvv-tls-alps.
+ * Support for ALPS is minimal and is intended only for the TLS client
+ * hello to match. */
+ CURLOPT(CURLOPT_SSL_ENABLE_ALPS, CURLOPTTYPE_LONG, 1002),
+
+ /* curl-impersonate: Comma-separated list of certificate compression
+ * algorithms to use. These are published in the client hello.
+ * Supported algorithms are "zlib" and "brotli".
+ * See https://datatracker.ietf.org/doc/html/rfc8879 */
+ CURLOPT(CURLOPT_SSL_CERT_COMPRESSION, CURLOPTTYPE_STRINGPOINT, 1003),
+
+ /* Enable/disable TLS session ticket extension (RFC5077) */
+ CURLOPT(CURLOPT_SSL_ENABLE_TICKET, CURLOPTTYPE_LONG, 1004),
+
+ /*
+ * curl-impersonate:
+ * Set the order of the HTTP/2 pseudo headers. The value must contain
+ * the letters 'm', 'a', 's', 'p' representing the pseudo-headers
+ * ":method", ":authority", ":scheme", ":path" in the desired order of
+ * appearance in the HTTP/2 HEADERS frame.
+ */
+ CURLOPT(CURLOPT_HTTP2_PSEUDO_HEADERS_ORDER, CURLOPTTYPE_STRINGPOINT, 1005),
+
+ /* curl-impersonate: HTTP2 settings frame keys and values, format: 1:v;2:v;3:v */
+ CURLOPT(CURLOPT_HTTP2_SETTINGS, CURLOPTTYPE_STRINGPOINT, 1006),
+
+ /*
+ * curl-impersonate: Whether to enable Boringssl permute extensions
+ * See https://commondatastorage.googleapis.com/chromium-boringssl-docs/ssl.h.html#SSL_set_permute_extensions.
+ */
+ CURLOPT(CURLOPT_SSL_PERMUTE_EXTENSIONS, CURLOPTTYPE_LONG, 1007),
+
+ /* curl-impersonate: HTTP2 initial window update */
+ CURLOPT(CURLOPT_HTTP2_WINDOW_UPDATE, CURLOPTTYPE_LONG, 1008),
+
+ /* curl-impersonate: Set the initial streams settings for http2. */
+ CURLOPT(CURLOPT_HTTP2_STREAMS, CURLOPTTYPE_STRINGPOINT, 1010),
+
+ /* curl-impersonate: enable tls grease */
+ CURLOPT(CURLOPT_TLS_GREASE, CURLOPTTYPE_LONG, 1011),
+
+ /* curl-impersonate: set tls extension order */
+ CURLOPT(CURLOPT_TLS_EXTENSION_ORDER, CURLOPTTYPE_STRINGPOINT, 1012),
+
+ /* curl-impersonate: Set stream exclusiveness, 0 or 1 */
+ CURLOPT(CURLOPT_STREAM_EXCLUSIVE, CURLOPTTYPE_LONG, 1013),
+
+ /* curl-impersonate: enable tls key usage check, defaults: on */
+ CURLOPT(CURLOPT_TLS_KEY_USAGE_NO_CHECK, CURLOPTTYPE_LONG, 1014),
+
+ /* curl-impersonate: enable tls signed cert stamps */
+ CURLOPT(CURLOPT_TLS_SIGNED_CERT_TIMESTAMPS, CURLOPTTYPE_LONG, 1015),
+
+ /* curl-impersonate: enable tls status request */
+ CURLOPT(CURLOPT_TLS_STATUS_REQUEST, CURLOPTTYPE_LONG, 1016),
+
+ /* curl-impersonate: firefox delegated credentials */
+ CURLOPT(CURLOPT_TLS_DELEGATED_CREDENTIALS, CURLOPTTYPE_STRINGPOINT, 1017),
+
+ /* curl-impersonate: firefox record size limit */
+ CURLOPT(CURLOPT_TLS_RECORD_SIZE_LIMIT, CURLOPTTYPE_LONG, 1018),
+
+ /* curl-impersonate: firefox key_shares_limit */
+ CURLOPT(CURLOPT_TLS_KEY_SHARES_LIMIT, CURLOPTTYPE_LONG, 1019),
+
+ /* curl-impersonate: Use the new ALPS code point */
+ CURLOPT(CURLOPT_TLS_USE_NEW_ALPS_CODEPOINT, CURLOPTTYPE_LONG, 1020),
+
+ /* curl-impersonate: Do not set the priority bit in http2 header frame */
+ CURLOPT(CURLOPT_HTTP2_NO_PRIORITY, CURLOPTTYPE_LONG, 1021),
+
+ /* curl-impersonate: Do not reuse TLS sessions or connections from different proxy credentials */
+ CURLOPT(CURLOPT_PROXY_CREDENTIAL_NO_REUSE, CURLOPTTYPE_LONG, 1022),
+
+ /* curl-impersonate: Split cookies into separate Cookie headers */
+ CURLOPT(CURLOPT_SPLIT_COOKIES, CURLOPTTYPE_LONG, 1023),
+
+ /* curl-impersonate: Set multipart/form-data boundary style */
+ CURLOPT(CURLOPT_FORM_BOUNDARY, CURLOPTTYPE_STRINGPOINT, 1024),
+
+ /*
+ * curl-impersonate:
+ * Set the order of the HTTP/3 pseudo headers. The value must contain
+ * the letters 'm', 'a', 's', 'p' representing the pseudo-headers
+ * ":method", ":authority", ":scheme", ":path" in the desired order of
+ * appearance in the HTTP/3 HEADERS frame.
+ *
+ * This is very similar to the http/2 option.
+ */
+ CURLOPT(CURLOPT_HTTP3_PSEUDO_HEADERS_ORDER, CURLOPTTYPE_STRINGPOINT, 1025),
+
+ /* curl-impersonate: HTTP3 settings frame keys and values, format: 1:v;6:v;7:v */
+ CURLOPT(CURLOPT_HTTP3_SETTINGS, CURLOPTTYPE_STRINGPOINT, 1026),
+
+ /* curl-impersonate: QUIC transport parameters, format: id:value;id:value */
+ CURLOPT(CURLOPT_QUIC_TRANSPORT_PARAMETERS, CURLOPTTYPE_STRINGPOINT, 1027),
+
+ /* curl-impersonate: Signature hash algorithms for HTTP/3 (QUIC TLS).
+ * If set, used instead of CURLOPT_SSL_SIGNATURE_ALGORITHMS for QUIC
+ * connections. */
+ CURLOPT(CURLOPT_HTTP3_SIG_HASH_ALGS, CURLOPTTYPE_STRINGPOINT, 1028),
+
+ /* curl-impersonate: TLS extension order for HTTP/3 (QUIC TLS).
+ * If set, used instead of CURLOPT_TLS_EXTENSION_ORDER for QUIC connections. */
+ CURLOPT(CURLOPT_HTTP3_TLS_EXTENSION_ORDER, CURLOPTTYPE_STRINGPOINT, 1029),
+
+ /* curl-impersonate: Comma-separated order for normal HTTP headers. */
+ CURLOPT(CURLOPT_HTTPHEADER_ORDER, CURLOPTTYPE_STRINGPOINT, 1030),
+
+ /* curl-impersonate: HTTP/3-specific custom HTTP headers.
+ * If set, used instead of CURLOPT_HTTPHEADER for HTTP/3 connections. */
+ CURLOPT(CURLOPT_HTTP3_HTTPHEADER, CURLOPTTYPE_SLISTPOINT, 1031),
+
+ /* curl-impersonate: HTTP/3-specific order for normal HTTP headers. */
+ CURLOPT(CURLOPT_HTTP3_HTTPHEADER_ORDER, CURLOPTTYPE_STRINGPOINT, 1032),
+
+ /* curl-impersonate: HTTP/3-specific EC curves. */
+ CURLOPT(CURLOPT_HTTP3_SSL_EC_CURVES, CURLOPTTYPE_STRINGPOINT, 1033),
+
+ /* curl-impersonate: WebSocket-specific custom HTTP headers.
+ * If set, used instead of CURLOPT_HTTPHEADER for ws:// and wss://. */
+ CURLOPT(CURLOPT_WS_HTTPHEADER, CURLOPTTYPE_SLISTPOINT, 1034),
+
+ /* curl-impersonate: WebSocket-specific order for normal HTTP headers. */
+ CURLOPT(CURLOPT_WS_HTTPHEADER_ORDER, CURLOPTTYPE_STRINGPOINT, 1035),
+
+ /* curl-impersonate: Disable WebSocket TLS session ticket extension. */
+ CURLOPT(CURLOPT_WS_SSL_DISABLE_TICKET, CURLOPTTYPE_LONG, 1036),
+
+ /* curl-impersonate: WebSocket-specific TLS certificate compression. */
+ CURLOPT(CURLOPT_WS_SSL_CERT_COMPRESSION, CURLOPTTYPE_STRINGPOINT, 1037),
+
CURLOPT_LASTENTRY /* the last unused */
} CURLoption;
@@ -2996,7 +3147,14 @@ typedef enum {
CURLINFO_HTTPAUTH_USED = CURLINFO_LONG + 69,
CURLINFO_PROXYAUTH_USED = CURLINFO_LONG + 70,
CURLINFO_SIZE_DELIVERED = CURLINFO_OFF_T + 71,
- CURLINFO_LASTONE = 71
+ /* curl-impersonate: accepted server cookie mutations from the latest
+ * transfer, formatted as SET/DELETE plus Netscape cookie fields. Use a
+ * high number to avoid collisions with upstream infos. */
+ CURLINFO_COOKIECHANGES = CURLINFO_SLIST + 1000,
+ /* curl-impersonate: followed HTTP redirect responses from the latest
+ * transfer, formatted as status-code plus tab plus request URL. */
+ CURLINFO_REDIRECT_HISTORY = CURLINFO_SLIST + 1001,
+ CURLINFO_LASTONE = 1001
} CURLINFO;
/* CURLINFO_RESPONSE_CODE is the new name for the option previously known as
diff --git a/include/curl/curlver.h b/include/curl/curlver.h
index 5cc0e27c61..fef56cbc65 100644
--- a/include/curl/curlver.h
+++ b/include/curl/curlver.h
@@ -32,7 +32,7 @@
/* This is the version number of the libcurl package from which this header
file origins: */
-#define LIBCURL_VERSION "8.21.0-DEV"
+#define LIBCURL_VERSION "8.21.0-IMPERSONATE"
/* The numeric version number is also available "in parts" by using these
defines: */
diff --git a/include/curl/easy.h b/include/curl/easy.h
index 197e6e7b92..8e0659ca66 100644
--- a/include/curl/easy.h
+++ b/include/curl/easy.h
@@ -43,6 +43,17 @@ CURL_EXTERN CURLcode curl_easy_setopt(CURL *curl, CURLoption option, ...);
CURL_EXTERN CURLcode curl_easy_perform(CURL *curl);
CURL_EXTERN void curl_easy_cleanup(CURL *curl);
+/*
+ * curl-impersonate: Tell libcurl to impersonate a browser.
+ * This is a wrapper function that calls curl_easy_setopt()
+ * multiple times with all the parameters required. That's also why it was
+ * created as a separate API function and not just as another option to
+ * curl_easy_setopt().
+ */
+CURL_EXTERN CURLcode curl_easy_impersonate(CURL *curl, const char *target,
+ int default_headers);