Commit Graph

44 Commits

Author SHA1 Message Date
bsergean
dfa10df5ae
Set an origin header in websocket and http clients (#455) 2023-04-01 12:19:38 -07:00
Azamat H. Hackimov
9157873f5b
Fix compilation on GCC-13 (#443)
* Fix compilation on GCC-13

GCC-13 changes internal cstdint includes, and now files that uses
standart integer types should directly include cstdint header.

See: https://gcc.gnu.org/gcc-13/porting_to.html#header-dep-changes
Bug: https://bugs.gentoo.org/865117
Bug: https://bugs.gentoo.org/895440

* Convert line endings to Unix format
2023-02-25 13:50:35 -08:00
Vol-Alex
6cc21f3658
HTTP should contain port in 'Host' header (#427) 2023-02-11 15:27:40 -08:00
Martin Natano
db7057de69
Add support for streaming transfers (#353)
This change adds onChunkCallback to the request. If defined it will be
called repeatedly with the incoming data. This allows to process data on
the go or write it to disk instead of accumulating the data in memory.
2022-01-31 21:54:32 -08:00
Martin Natano
66cd29e747
Allow to cancel asynchronous HTTP requests (#332)
Usage:

	auto args = this->httpClient.createRequest(url, method);
	httpClient.performRequest(args, ...);
	[...]
	// Oops, we don't actually want to complete the request!
	args->cancel = true;
2021-12-20 23:01:55 -08:00
crjc
bbe2ae6dd3
fix: check the request's headers rather than the empty response's headers for User-Agent and Accept (#296) 2021-06-05 11:19:53 -07:00
Benjamin Sergeant
3b19b0eeca http client: DEL is not a verb, but DELETE is, fix #281 2021-04-04 23:27:28 -07:00
SeanOMik
d9b4beff8b
Fix an issue with disabling zlib and getting linker errors from the http client. (#247)
* (http client) #ifdefs so we dont try to compress http requests with zlib

* (http client) Remove some #ifdefs for including zlib and removing fields
2020-10-19 13:36:04 -07:00
Benjamin Sergeant
b2f21840c6 (ws curl) Add support for --data-binary option, to set the request body. When present the request will be sent with the POST verb 2020-10-12 14:03:01 -07:00
Benjamin Sergeant
67cb48537a (http client + server + ws) Add support for compressing http client requests with gzip. --compress_request argument is used in ws to enable this. The Content-Encoding is set to gzip, and decoded on the server side if present. 2020-10-09 17:51:56 -07:00
Benjamin Sergeant
fa0408e70b (http client + server + ws) Add support for uploading files with ws -F foo=@filename, new -D http server option to debug incoming client requests, internal api changed for http POST, PUT and PATCH to supply an HttpFormDataParameters 2020-10-08 12:43:18 -07:00
Benjamin Sergeant
6f188a5131 (ws) add gzip and gunzip ws sub commands 2020-09-28 10:19:27 -07:00
Benjamin Sergeant
e1502017ce (ixwebsocket) replace std::unique_ptr<unsigned char[]> with std::array for some fixed arrays (which are in C++11) 2020-08-17 16:48:26 -07:00
Benjamin Sergeant
42f71364ca IXHttpClient.cpp: use std::array instead of std::unique_ptr for a fixed size array 2020-08-17 16:25:55 -07:00
Benjamin Sergeant
6f0307fb35 (build) make using zlib optional, with the caveat that some http and websocket features are not available when zlib is absent 2020-07-31 22:54:57 -07:00
Benjamin Sergeant
10c014bf98 (http client) fix deadlock when following redirects 2020-06-19 00:11:06 -07:00
Benjamin Sergeant
15355188d5 (http client) rework a bit PATCH pull request, fix compile error with setForceBody and initialize _forceBody to false 2020-05-05 07:43:55 -07:00
Liz3
8760c87635
add PATCH and add option to enforce a http request body write (#195)
* add PATCH and add option to enforce a http request body write

* remove private bool prop
2020-05-05 07:38:55 -07:00
Benjamin Sergeant
2786631e3b clang-format 2020-05-04 17:19:25 -07:00
Benjamin Sergeant
b45980f0f6 (http client) better current request cancellation support when the HttpClient destructor is invoked (see #189) 2020-04-29 11:53:23 -07:00
Benjamin Sergeant
45061b0b14 (http client + sentry minidump upload) Multipart stream closing boundary is invalid + mark some options as mandatory in the command line toolsj 2020-02-13 12:25:18 -08:00
Benjamin Sergeant
a0d5f37402 (http client) Add support for multipart HTTP POST upload + (ixsentry) Add support for uploading a minidump to sentry 2019-11-25 21:11:11 -08:00
Benjamin Sergeant
afed387bcf Socket Factory has only one function which works for server and client code, and can do tls for both 2019-09-30 22:06:46 -07:00
Benjamin Sergeant
55141aa875 ws curl + http client tls option handling + ca cert processing for mbedtls 2019-09-29 21:13:11 -07:00
Benjamin Sergeant
cd3c9d879c reformat everything with clang-format 2019-09-23 10:25:23 -07:00
Benjamin Sergeant
398c4fbf99 fix unittest 2019-09-22 19:40:33 -07:00
Benjamin Sergeant
a95fcbbdbf user agent 2019-08-30 12:50:56 -07:00
Benjamin Sergeant
2f730303c2 CobraMetricThreadedPublisher _enable flag is an atomic, and CobraMetricsPublisher is enabled by default 2019-08-14 19:54:30 -07:00
Benjamin Sergeant
f84bc53c8d Feature/httpd (#94)
* Stub code for http server

* can send a response, cannot process body yet

* write headers to the response

* remove commented code

* add simple test + set default http handler

* tweak CI + unittest

* add missing file

* rewrite http::trim in a simple way

* doc
2019-06-23 14:54:21 -07:00
Benjamin Sergeant
076e8bf6a3 add an option to easily disable per message deflate compression 2019-06-06 13:48:53 -07:00
Benjamin Sergeant
89909c15bc cobra to sentry fixes 2019-06-05 18:47:48 -07:00
Benjamin Sergeant
78b3d7ff2d Feature/http async (#90)
* unittest working / uses shared_ptr for a bunch of things 🗿

* fix command line tools

* fix ws + add doc

* add more logging
2019-06-05 17:04:24 -07:00
Benjamin Sergeant
539abe5151 HttpResponse is a struct, not a tuple 🉐 2019-06-03 22:12:52 -07:00
Benjamin Sergeant
7e5aba140e http / PUT fix 🐚 2019-06-03 21:12:39 -07:00
Benjamin Sergeant
6b933391e5 http client: stop hardcoding Accept header, and use a default value if one is passed in 👭 2019-06-03 14:02:54 -07:00
Benjamin Sergeant
1e2a5ee21d Add simple HTTP and HTTPS client test ㊙️ 2019-06-03 12:23:35 -07:00
Benjamin Sergeant
225a5ef808 (http client) / Add DEL and PUT method, make requests and other utilities public 👐 2019-06-03 11:38:56 -07:00
Benjamin Sergeant
396d0d9bdc Feature/ws windows (#86)
* try to build ws on window on travis 📮

* cmake invocation fixed on windows 🐝

* Can use mbedtls to calculate hmac + no openssl config option

* build only windows on travis 🕢

* run msbuild 💷

* proper command to build 🕛

* some build fixes

* change weird sizeof call 🐙

* warning and missing includes fixes 💮

* ifdef out statsd code on windows 🐍

* logic invertion in ifdef 👄

* bring back makefile 📜

* command line tool is built with mbedtls 🏥
2019-06-02 20:46:20 -07:00
Benjamin Sergeant
06cbebe22e Feature/mbedtls (#84)
* try to import mbedtls and build it

* add stubs socket class

* some boilterplate, read and write function implemented

* more boilterplate / current error in handshake because no CA cert is setup

* add something so skip ca verification, can ws curl https://google.com !

* cleanup / close implemented

* tweak CMakefiles

* typo in include

* update readme

* disable unittests
2019-06-01 17:41:48 -07:00
Dimon4eg
99a3bbc4f9 use C++11 enums (#67)
* use C++11 enums

* small rename

* update tests

* update tests

* update ws

* update ws

* update README.md
2019-05-11 14:22:06 -07:00
Dimon4eg
979ff60a6b Use LUrlParser to fix issue of Windows (#53)
LGTM
2019-05-06 14:45:02 -07:00
Benjamin Sergeant
0c226c7629 readBytes does not read bytes one by one but in chunks 2019-03-02 21:11:16 -08:00
Benjamin Sergeant
86cc76388e create a blocking + cancellable Socket::readBytes method 2019-03-02 11:01:51 -08:00
Benjamin Sergeant
2c86fd947f Feature/http (#16)
* add skeleton and broken http client code.

GET returns "Resource temporarily unavailable" errors...

* linux compile fix

* can GET some pages

* Update formatting in README.md

* unittest for sending large messages

* document bug

* Feature/send large message (#14)

* introduce send fragment

* can pass a fin frame

* can send messages which are a perfect multiple of the chunk size

* set fin only for last fragment

* cleanup

* last fragment should be of type CONTINUATION

* Add simple send and receive programs

* speedups receiving + better way to wait for thing

* receive speedup by using linked list of chunks instead of large array

* document bug

* use chunks to receive data

* trailing spaces

* Update README.md

Add note about message fragmentation.

* Feature/ws cli (#15)

* New command line tool for transfering files / still very beta.

* add readme

* use cli11 for argument parsing

* json -> msgpack

* stop using base64 and use binary which can be stored in message pack

* add target for building with homebrew

* all CMakeLists are referenced by the top level one

* add ws_chat and ws_connect sub commands to ws

* cleanup

* add echo and broadcast server as ws sub-commands

* add gitignore

* comments

* ping pong added to ws

* mv cobra_publisher under ws folder

* Update README.md

* linux build fix

* linux build fix

* move http_client to a ws sub-command

* simple HTTP post support (urlencode parameters)

* can specify extra headers

* chunk encoding / simple redirect support / -I option

* follow redirects is optional

* make README vim markdown plugin friendly

* cleanup argument parsing + add socket creation factory

* add missing file

* http gzip compression

* cleanup

* doc

* Feature/send large message (#14)

* introduce send fragment

* can pass a fin frame

* can send messages which are a perfect multiple of the chunk size

* set fin only for last fragment

* cleanup

* last fragment should be of type CONTINUATION

* Add simple send and receive programs

* speedups receiving + better way to wait for thing

* receive speedup by using linked list of chunks instead of large array

* document bug

* use chunks to receive data

* trailing spaces
2019-02-28 21:54:03 -08:00