-
-
Notifications
You must be signed in to change notification settings - Fork 92
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
Payload limit #655
Comments
Hey! There isn't a limit, but I might know what's happening. For me, I'll investigate to see if my idea could be right though. Thanks! |
Hey @mintminttea, My guess was right 😄, the body was so large at times the socket didn't receive all the data at once. The above commit made Thanks |
Yes, I can confirm it is working as expected now, thanks. |
#655: Fix for request bodies that are huuge
Hi,
|
OK, so the commit above appears to solve sending via HTTPS - I'm still testing some new logic for reading in requests, so could change at some point. I think it's worth saying that although Pode doesn't enforce any upper limits on the payload, the larger it gets, expect some instability or slowness. There's a chance using the Pode.Kestrel module could work better instead, though I am intrigued to see how far we can push the base Pode engine 🤔 You can shrink the size a bit by doing |
I got below error when post the data now.
Did give Pode.Kestrel a try and it is running great, I think I can switch to this or use the tcp endpoint directly. |
Hey @mintminttea, if Pode.Kestrel works, I'd recommend using that for larger payloads. What I will do though, is move the above changes from this issue and open a new issue to look at improving Pode's listener to handle larger payloads. I'll keep the changes that were originally merged in for 2.1.0. To help, would you be all right to answer the following questions? As they'll be useful for testing 😃 I've been able to run the above commit on HTTPS with an 85MB JSON payload without issue you see.
Invoke-RestMethod -uri "https://localhost:8080/submit" -Method Post -Body (Get-Process | ConvertTo-Json -Depth 8) -ContentType "application/json" Thanks! |
Well actually I am trying to create a software inventory system in pure PowerShell as my own interest as well as using in my company. The client side is based on the inventory script in psgallery with some modification, then post the json data to pode server. The data is not huge which is usually under 100KB~200KB when I view the size from the database.
Using powershell 7.1.1
Directly in powershell and launch via cmd pwsh.exe -file server.ps1
Running on Windows 10 on my PC and Windows server 2016 in other server, not inside container.
Tried both posting to my own pc and posting to the windows server. |
Thank you, this should hopefully help! |
That's a cool idea, I was thinking on doing something similar when Spiceworks development stopped Import-Module -Name '.\src\Pode.psd1', '.\src\Pode.Web.psd1' -Force
Start-PodeServer {
Add-PodeEndpoint -Address localhost -Protocol Https -SelfSigned
Add-PodeRoute -Method Post -Path "/submit" -ContentType "application/json; charset=UTF-8" -ScriptBlock {
Write-Output "Received client submit information" | out-default
$data = ($WebEvent.Data | Convertto-Json -Depth 8 | ConvertFrom-Json)
# return update-myCDBComputerItem -id (($data.BIOS.SerialNumber).replace(" ", "_")) -Data $data
$data | Out-File -FilePath .\test.json
$null = Write-PodeJsonResponse -Value $data
}
} Run: $TestSmall = [PSCustomObject]@{
Name1 = 'foo'
Name2 = 'bar'
} | ConvertTo-Json
$TestBig = (Get-Process | ConvertTo-Json -Depth 8)
$R = Invoke-RestMethod -uri "https://localhost:8443/submit" -Method Post -Body $TestBig -ContentType "application/json" -SkipCertificateCheck |
I was having similar problems downloading excel files where Pode stopped responding sometimes. |
Bug no the Issue-655 branch Start-PodeServer {
Add-PodeEndpoint -Address localhost -Protocol Http
New-PodeLoggingMethod -File -Name 'Errors' | Enable-PodeErrorLogging
New-PodeLoggingMethod -File -Name 'Requests' | Enable-PodeRequestLogging
Set-PodeViewEngine -Type Pode
Add-PodeRoute -Method Get -Path / -ScriptBlock {
Write-PodeJsonResponse -Value @{ 'value' = 'Test Server!' }
}
}
|
It's the way KeepAlive connections work, a connection is kept open between the browser and server to re-use - rather than re-creating a new connection for every request 😃 Closing the browser closes the connection, which is triggered as an empty read-event on the server, but I had the state update a line after it should have been! The commit above moves it and should work now. |
I've actually just been testing this branch to see if it behaves via IIS, Docker, Linux, etc. So far, all seems good (bar the bug you raised! 🙈). Thinking we might actually be able to push this with 2.1.0 🤔 the only setup I'm not able to properly test is when using an Azure App Proxy (@ericpritchett I believe you had this setup?). But from what the issue was there (SSL padding), and how this new logic works , it shouldn't cause an issue. |
Fix LGTM 👍. Hope it get into 2.1.0 as on develop I get some download errors. |
Question
Is there a size limitation on the pode post data? if yes, is it possible to adjust in server setting or workaround to post the data?
I got error message when I try to post some json data and check the result in console.
If the json is small enough it will return via $Webevent.data, else my powershell return below.
Server side
Client side command
OK when select name and cpu only
Error when contains all properties
The text was updated successfully, but these errors were encountered: