wp-net / WordPressPCL

This is a portable library for consuimg the WordPress REST-API in (almost) any C# application
MIT License
335 stars 131 forks source link

When adding a new post, an error occurs if the length of the content property is greater than 64K. #346

Closed aizen71 closed 9 months ago

aizen71 commented 9 months ago

Regarding the above, adding a new post is working fine when the length of the string in the content property is less than 64K. If it exceeds 64K you will get the exception below captured in debug mode.

{Method: POST, RequestUri: "https://XXX.com/wp-json/wp/v2/posts", Version: 1.1, Content: System.Net.Http.StringContent, Headers:{ Authorization: Basic aWNvZGVicm9rZXI6WDNsNSB1RmtQIEdHdWEgVHc0NyBla2Q0IGVTaUk= Content-Type: application/json; charset=utf-8 Content-Length: 165863}}

{StatusCode: 403, ReasonPhrase: "Forbidden", Version: 1.1, Content: System.Net.Http.StreamContent, Headers:{ Connection: keep-alive Date: Thu, 21 Sep 2023 04:01:28 GMT Server: nginx Content-Length: 146 Content-Type: text/html}}

WordPressPCL.Models.Exceptions.WPUnexpectedException: "Server returned HTTP status Forbidden"

I contacted the hosting service provider I am using, but they said they had set up the settings below and asked me to provide an environment to test if there were any problems.

php_value post_max_size 100M php_value upload_max_filesize 100M

However, I am unable to make any requests to the hosting service provider because I do not know how to provide a test environment.

If you have any good methods and ideas to solve the above problem, I would like to ask you a favor.

ThomasPe commented 9 months ago

sorry, but if it's a hosting issue I don't think this is the correct place for it. depending on the hosting provider their support (forums) or StackOverflow might be more suitable.