Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to extend available HTTP methods in esp_http_client (IDFGH-3441) #5402

Closed
kaelef opened this issue Jun 5, 2020 · 5 comments
Closed
Labels
Type: Feature Request Feature request for IDF

Comments

@kaelef
Copy link

kaelef commented Jun 5, 2020

Is your feature request related to a problem? Please describe.

I'm trying to convert a project that uses Arduino-ESP32 to one that's pure ESP-IDF. The project communicates with WebDAV, so it needs to be able to send HTTP requests with methods like PROPFIND, MOVE, etc. When using the HttpClient class in Arduino-ESP32, the sendRequest(TYPE, payload, size) is available. Since TYPE is a string, any method name can be specified. esp_http_client uses an enum, esp_http_client_method_t, and provides no way to override the HTTP method string with something not in the enum list.

Describe the solution you'd like

Either the esp_http_client_method_t enum can be extended to include the standard WebDAV methods, or a way to specify an arbitrary method the way HttpClient in Arudino-ESP32 allows would solve the problem.

esp_http_client_set_method() could be overloaded to allow use of a char pointer in place of a esp_http_client_method_t value.

Describe alternatives you've considered

I've looked at the source for esp_http_client, and the method string is placed into the outgoing buffer before the usual HTTP headers are added. I don't see a way to fix this without making my own version of esp_http_client that doesn't have this limitation.

@kaelef kaelef added the Type: Feature Request Feature request for IDF label Jun 5, 2020
@github-actions github-actions bot changed the title Ability to extend available HTTP methods in esp_http_client Ability to extend available HTTP methods in esp_http_client (IDFGH-3441) Jun 5, 2020
@Alvin1Zhang
Copy link
Collaborator

Alvin1Zhang commented Jun 8, 2020

@kaelef Thanks for raising this feature request.

@shubhamkulkarni97
Copy link
Contributor

@kaelef,

It is not possible to change API signature to allow specifying arbitrary method. The only way is to add methods in esp_http_client_method_t enum.

Can you elaborate what all methods need to be added in esp_http_client_method_t?

@kaelef
Copy link
Author

kaelef commented Jun 9, 2020

WebDAV is described well here: https://en.wikipedia.org/wiki/WebDAV
The additional methods it specifies are:

  • COPY
  • MOVE
  • LOCK
  • UNLOCK
  • PROPFIND
  • PROPPATCH
  • MKCOL

@shubhamkulkarni97
Copy link
Contributor

Hi @kaelef,

Can you try the patch attached below and check if it solves your purpose?

Please let us know if the change works for you.
esp_http_client_add_methods.patch.zip

@kaelef
Copy link
Author

kaelef commented Jun 11, 2020

Yes, this will work - thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature Request Feature request for IDF
Projects
None yet
Development

No branches or pull requests

3 participants