Skip to content

Commit a11a29e

Browse files
committed
Use libevhtp for outgoing HTTP requests.
1 parent 278f44d commit a11a29e

File tree

11 files changed

+238
-104
lines changed

11 files changed

+238
-104
lines changed

.travis.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ before_install:
2121
- wget https://googlemock.googlecode.com/files/gmock-1.7.0.zip -O /tmp/gmock-1.7.0.zip
2222
- unzip -d /tmp /tmp/gmock-1.7.0.zip
2323
- sudo mv /tmp/gmock-1.7.0 /usr/src/gmock
24+
- wget https://github.com/ellzey/libevhtp/archive/1.2.10.zip -O /tmp/libevhtp-1.2.10.zip
25+
- unzip -d /tmp/ /tmp/libevhtp-1.2.10.zip
26+
- mkdir /tmp/libevhtp-1.2.10/build
27+
- pushd /tmp/libevhtp-1.2.10/build && cmake -DEVHTP_DISABLE_REGEX:STRING=ON .. && sudo make install; popd
2428
- sudo pip install -r python/requirements.txt
2529
- sudo ln -s protobuf-java.jar /usr/share/java/protobuf.jar
2630
- mkdir -p $GOPATH/src/github.com/google

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ RUN apt-get update && \
1111
libevent-2.0.5 \
1212
libevent-core-2.0.5 \
1313
libevent-extra-2.0.5 \
14+
libevent-openssl-2.0.5 \
1415
libevent-pthreads-2.0.5 \
1516
libgflags2 \
1617
libgoogle-glog0 \

Dockerfile-ct-mirror

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ RUN apt-get update && \
1010
libevent-2.0.5 \
1111
libevent-core-2.0.5 \
1212
libevent-extra-2.0.5 \
13+
libevent-openssl-2.0.5 \
1314
libevent-pthreads-2.0.5 \
1415
libgflags2 \
1516
libgoogle-glog0 \
@@ -51,7 +52,7 @@ CMD cd /mnt/ctmirror/ && \
5152
CORE_DIR="/mnt/ctmirror/cores/$(date +%s)"; \
5253
mkdir -p ${CORE_DIR}; \
5354
cp -v core ${CORE_DIR}; \
54-
cp -v /usr/local/bin/ct-server ${CORE_DIR}; \
55+
cp -v /usr/local/bin/ct-mirror ${CORE_DIR}; \
5556
echo "Core saved to ${CORE_DIR}"; \
5657
fi
5758

Makefile.am

Lines changed: 41 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ cpp_server_ct_mirror_LDADD = \
163163
$(json_c_LIBS) \
164164
$(libevent_LIBS) \
165165
$(leveldb_LIBS) \
166-
-lcrypto -lprotobuf -lsqlite3
166+
-lcrypto -lssl -lprotobuf -lsqlite3 -levhtp
167167
cpp_server_ct_mirror_SOURCES = \
168168
cpp/client/async_log_client.cc \
169169
cpp/fetcher/remote_peer.cc \
@@ -189,7 +189,7 @@ cpp_server_ct_server_LDADD = \
189189
$(json_c_LIBS) \
190190
$(libevent_LIBS) \
191191
$(leveldb_LIBS) \
192-
-lcrypto -lprotobuf -lsqlite3
192+
-lcrypto -lssl -lprotobuf -lsqlite3 -levhtp
193193
cpp_server_ct_server_SOURCES = \
194194
cpp/client/async_log_client.cc \
195195
cpp/proto/serializer.cc \
@@ -213,7 +213,7 @@ cpp_tools_ct_clustertool_LDADD = \
213213
cpp/libcore.a \
214214
$(json_c_LIBS) \
215215
$(libevent_LIBS) \
216-
-lprotobuf -lcrypto -lsqlite3
216+
-lprotobuf -lcrypto -lssl -lsqlite3 -levhtp
217217
cpp_tools_ct_clustertool_SOURCES = \
218218
cpp/proto/serializer.cc \
219219
cpp/tools/clustertool_main.cc \
@@ -229,7 +229,7 @@ cpp_client_ct_LDADD = \
229229
cpp/libcore.a \
230230
$(json_c_LIBS) \
231231
$(libevent_LIBS) \
232-
-lprotobuf -lcrypto -lssl -lsqlite3
232+
-lprotobuf -lcrypto -lssl -lsqlite3 -levhtp
233233
cpp_client_ct_SOURCES = \
234234
cpp/client/async_log_client.cc \
235235
cpp/client/client.cc \
@@ -272,7 +272,8 @@ cpp_tools_dump_sth_SOURCES = \
272272
cpp_tools_etcd_watch_LDADD = \
273273
cpp/libcore.a \
274274
$(json_c_LIBS) \
275-
$(libevent_LIBS)
275+
$(libevent_LIBS) \
276+
-lcrypto -lssl -levhtp
276277
cpp_tools_etcd_watch_SOURCES = \
277278
cpp/tools/etcd_watch.cc \
278279
cpp/util/json_wrapper.cc \
@@ -281,7 +282,8 @@ cpp_tools_etcd_watch_SOURCES = \
281282
cpp_util_bench_etcd_LDADD = \
282283
cpp/libcore.a \
283284
$(json_c_LIBS) \
284-
$(libevent_LIBS)
285+
$(libevent_LIBS) \
286+
-lcrypto -lssl -levhtp
285287
cpp_util_bench_etcd_SOURCES = \
286288
cpp/util/bench_etcd.cc \
287289
cpp/util/json_wrapper.cc \
@@ -291,7 +293,7 @@ cpp_util_etcd_masterelection_LDADD = \
291293
cpp/libcore.a \
292294
$(json_c_LIBS) \
293295
$(libevent_LIBS) \
294-
-lprotobuf
296+
-lprotobuf -lcrypto -lssl -levhtp
295297
cpp_util_etcd_masterelection_SOURCES = \
296298
cpp/util/etcd_masterelection.cc \
297299
cpp/util/json_wrapper.cc \
@@ -312,7 +314,7 @@ cpp_log_cluster_state_controller_test_LDADD = \
312314
$(json_c_LIBS) \
313315
$(libevent_LIBS) \
314316
$(leveldb_LIBS) \
315-
-lprotobuf -lsqlite3 -lcrypto
317+
-lprotobuf -lsqlite3 -lcrypto -lssl -levhtp
316318
cpp_log_cluster_state_controller_test_SOURCES = \
317319
cpp/client/async_log_client.cc \
318320
cpp/log/cluster_state_controller_test.cc \
@@ -343,7 +345,7 @@ cpp_log_etcd_consistent_store_test_LDADD = \
343345
cpp/libtest.a \
344346
$(json_c_LIBS) \
345347
$(libevent_LIBS) \
346-
-lprotobuf -lcrypto
348+
-lprotobuf -lcrypto -lssl -levhtp
347349
cpp_log_etcd_consistent_store_test_SOURCES = \
348350
cpp/log/etcd_consistent_store_test.cc \
349351
cpp/proto/serializer.cc \
@@ -373,7 +375,7 @@ cpp_log_frontend_signer_test_LDADD = \
373375
$(json_c_LIBS) \
374376
$(libevent_LIBS) \
375377
$(leveldb_LIBS) \
376-
-lprotobuf -lcrypto -lsqlite3
378+
-lprotobuf -lcrypto -lssl -lsqlite3 -levhtp
377379
cpp_log_frontend_signer_test_SOURCES = \
378380
cpp/log/frontend_signer_test.cc \
379381
cpp/log/test_signer.cc \
@@ -391,7 +393,7 @@ cpp_log_log_lookup_test_LDADD = \
391393
$(json_c_LIBS) \
392394
$(libevent_LIBS) \
393395
$(leveldb_LIBS) \
394-
-lprotobuf -lcrypto -lsqlite3
396+
-lprotobuf -lcrypto -lssl -lsqlite3 -levhtp
395397
cpp_log_log_lookup_test_SOURCES = \
396398
cpp/log/log_lookup_test.cc \
397399
cpp/log/test_signer.cc \
@@ -429,7 +431,7 @@ cpp_log_strict_consistent_store_test_LDADD = \
429431
cpp/libtest.a \
430432
$(json_c_LIBS) \
431433
$(libevent_LIBS) \
432-
-lprotobuf
434+
-lprotobuf -lcrypto -lssl -levhtp
433435
cpp_log_strict_consistent_store_test_SOURCES = \
434436
cpp/log/strict_consistent_store_cert.cc \
435437
cpp/log/strict_consistent_store_test.cc \
@@ -444,7 +446,7 @@ cpp_log_tree_signer_test_LDADD = \
444446
$(json_c_LIBS) \
445447
$(libevent_LIBS) \
446448
$(leveldb_LIBS) \
447-
-lprotobuf -lcrypto -lsqlite3
449+
-lprotobuf -lcrypto -lssl -lsqlite3 -levhtp
448450
cpp_log_tree_signer_test_SOURCES = \
449451
cpp/log/test_signer.cc \
450452
cpp/log/tree_signer_test.cc \
@@ -522,7 +524,7 @@ cpp_server_proxy_test_LDADD = \
522524
cpp/libtest.a \
523525
$(json_c_LIBS) \
524526
$(libevent_LIBS) \
525-
-lprotobuf
527+
-lprotobuf -lcrypto -lssl -levhtp
526528
cpp_server_proxy_test_SOURCES = \
527529
cpp/server/json_output.cc \
528530
cpp/server/proxy.cc \
@@ -535,7 +537,8 @@ cpp_util_etcd_delete_test_LDADD = \
535537
cpp/libcore.a \
536538
cpp/libtest.a \
537539
$(json_c_LIBS) \
538-
$(libevent_LIBS)
540+
$(libevent_LIBS) \
541+
-lcrypto -lssl -levhtp
539542
cpp_util_etcd_delete_test_SOURCES = \
540543
cpp/util/etcd_delete_test.cc \
541544
cpp/util/json_wrapper.cc \
@@ -546,7 +549,8 @@ cpp_util_etcd_test_LDADD = \
546549
cpp/libcore.a \
547550
cpp/libtest.a \
548551
$(json_c_LIBS) \
549-
$(libevent_LIBS)
552+
$(libevent_LIBS) \
553+
-lcrypto -lssl -levhtp
550554
cpp_util_etcd_test_SOURCES = \
551555
cpp/util/etcd_test.cc \
552556
cpp/util/json_wrapper.cc \
@@ -556,7 +560,8 @@ cpp_util_fake_etcd_test_LDADD = \
556560
cpp/libcore.a \
557561
cpp/libtest.a \
558562
$(json_c_LIBS) \
559-
$(libevent_LIBS)
563+
$(libevent_LIBS) \
564+
-lcrypto -lssl -levhtp
560565
cpp_util_fake_etcd_test_SOURCES = \
561566
cpp/util/fake_etcd_test.cc \
562567
cpp/util/json_wrapper.cc \
@@ -575,7 +580,8 @@ cpp_util_json_wrapper_test_SOURCES = \
575580
cpp_util_libevent_wrapper_test_LDADD = \
576581
cpp/libcore.a \
577582
cpp/libtest.a \
578-
$(libevent_LIBS)
583+
$(libevent_LIBS) \
584+
-lcrypto -lssl -levhtp
579585
cpp_util_libevent_wrapper_test_SOURCES = \
580586
cpp/util/libevent_wrapper.cc \
581587
cpp/util/libevent_wrapper_test.cc
@@ -586,7 +592,7 @@ cpp_util_masterelection_test_LDADD = \
586592
$(json_c_LIBS) \
587593
$(libevent_LIBS) \
588594
$(leveldb_LIBS) \
589-
-lprotobuf
595+
-lprotobuf -lcrypto -lssl -levhtp
590596
cpp_util_masterelection_test_SOURCES = \
591597
cpp/util/json_wrapper.cc \
592598
cpp/util/libevent_wrapper.cc \
@@ -598,7 +604,7 @@ cpp_merkletree_merkle_tree_test_LDADD = \
598604
cpp/libcore.a \
599605
cpp/libtest.a \
600606
$(libevent_LIBS) \
601-
-lcrypto
607+
-lcrypto -lssl -levhtp
602608
cpp_merkletree_merkle_tree_test_SOURCES = \
603609
cpp/util/util.cc \
604610
cpp/merkletree/merkle_tree_test.cc
@@ -607,7 +613,7 @@ cpp_merkletree_serial_hasher_test_LDADD = \
607613
cpp/libcore.a \
608614
cpp/libtest.a \
609615
$(libevent_LIBS) \
610-
-lcrypto
616+
-lcrypto -lssl -levhtp
611617
cpp_merkletree_serial_hasher_test_SOURCES = \
612618
cpp/util/util.cc \
613619
cpp/merkletree/serial_hasher_test.cc
@@ -616,31 +622,34 @@ cpp_merkletree_tree_hasher_test_LDADD = \
616622
cpp/libcore.a \
617623
cpp/libtest.a \
618624
$(libevent_LIBS) \
619-
-lcrypto
625+
-lcrypto -lssl -levhtp
620626
cpp_merkletree_tree_hasher_test_SOURCES = \
621627
cpp/util/util.cc \
622628
cpp/merkletree/tree_hasher_test.cc
623629

