xanthics / PoE_Weighted_Search

Code to generate pathofexile.com/trade searches based on dps weights
MIT License
34 stars 2 forks source link

Request URI Too Large #7

Closed coldino closed 5 years ago

coldino commented 5 years ago

Certain combinations of inputs to your website generate a search URL that the trade site will not accept, generating a 414 Request-URI Too Large response.

Is it possible to post the data in the body, rather than the URL?

Example.

xanthics commented 5 years ago

I'll take a look at this over the weekend. I'm not quite sure how to approach fixing this yet.

xanthics commented 5 years ago

Because of the way the api is set up I would have to do a post, and then read the reply. But the active CORS policy won't allow me to do that from the webpage. Not sure how to circumvent the cross domain policy yet, since I need to be able to read the response.

xanthics commented 5 years ago

image

xanthics commented 5 years ago

Or with firefox. image

xanthics commented 5 years ago

From support:

We do not support CORS pre-flight requests on our official or private APIs. Usually this isn't a problem as most APIs require a GET request (as you initially found), but in your case it will prevent you from being able to use a POST to the trade endpoint when faced with extremely large queries. Supporting OPTIONS requests is something we would like to provide, but unfortunately would take a significant rewrite and won't be completed as soon as you may want. Instead I'll see if we can increase the URI limit.

coldino commented 5 years ago

Well, it's a more positive response that you would expect from most games companies. Let's hope the limit is increased and this is a non-issue for a while.

xanthics commented 5 years ago

Agreed. If it is still an issue I can disable less used mods or start grouping them by the slots they can appear on.

coldino commented 5 years ago

Simple suggestion: Filter the output, removing any mods that have a weight of 0. If more is required, you can cull anything that's less than a few % of the biggest weight.

xanthics commented 5 years ago

Mods with weight 0 are already being removed. But perhaps mods that are less than a certain % of generic damage.

Culling in relation to best weight is problematic because of mods like 1% damage per 15 of stat

[edit] round 2 might be rounding values to 0 and still adding them to search, I'll take care of that soon.

xanthics commented 5 years ago

And the most terrible idea I have is to create a python(or ahk) script via the webpage that you download and it then does the page opening for you. But that is a dumb amount of steps.

xanthics commented 5 years ago

As a temporary solution, I have created a python script that prompts for a string that is output by the webpage. It will then directly open the webpage, Too many steps for a real solution, but works in the short term.