165 Commits

Author SHA1 Message Date
Azat Khuzhin
0abe4eba83 sample/http-connect: fix compilation with VS2010
Fixes: nmathewson/Libevent#137
2016-12-06 09:57:16 +03:00
Thomas Bernard
e983712456 use ev_uint16_t instead of unsigned short for port
Like in `sockaddr_in` structure in /usr/include/netinet/in.h

@azat: convert all other users (bench, compat, ..) and tweak message
Fixes: #178
Fixes: #196
Refs: 6bf1ca78
Link: https://codereview.appspot.com/156040043/#msg4
2016-10-26 01:41:13 +03:00
Kurt Roeckx
3e9e0a0d46 Make it build using OpenSSL 1.1.0
Rebased (azat):
- tabs instead of whitespaces
- make openssl-compat.h safe for complex expressions
- do not call sk_SSL_COMP_free() in 1.1 (fixes double free)

TODO:
- clean methods_bufferevent

Closes: #397 (cherry-picked)
2016-10-16 19:05:24 +03:00
basavesh.as
666db91af0 Fix memory leak in signal-test.c 2016-06-29 15:11:50 +05:30
kirillDanshin
2d3cd35362 sample/hello-world: exAmple, not eXMple
Fixes: #334
2016-03-09 01:10:51 +03:00
Azat Khuzhin
1bf7595644 http-connect: make it win32 compilable
Fixes: commit 1d34498ea31134bd7a8fcadcb95910b30a479e19 ("sample: add HTTP
CONNECT tunnelling example using libevent http layer")
2016-01-14 11:58:39 +03:00
Azat Khuzhin
fdf713a08b sample/https-client: allow to change path to ca-certificates
And default to one that linux have, for freebsd you will need:
$ https-client -url https://google.com -crt /usr/local/share/certs/ca-root-nss.crt
2015-11-24 01:37:06 +03:00
Azat Khuzhin
c4e9d9bd66 sample/https-client: check for ERR_remove_thread_state() existence
Fixes: freebsd 9.2 build
2015-11-24 01:19:25 +03:00
Azat Khuzhin
77ad68a658 sample/https-client: replace ERR_remove_state() by ERR_remove_thread_state()
Since ERR_remove_state() is deprecated:
  $ git log --grep ERR_remove_thread_state
  commit 2ecd2ededece66bf090fefc93ef3ddb672d9e71a
  Author: Bodo Möller <bodo@openssl.org>
  Date:   Wed Aug 13 19:30:01 2008 +0000

      Mention ERR_remove_state() deprecation, and ERR_remove_thread_state(NULL).

Link: https://www.openssl.org/docs/manmaster/crypto/ERR_remove_state.html
2015-11-18 15:39:08 +03:00
Azat Khuzhin
3316a21005 Add missing <string.h> for openssl_hostname_validation module
Now it included by openssl, but nfter
openssl/openssl@master-post-reformat-1494-g6329b60 it will print warning
(apparently they dropped <string.h> from the generic headers).
2015-11-18 15:39:00 +03:00
Azat Khuzhin
4637aa8841 sample/https-client: add -timeout option 2015-09-02 19:34:52 +03:00
Azat Khuzhin
f3d7ff5da2 sample/https-client: don't try to free uninitialized SSL
sample/https-client.c:459:3: warning: ‘ssl’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   SSL_free(ssl);
2015-08-19 13:23:20 +03:00
Azat Khuzhin
24a1f25ab6 sample/https-client: graceful exit with freeing memory (to make valgrind happy) 2015-08-19 13:19:41 +03:00
Andrey Skriabin
29a04825d0 https-client: correctly handle URLs with no path (like "https://host:port")
path == NULL check removed

Fixes: #233
Fixes: #234
2015-08-19 12:28:03 +03:00
Azat Khuzhin
6dc71e70dc sample/http-connect: don't use assert() to make it work with NDEBUG
Otherwise it will not work for cmake release target type.
2015-08-18 21:59:25 +03:00
Azat Khuzhin
f976d4360b sample/http-connect: made it compatible with C90 2015-08-18 21:29:03 +03:00
Azat Khuzhin
1d34498ea3 sample: add HTTP CONNECT tunnelling example using libevent http layer 2015-08-18 12:59:50 +03:00
Mark Ellzey
620ff243c6 Update dns-example.
There's somebody out there who is going to have a compiler from 1986 who will complain. Better to fix c99 now.
2015-06-17 08:05:53 -07:00
Mark Ellzey
bde231d725 Merge pull request #183 from azat/dns-example
Some improvements for dns-example
2015-06-17 08:00:19 -07:00
Azat Khuzhin
df19a970e1 dns-example: allow to set ns from args
We can't do this using resolv.conf:
$ dns-example -v -c <(echo nameserver 127.0.0.1:10053) ya.ru
Because of how evutil_read_file_() works (using fstat())

And actually glibc for example will not use port from nameserver line, and
because of inet_aton() it will fail if nameserver will have arbitary port:
(gdb) p inet_aton("127.0.0.1", malloc(10000))
$1 = 1
(gdb) p inet_aton("127.0.0.1:53", malloc(10000))
$2 = 0

From glibc/resolv/res_init.c:
  if (MATCH(buf, "nameserver") && nserv < MAXNS) {
      struct in_addr a;
      cp = buf + sizeof("nameserver") - 1;
      while (*cp == ' ' || *cp == '\t')
          cp++;
      if ((*cp != '\0') && (*cp != '\n')
          && __inet_aton(cp, &a)) {
          statp->nsaddr_list[nservall].sin_addr = a;
          statp->nsaddr_list[nservall].sin_family = AF_INET;
          statp->nsaddr_list[nservall].sin_port =
                  htons(NAMESERVER_PORT);
2014-11-08 16:18:52 +03:00
Azat Khuzhin
32f8592c8b dns-example: convert to getopt() 2014-11-08 15:50:45 +03:00
Nick Mathewson
2e2d18bcd3 Merge pull request #170 from azat/https-client-retries
https-client: add -retries argument, for connection retries
2014-10-09 11:29:17 -04:00
Joakim Soderberg
5c7282f7a5 Fix compilation for older OpenSSL versions.
For instance OpenSSL 0.9.7 does not have SSL_set_tlsext_host_name.

Also add the missing EVENT__DISABLE_SAMPLES CMake option.
2014-09-24 13:46:09 +02:00
Azat Khuzhin
d9da844369 https-client: add -retries argument, for connection retries
Using evhttp_connection_set_retries() API.
2014-09-21 23:48:07 +04:00
Nick Mathewson
8bf769c47a Merge remote-tracking branch 'origin/patches-2.0'
Conflicts:
	sample/http-server.c
2014-08-29 14:32:10 -04:00
Nick Mathewson
6466e88ac1 Use FindClose for handle from FindFirstFile in http-server.c
Noted by Miles Chan as issue #145
2014-08-29 14:31:07 -04:00
Mike Frysinger
0c492b33f9 add a --disable-samples configure flag
For people building & installing libevent in a distro, building all these
sample apps are not useful.  Add a flag to turn them off.
2014-06-13 17:19:50 -04:00
Nick Mathewson
6d72bdca01 Make http-server.c output into good html5 2014-05-30 13:53:27 -04:00
Nick Mathewson
462e6b609b add a cast to https-client.c 2014-03-12 12:45:41 -04:00
Joakim Soderberg
e212c5486d Check for OSX when checking for clang. 2014-01-22 13:19:49 +01:00
Joakim Soderberg
d7be788780 Fix https-client compilation on Windows.
ssize_t is not defined. But using ssize_t for s in this context makes no
sense, since fread returns size_t.
2014-01-22 11:15:17 +01:00
Nick Mathewson
4cb44fdf56 Merge remote-tracking branch 'joakimsoderberg/new_cmake'
Conflicts:
	sample/https-client.c
2014-01-21 14:26:01 -05:00
Joakim Söderberg
8b40a5b08f Check if we're on OSX before disabling deprecation in le-proxy 2014-01-21 11:35:21 +01:00
Joakim Söderberg
4e1439588f Change all uses of WIN32 to _WIN32 2014-01-21 11:30:27 +01:00
Nick Mathewson
88ecda3bbb Fix a couple of "#ifdef WIN32" instances 2013-12-24 14:37:30 -05:00
Nick Mathewson
d1976f8ec4 Sample HTTPS Client: Set hostname for SNI extension (by f69m)
Patch from f69m on SourceForge
2013-12-24 14:05:44 -05:00
Nick Mathewson
90786eb073 Small tweaks to https-client.c 2013-12-24 12:59:36 -05:00
Nick Mathewson
2fbc3b148b Merge remote-tracking branch 'resetius/https' 2013-12-24 12:45:22 -05:00
Joakim Soderberg
0ef1d04e44 Get rid of unknown pragma warnings. 2013-12-17 14:32:07 +01:00
Joakim Söderberg
69c3516be6 Get rid of deprecation warnings for OpenSSL on OSX 10.7+ 2013-12-17 13:28:23 +01:00
Joakim Soderberg
19222e5247 Added some GCC specific options.
- Added sample applications.
- Fixed the https-client to work on Windows kind of (No cert validation).
2013-12-13 16:27:10 +00:00
Azat Khuzhin
6171e1c294 sample: drop uri_root from base_url in http-server.
By default there is "0.0.0.0", and this address will work only from
the same machine, and besides there is no need in uri_root in base_url,
because it will be added automatically by browser.
2013-08-13 18:19:50 +04:00
Nick Mathewson
44b2491bcd sample/le-proxy: Fail more gracefully if opening listener fails 2013-08-06 19:23:36 -04:00
Nick Mathewson
eb6b0c1f90 Merge branch '21_evdns_disable_when_inactive' 2013-04-25 10:47:16 -04:00
Azat Khuzhin
6b7fa620e8 evdns: New flag to make evdns not prevent the event loop from exiting
Here is the brief description of problem:
When you are use evdns to resolve domains to IP adresses (see
./sample/dns-example) you loop never returns from event_base_dispatch(),
and because of this the program will never terminated.

Because existing programs may be depending on the old behavior, we
only apply the fix when evdns_base_new() is created with a new flag -
EVDNS_BASE_DISABLE_WHEN_INACTIVE.

 (Commit message edited by Nick while squashing the branch.)
2013-04-25 10:43:12 -04:00
Alexey Ozeritsky
29af65ebfc https-client: code cleanup 2013-04-14 15:41:44 +04:00
Alexey Ozeritsky
902bf21e58 Merge branch 'master' of https://github.com/libevent/libevent into https 2013-04-14 15:12:22 +04:00
Nick Mathewson
95acdaa353 Another tweak to https-client.c 2013-04-10 17:56:54 -04:00
Nick Mathewson
8a90a850fc Remove http_struct.h usage in sample/https-client.c 2013-04-10 13:53:44 -04:00
Alexey Ozeritsky
c5887f73b7 POST supported, args supported 2013-03-11 18:31:19 +04:00