Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

ContentLength can go over 2 byte int#90

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
andreagilardoni merged 2 commits intoarduino-libraries:masterfromPark0:master
Mar 22, 2024

Conversation

Park0
Copy link

When i tried to download a file over 64k i got issues on a arduinomega. This change will make the content length of type long so it will be 4 bytes.

Converted int to long to allow for more then 65535 bytes in length
Converted int to long to allow for more then 65535 bytes in length
@salexander2
Copy link

salexander2 commentedNov 2, 2020
edited
Loading

Hi, is necessary to adjust also the sendHeader metod:

sendHeader(const char* aHeaderName, constint aHeaderValue);

@Park0
Copy link
Author

As the const char is pointing to a real string (the value of a header in this case). I think that would be incorrect.

@salexander2
Copy link

Hi, please check.
sendHeader is an overloaded method.
If you need to upload a file, and use sendHeader to set the length, the upload fails.
If you adjust it, then it will work.
Try please! I did it ;)

@Park0
Copy link
Author

I think casting your value to int would do the trick as the method already exists:

voidsendHeader(constchar* aHeaderName,constint aHeaderValue);

@salexander2
Copy link

salexander2 commentedNov 3, 2020
edited
Loading

I think casting your value to int would do the trick as the method already exists:

voidsendHeader(constchar* aHeaderName,constint aHeaderValue);

If you try to use this method passing a "long" value, it will not work. I tried, and I received a timeout error.
After I adjusted the metod, replacing "int" with "long" it worked.
Anyway, I reported it. If you release in the future a new version I know what to do to fix.

@Park0
Copy link
Author

Do you have a simple example? I think i miss something.

@salexander2
Copy link

salexander2 commentedNov 4, 2020
edited
Loading

I have my project, that is not so simple....
If you want I can show you via TeamViever.
Here a piece of my code:

bool TSiteComm::upload_file(File* p_file){  // "multipart/form-data; boundary=RandomNerdTutorials"  // --STORNY_MY_CAR\r\n -> 17   client2.beginRequest();  client2.post("/ardu/upload.php");  client2.sendHeader("Content-Type", "multipart/form-data; boundary=STORNY_MY_CAR");  client2.sendHeader("Content-Length", 17+85+40+2+p_file->size()+2+19+2); <---------- HERE THE PROBLEM  client2.beginBody();  // --STORNY_MY_CAR\r\n -> 17   client2.println(F("--STORNY_MY_CAR"));  // Content-Disposition: form-data; name=\"dataFile\"; filename=\"20201030.txt\"\r\n -> 85   client2.print(F("Content-Disposition: form-data; name=\"dataFile\"; filename=\""));  client2.print(F(codice_veicolo));  client2.print(F("_"));  client2.print(F(p_file->name()));  client2.println("\"");  //content-type: text/plain;charset=UTF-8 -> 40  client2.println(F("content-type: text/plain;charset=UTF-8"));  // -> 2  client2.println();  while (p_file->available()) {    client2.write(p_file->read());  }  // -> 2  client2.println();  // --STORNY_MY_CAR--\r\n -> 19   client2.println(F("--STORNY_MY_CAR--"));  // -> 2  client2.println();  client2.endRequest();

Here, if I leave the parameter of sendHeader as int, the upload fails with a timeout, and errorcode -3. If I convert int to long it works.

I'm available with TeamViewer, if you want to see.

Alessandro

@admindotnu
Copy link

Any reasson why this request is not merged yet ?

@CLAassistant
Copy link

CLAassistant commentedApr 9, 2021
edited
Loading

CLA assistant check
All committers have signed the CLA.

@per1234per1234 added the topic: codeRelated to content of the project itself labelJan 15, 2022
@per1234per1234 linked an issueJan 15, 2022 that may beclosed by this pull request
@andreagilardoni
Copy link

Hi@Park0, thanks for your contribution, could you please sign the CLA?

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
topic: codeRelated to content of the project itselftype: imperfectionPerceived defect in any part of project
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

ContentLength returns negative value
6 participants
@Park0@salexander2@admindotnu@CLAassistant@andreagilardoni@per1234

[8]ページ先頭

©2009-2025 Movatter.jp