624630
cpp_util_sync_task_test_LDADD = \
625631
cpp/libcore.a \
626632
cpp/libtest.a \
627-
$(libevent_LIBS)
633+
$(libevent_LIBS) \
634+
-lcrypto -lssl -levhtp
628635
cpp_util_sync_task_test_SOURCES = \
629636
cpp/util/sync_task_test.cc \
630637
cpp/util/thread_pool.cc
631638

632639
cpp_util_task_test_LDADD = \
633640
cpp/libcore.a \
634641
cpp/libtest.a \
635-
$(libevent_LIBS)
642+
$(libevent_LIBS) \
643+
-lcrypto -lssl -levhtp
636644
cpp_util_task_test_SOURCES = \
637645
cpp/util/task_test.cc \
638646
cpp/util/thread_pool.cc
639647

640648
cpp_util_thread_pool_test_LDADD = \
641649
cpp/libcore.a \
642650
cpp/libtest.a \
643-
$(libevent_LIBS)
651+
$(libevent_LIBS) \
652+
-lcrypto -lssl -levhtp
644653
cpp_util_thread_pool_test_SOURCES = \
645654
cpp/util/thread_pool_test.cc \
646655
cpp/util/thread_pool.cc
@@ -649,7 +658,7 @@ cpp_log_cert_checker_test_LDADD = \
649658
cpp/libcore.a \
650659
cpp/libtest.a \
651660
$(libevent_LIBS) \
652-
-lcrypto
661+
-lcrypto -lssl -levhtp
653662
cpp_log_cert_checker_test_SOURCES = \
654663
cpp/log/cert_checker_test.cc \
655664
cpp/util/openssl_util.cc \
@@ -659,7 +668,7 @@ cpp_log_cert_submission_handler_test_LDADD = \
659668
cpp/libcore.a \
660669
cpp/libtest.a \
661670
$(libevent_LIBS) \
662-
-lprotobuf -lcrypto
671+
-lprotobuf -lcrypto -lssl -levhtp
663672
cpp_log_cert_submission_handler_test_SOURCES = \
664673
cpp/log/cert_submission_handler_test.cc \
665674
cpp/util/openssl_util.cc \
@@ -669,7 +678,7 @@ cpp_log_cert_test_LDADD = \
669678
cpp/libcore.a \
670679
cpp/libtest.a \
671680
$(libevent_LIBS) \
672-
-lcrypto
681+
-lcrypto -lssl -levhtp
673682
cpp_log_cert_test_SOURCES = \
674683
cpp/log/cert_test.cc \
675684
cpp/util/openssl_util.cc \
@@ -679,7 +688,7 @@ cpp_log_ct_extensions_test_LDADD = \
679688
cpp/libcore.a \
680689
cpp/libtest.a \
681690
$(libevent_LIBS) \
682-
-lcrypto
691+
-lcrypto -lssl -levhtp
683692
cpp_log_ct_extensions_test_SOURCES = \
684693
cpp/log/ct_extensions_test.cc \
685694
cpp/util/openssl_util.cc \
@@ -690,7 +699,7 @@ cpp_log_database_large_test_LDADD = \
690699
cpp/libtest.a \
691700
$(libevent_LIBS) \
692701
$(leveldb_LIBS) \
693-
-lprotobuf -lcrypto -lsqlite3
702+
-lprotobuf -lcrypto -lssl -lsqlite3 -levhtp
694703
cpp_log_database_large_test_SOURCES = \
695704
cpp/log/database_large_test.cc \
696705
cpp/log/test_signer.cc \
@@ -704,7 +713,7 @@ cpp_log_frontend_test_LDADD = \
704713
$(json_c_LIBS) \
705714
$(libevent_LIBS) \
706715
$(leveldb_LIBS) \
707-
-lprotobuf -lcrypto -lsqlite3
716+
-lprotobuf -lcrypto -lssl -lsqlite3 -levhtp
708717
cpp_log_frontend_test_SOURCES = \
709718
cpp/log/frontend_test.cc \
710719
cpp/log/test_signer.cc \
@@ -721,7 +730,7 @@ cpp_merkletree_merkle_tree_large_test_LDADD = \
721730
cpp/libcore.a \
722731
cpp/libtest.a \
723732
$(libevent_LIBS) \
724-
-lcrypto
733+
-lcrypto -lssl -levhtp
725734
cpp_merkletree_merkle_tree_large_test_SOURCES = \
726735
cpp/merkletree/merkle_tree_large_test.cc \
727736
cpp/util/util.cc

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ installing. If you can install the missing header manually, it should
5454
work.
5555

5656
- [libevent](http://libevent.org/) (tested with 2.0.21-stable)
57+
- [libevhtp](https://github.com/ellzey/libevhtp) (tested with 1.2.10)
58+
If building libevhtp from source, you may need to disable the regex support
59+
with the following cmake flag: `-DEVHTP_DISABLE_REGEX:STRING=ON`
5760

5861
You can specify a non-installed locally built library using the
5962
`LIBEVENTDIR` environment variable to point to the local build. Note

configure.ac

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ AC_CHECK_HEADER([google/protobuf/message.h],,
3838
[AC_MSG_ERROR([protobuf headers could not be found])])
3939
AC_CHECK_HEADER([leveldb/db.h],,
4040
[AC_MSG_ERROR([leveldb headers could not be found])])
41+
AC_CHECK_HEADER([evhtp.h],,
42+
[AC_MSG_ERROR([libevhtp headers could not be found])])
4143
AC_CHECK_HEADER([ldns/ldns.h],, [missing_ldns=yes])
4244

4345
# Check for working GTest/GMock.
@@ -61,6 +63,7 @@ AS_IF([test -n "$missing_gmock"],
6163
# Checks for libraries.
6264
AC_SEARCH_LIBS([__b64_ntop], [resolv])
6365
AC_SEARCH_LIBS([pthread_create], [pthread])
66+
AC_SEARCH_LIBS([evhtp_make_request], [evhtp])
6467

6568
AC_MSG_CHECKING([checking for gflags library])
6669
LIBS="-lgflags $LIBS"
@@ -91,9 +94,13 @@ AC_SEARCH_LIBS([event_base_dispatch], [event],, [missing_libevent=1],
9194
[$save_LIBS])
9295
AC_SEARCH_LIBS([evthread_use_pthreads], [event_pthreads],, [missing_libevent=1],
9396
[$save_LIBS])
97+
AC_SEARCH_LIBS([bufferevent_openssl_socket_new], [event_openssl],, [missing_libevent_openssl=1],
98+
[$save_LIBS])
9499
AC_SUBST([libevent_LIBS], [$LIBS])
95100
AS_IF([test -n "$missing_libevent"],
96101
[AC_MSG_ERROR([could not find the libevent libraries])])
102+
AS_IF([test -n "$missing_libevent_openssl"],
103+
[AC_MSG_ERROR([could not find the libevent_openssl library])])
97104
LIBS="$save_LIBS"
98105

99106
# TCMalloc gubbins

0 commit comments

Comments
 (0)