Skip to content

HttpClient.cpp#setCookie() #7076

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

Closed
1 task done
fvaryu opened this issue Aug 2, 2022 · 2 comments · Fixed by #7112
Closed
1 task done

HttpClient.cpp#setCookie() #7076

fvaryu opened this issue Aug 2, 2022 · 2 comments · Fixed by #7112
Assignees
Labels
Status: Needs investigation We need to do some research before taking next steps on this issue Type: Bug 🐛 All bugs
Milestone

Comments

@fvaryu
Copy link

fvaryu commented Aug 2, 2022

Board

ESP32Dev Kit

Device Description

DevKit

Hardware Configuration

none

Version

latest master (checkout manually)

IDE Name

PlatformIO

Operating System

macOS

Flash frequency

40Mhz

PSRAM enabled

no

Upload speed

115200

Description

HttpClient.cpp#setCookie()

void HTTPClient::setCookie(String date, String headerValue)
{
    if (!_cookieJar)
    {
        return;
    }
    #define HTTP_TIME_PATTERN "%a, %d %b %Y %H:%M:%S"

    Cookie cookie;
    String value;
    int pos1, pos2;

    headerValue.toLowerCase(); // ? why toLoerCase()
  // other code
}

Why turn the value into lowercase, if the server returns uppercase? i don't understand。thx

  CookieJar cookies;
  http.setCookieJar(&cookies);

The server returns a mixed case token, but I get lowercase by CookieJar

Sketch

void HTTPClient::setCookie(String date, String headerValue)
{
    if (!_cookieJar)
    {
        return;
    }
    #define HTTP_TIME_PATTERN "%a, %d %b %Y %H:%M:%S"

    Cookie cookie;
    String value;
    int pos1, pos2;

   headerValue.toLowerCase();

    struct tm tm;
    strptime(date.c_str(), HTTP_TIME_PATTERN, &tm);
    cookie.date = mktime(&tm);
}

Debug Message

None

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.
@fvaryu fvaryu added the Status: Awaiting triage Issue is waiting for triage label Aug 2, 2022
@SuGlider SuGlider self-assigned this Aug 2, 2022
@SuGlider SuGlider added Type: Bug 🐛 All bugs Status: Needs investigation We need to do some research before taking next steps on this issue and removed Status: Awaiting triage Issue is waiting for triage labels Aug 2, 2022
@SuGlider
Copy link
Collaborator

SuGlider commented Aug 2, 2022

Hummm..... that seems a bug. Cookies are case sensitive.
Thanks @fvaryu for pointing that out.

@SuGlider
Copy link
Collaborator

@fvaryu - If possible, please test the PR #7112 and let me know if it fixes the issue. Thanks.

@SuGlider SuGlider moved this from Todo to In Review in Arduino ESP32 Core Project Roadmap Aug 10, 2022
fvaryu added a commit to fvaryu/arduino-esp32 that referenced this issue Aug 16, 2022
Repository owner moved this from In Review to Done in Arduino ESP32 Core Project Roadmap Aug 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs investigation We need to do some research before taking next steps on this issue Type: Bug 🐛 All bugs
Projects
Development

Successfully merging a pull request may close this issue.

3 participants