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

Fixes error 400 responses from patched form boundary #985

Merged
merged 1 commit into from
Apr 11, 2024

Conversation

jcd000
Copy link
Contributor

@jcd000 jcd000 commented Apr 11, 2024

Requests_cache version 1.2.0 causes our server to respond with error 400 on multipart requests.

After some investigation, i tracked this down to PR #919:
With the older format i get a proper response (status 200): FORM_BOUNDARY = '##requests-cache-form-boundary##'
With the new format i get error 400: FORM_BOUNDARY = '==requests-cache-form-boundary=='

I'm not very experienced with requests, but to my understanding RFC2046 suggests "The boundary delimiter line is then defined as a line consisting entirely of two hyphen characters ("-", decimal value 45) [...]"

So, i tested replacing the "==" with hyphens "--" in the below formats:

  1. FORM_BOUNDARY = '--requests-cache-form-boundary--'
  2. FORM_BOUNDARY = '--requests-cache-form-boundary'

Both formats above seem to be accepted with no problems.

Unless i am missing something, I would propose to keep the 1st format, which seems more in line with the past forms.

Fixes a regression which would cause our server to return error 400, induced from this commit:
requests-cache#919
Copy link

codecov bot commented Apr 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.37%. Comparing base (167e852) to head (be91e87).
Report is 5 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #985   +/-   ##
=======================================
  Coverage   99.37%   99.37%           
=======================================
  Files          23       23           
  Lines        1908     1908           
  Branches      337      338    +1     
=======================================
  Hits         1896     1896           
  Misses          5        5           
  Partials        7        7           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jcd000 jcd000 changed the title Fixes crashes from patched form boundary Fixes error 400 responses from patched form boundary Apr 11, 2024
@JWCook JWCook added the bug label Apr 11, 2024
@JWCook JWCook added this to the v1.2 milestone Apr 11, 2024
@JWCook
Copy link
Member

JWCook commented Apr 11, 2024

Thanks for contributing a fix for this.

For others' reference, do you have more details on what caused your server to not process a form boundary starting with ==?

@JWCook JWCook merged commit 08390ee into requests-cache:main Apr 11, 2024
10 checks passed
@jcd000
Copy link
Contributor Author

jcd000 commented Apr 12, 2024

Thanks for contributing a fix for this.

For others' reference, do you have more details on what caused your server to not process a form boundary starting with ==?

Thanks for accepting the PR.
I'm sorry i can't help more with debugging the root cause: I can't access server backend / logs.
Maybe helpful: in the response headers i can see: x-oracle-dms-rid: 0:4, which points to Oracle Identity Cloud Service.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants