Skip to content

Is there a fancy way to modify constants without touch the libary files? #49

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
ricard2k opened this issue Aug 21, 2019 · 2 comments
Closed

Comments

@ricard2k
Copy link

ricard2k commented Aug 21, 2019

Describe Your Goal
I need to modify one constant in HttpServerConstants but I dont want to edit the library file, I want to do it in my code.

What Does Your Project Look Like
I need to increase the max line size because I'm using JWT tokens (large string in Authorization header) as authentication.

If you can boil your question down to a [minimal working example]
I need to get with a large header as in this sample:

curl -X GET \
  https://192.168.6.73/relay1/0 \
  -H 'Authorization: Bearer aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb-ccccccccccccccccccccccccccccccccccccccc-dddddddddddddddddddddddddddddddddddddddddddddddddd-eeeeeeeeeeeeeeeeeeeeeee-fffffffffffffffffffffffffffff-ggggggggggggggg-hhhhhhhhhhhhhhhhhhhhhhhhh..............................'

and at the MCU I get the next output when the request is being parsed:

1092994 HTTPSServer->debug: [-->] New connection. Socket fid is:  0x38
1095584 HTTPSServer->debug: [   ] There is data on the connection socket. fid= 0x38
1095586 HTTPSServer->debug: [   ] Request line finished: method=GET, resource=/relay1/0
1095590 HTTPSServer->debug: [   ] There is data on the connection socket. fid= 0x38
1095595 HTTPSServer->debug: [ERR] Line length exceeded. Server error.
Server error
1095604 HTTPSServer->debug: [<--] Connection has been closed. fid =  0x38
1095610 HTTPSServer->debug: [   ] Free headers

ESP32 Module
ESP WROOM32

  • Flash Size: 8M

Software (please complete the following information if applicable)

  • IDE and Version: PlatformIO 4.0.0
  • Client used to access the server: simple cURL
@fhessel
Copy link
Owner

fhessel commented Aug 21, 2019

I'm working on that, I already allowed modifying the log level and added that now also for the other constants, but only on the develop-branch (see the referenced commit).

In your platform.ini, you then can use something like this:

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
build_flags =
  -DHTTPS_REQUEST_MAX_HEADER_LENGTH=768

If the develop branch isn't stable enough, you can temporarily make the #ifndef/#define/#endif changes in your local copy of the repo, as I'll merge that soon.

Does that solve your problem?

@ricard2k
Copy link
Author

Thanks a lot! This what I was looking for!

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

No branches or pull requests

2 participants