Commit Graph

29 Commits

Author SHA1 Message Date
simbit18
85988dc77f Fix nuttx coding style
Remove TABs
2023-08-01 23:10:32 -07:00
YAMAMOTO Takashi
d435858c53 webclient: Export a few ops on webclient_conn_s
* Make webclient_conn_s self-contained so that it can be
  used without webclient_context.

* Add missing FAR.
2022-06-20 13:56:53 +08:00
YAMAMOTO Takashi
fca5b186b1 webclient: Make webclient_get_tunnel returns void
As it does never fail.
2022-06-20 13:56:53 +08:00
YAMAMOTO Takashi
5cfc5cd4f2 webclient.h: Update the state diagram after the tunnelling stuff 2022-06-20 13:56:53 +08:00
YAMAMOTO Takashi
2be66e83a4 webclient_conn_s: Add a missing FAR 2022-06-20 13:56:53 +08:00
YAMAMOTO Takashi
159ca00752 webclient: Allow users to specify extra headers for proxy
My primary motivation at this point is to use it for basic proxy auth.
(specify "Proxy-Authorization" header)
But there can be other use cases for proxy-specific extra headers.

If/when we want to support other non-trivial auth methods, probably
a callback-based mechanism will be necessary. But at this point,
this serves my purpose well.
2022-06-15 20:40:53 +08:00
YAMAMOTO Takashi
5e3a3dae10 webclient.h: Avoid relying on indirect inclusion
Include stdint.h for uint16_t explicitly.

This was necessary when I was trying to build this natively
on Ubuntu.  It seems some other headers happen to pull
the uint16_t definition by luck on NuttX and macOS.
2022-06-03 17:28:05 +03:00
YAMAMOTO Takashi
c116f8b673 webclient: Add https proxy (https over http) support
Use a separate webclient_context for tunnel establishment.

I chose this way (instead of having tunnelling steps in
the state machine of a single webclient_context) because
I want to allow tunnelling of non-HTTP protocols sooner or later.
2022-06-02 12:45:41 +08:00
YAMAMOTO Takashi
a95dd30f0e webclient: Add tunneling support
Add a primitive API for tunnel establishment.
(WEBCLIENT_FLAG_TUNNEL and webclient_get_tunnel)

I plan to use this to implement https proxy support.
That is, the primary user will be webclient itself.
2022-06-02 12:45:41 +08:00
YAMAMOTO Takashi
41aee40a2c webclient: Add proxy setting in webclient_context 2022-05-24 22:42:54 +08:00
YAMAMOTO Takashi
44e80ac972 webclient: Implement chunked transfer (receiving side)
This is a requirement for HTTP 1.1.

Tested against:

* http://httpbin.org/stream/10

* Docker API
2022-03-08 09:39:55 +08:00
YAMAMOTO Takashi
3759da3d00 webclient: Add a parameter to specifiy protocol version 2022-03-08 09:39:55 +08:00
YAMAMOTO Takashi
b8fd862965 webclient: Add some assertions on webclient_context state 2021-08-08 22:34:26 -07:00
YAMAMOTO Takashi
cb1f7c9dfe webclient.h: Document webclient_client lifetime 2021-08-08 22:34:26 -07:00
YAMAMOTO Takashi
0bae950b63 webclient: Implement non-blocking I/O
* webclient_perform
    * Add a new flag to use non-blocking mode (WEBCLIENT_FLAG_NON_BLOCKING)
    * Implement restarting

* Add a few associated API functions
    * webclient_get_poll_info: get the descriptor info for poll/select
    * webclient_abort: abort the operation (instead of restarting)
2021-08-08 22:34:26 -07:00
Gustavo Henrique Nihei
a1026c9f23 netutils/webclient: Notify HTTP header data via dedicated callback
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2021-07-23 11:28:26 -07:00
YAMAMOTO Takashi
ce2b9519a7 webclient: Add a way to specify timeout 2021-06-15 05:18:14 -05:00
YAMAMOTO Takashi
1131cbe14d webclient: Implement AF_LOCAL 2021-01-17 18:44:17 -08:00
YAMAMOTO Takashi
73fb7baa05 webclient: Distinguish request size and buffer size in body callback
This fixes the case when webclient_set_static_body is used
for data larger than webclient_context::buflen.

Note: as of writing this, webclient_set_static_body is the
only user of body_callback in NuttX apps tree.
2020-11-19 18:46:38 -08:00
YAMAMOTO Takashi
a1db71fa43 webclient improvements
Highlights:

* TLS support (a hook to allow users to provide TLS implementation)
* ability to add extra request headers
* ability to use PUT method
* ability to report http status
* error handling improvements

Proposed on the ML while ago:
https://www.mail-archive.com/dev@nuttx.apache.org/msg03803.html

The original API is kept for now.
I plan to remove them after adapting the existing users.
(examples in this repo)
2020-10-01 15:32:25 +08:00
YAMAMOTO Takashi
b78370dbf2 webclient: move WGET_USE_URLENCODE definiton to the header
Because it's used by the header.

This fixes warnings while building wgetjson.
2020-09-30 08:22:16 +02:00
Juha Niskanen
2aabd1c9a7 webclient: run through nxstyle
Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
2020-04-23 09:29:36 -06:00
Juha Niskanen
f8f16975a9 webclient: use getaddrinfo to get IPv4 addresses on dual stack systems
Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
2020-04-23 09:29:36 -06:00
Gregory Nutt
e1d36a7eca Clean up and review of header files for conformance to standards 2015-06-12 18:07:47 -06:00
Gregory Nutt
b9cf7acb1a More trailing whilespace removal 2014-04-13 16:24:28 -06:00
patacongo
ddc2a64224 Fix apps/netutils/webclient build problem
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5317 42af7a65-404d-4744-a932-0658087f49c3
2012-11-06 16:59:45 +00:00
patacongo
93870670fa Add support for wget POST interface; from Darcy Gong
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5301 42af7a65-404d-4744-a932-0658087f49c3
2012-11-03 00:00:56 +00:00
patacongo
a1f980bc9d Header file clean-up
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4948 42af7a65-404d-4744-a932-0658087f49c3
2012-07-17 03:58:11 +00:00
patacongo
398cadbb31 Move nuttx/include/apps to apps/include
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3581 42af7a65-404d-4744-a932-0658087f49c3
2011-05-09 22:21:10 +00:00