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

Add support for X-WWW-Authenticate header (IDFGH-10936) #12131

Conversation

0xFEEDC0DE64
Copy link
Contributor

I also need the support for the http header X-WWW-Authenticate in my application

@espressif-bot espressif-bot added the Status: Opened Issue is new label Aug 23, 2023
@github-actions github-actions bot changed the title Add support for X-WWW-Authenticate header Add support for X-WWW-Authenticate header (IDFGH-10936) Aug 23, 2023
@hmalpani
Copy link
Collaborator

hmalpani commented Sep 8, 2023

Hello @0xFEEDC0DE64

As a part of esp-idf, by default, only the standard HTTP headers are supported. Adding the support X-WWW-Authenticate cannot be done in the way it is done in this PR. But I understand that users should have some method to support custom headers as well.
I am sharing a patch with you which have support for custom authentication headers. You can use the new API introduced in the patch to set the auth data. You have to call the new API in event handler:

case HTTP_EVENT_ON_HEADER:
        if (strcasecmp(client->current_header_key, "X-WWW-Authenticate") == 0) {
                esp_http_client_set_auth(event->client, event->header_value, strlen(event->header_value));
        }
        break;

Can you try this patch and let me know if this works for you?

Thanks!
IDFGH-10936.txt

@espressif-bot espressif-bot added Status: In Progress Work is in progress and removed Status: Opened Issue is new labels Sep 8, 2023
@hmalpani
Copy link
Collaborator

Hello @0xFEEDC0DE64
Have you tried the patch shared above? Please let know if it works for you.

@espressif-bot espressif-bot added Status: Done Issue is done internally Resolution: NA Issue resolution is unavailable and removed Status: In Progress Work is in progress labels Sep 27, 2023
movsb pushed a commit to movsb/esp-idf that referenced this pull request Dec 1, 2023
This new API can be used to set the authentication data in the client context
when the auth data is received in the custom header

Closes: espressif#12131
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: NA Issue resolution is unavailable Status: Done Issue is done internally
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants