-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add body part for redirects #3
Conversation
Code review:
|
I’ll write a patch that accounts for all of these, no problem, but I do have one question first: why? There isn’t strictly any need to have a body in redirect requests. As far as I know, it is merely a courtesy to old browsers – very old browsers, at this point. Am I missing something? And that brings me to the next point – why XHTML? Without a
(Yes, that is valid. I hate links labelled “here”, btw.) |
|
Because it's a recommendation from W3C to do that. No special reason for being XHTML. I was just lazy and copied that from my own code and as I said, I forgot the content-type header. It's not only for old browsers...but yeah, with correct content-type header they do parse that. The indentation was more for us maintaining code as any best-practice recommendation is to do so for long strings. It's up to you to use HTML5. I hardly believe that robots will parse that tho. As last thing, I suggest adding a flag (defaulting to false) used in assertion for adding the body, this way we keep backcompat for users who don't need/want/like having that. |
Ah.
Spaces for indentation? For God’s sake! 😆
TreeBuilder?! Even worse! I don’t want to go groping around in the content at all, let alone add dependencies to do that. But you do have a point, and the solution is obvious if I’d stopped to think about it: set a flag variable within the wrapped dummy app. Then the test can check that the flag didn’t get set in case of a redirect, implying that the wrapped app wasn’t called.
I don’t think it’s necessary to make that configurable. If someone explicitly does |
-Backcompat-. And that is not true as Plack::Util::content_length() will return 0 from [''] in body. |
OK, I’ve commited 78cdd62. Can you pull and and see if my
It didn’t btw. When I added an explicit test for it, the test failed – as expected by the fact that I couldn’t find any logic in your patch to exempt such statuses. Try running your code against the |
ap:
wreis:
|
And RE 201 response, actually the better would be to use Plack::Util::status_with_no_entity_body() instead of hardcoding checking "== 304", but it's very clear as demonstrated above that for 201 it does -not- generate body. |
Gosh, what an inattentive idiot I am. I misread your patch, sorry. Excuse the bother, and sorry I’ve been such a pain on this issue. |
I don’t follow here.
But I don’t even understand whether you’re arguing that something is wrong, or unnecessary, or are trying to say something else entirely. What was your aim here? I’m feeling obtuse. |
I’ve pushed another commit, 58833d2 – it’s now, finally maybe, pretty much what you wrote, give or take a few of my idiosyncrasies. Please pull and take a look. |
You're right, the URI should be HTML-econded there. Looks good to me. |
I just pushed 540ee4e and released it to CPAN as 1.007, so I am closing this ticket. Feel free to reopen if anything new crops up on this topic. HTH, thank you for the request. |
Oh It seems that HTML content is missing the root tag after doctype declaration?! |
Nope. It’s valid. |
I guess you're aware that not all UA (specially here bots) support HTML5 yet eh?! |
I really don’t understand what non-hypothetical use case is supposed to be unsupported by the code as it stands, and considering your own patch started off with XHTML without entity encoding and with no But maybe I am wrong. I am open to changing my mind if you can cite any real-world example at all of a contemporarily used user agent that would suffer – i.e. one that neither supports redirects nor succeeds in parsing as tag soup the body generated by Plack::Middleware::Rewrite. (I can tell you what use case my use of elliptical markup is supposed to support: minimising the number of bytes wasted on of perfunctory boiler plate on otherwise very small HTTP responses that a high-traffic website may generate in large numbers.) |
On Feb 13, 2013, at 2:51 PM, Aristotle Pagaltzis notifications@github.com wrote:
Agreed.
Well, possibly but not 100% sure they will. If I were the one writing a robot yes, but not always the case.
Step back please. I told you ages ago that I fucking forgot to set the content-type and entity-encode the URI as you fucking did as well for a plenty of things that I submitted as a patch here. I have been trying to have a productive discussion with you since when this PR was opened, but then you have chosen to act as an idiot instead. I am done. |
Yes, I am an idiot. (I read only the patches and then misunderstood what exactly you did because of the broken indentation; but never thought to actually read the final code from your commit.) I did step back – I said I may be wrong, and that I am open to changing my mind, and I meant those both. My question is serious: is there some issue you are actually seeing? It does sound like a wildly hypothetical eventuality to me, because as far as I can tell, for it to actually occur in practice would require a confluence of factors I find hard to believe exists. But maybe my imagination is limited, my knowledge, or both. Convince me! |
I said -idiot- and not -ignorant- cause you were trying to judge my understanding or skills instead of focusing on real thing here. You didn't even mind to carefully read the patch on the beginning, but just claimed quickly it was wrong. |
I wasn’t dinging you for the broken indentation! Sorry if you got that impression. It’s an easy mistake to make, so no worries. I was just saying it’s what misled me, combined with my own carelessness. As for judging your understanding – you seemed dismissively convinced, so I had to gauge your level of understanding to decide how much of a stickler to be. The cues were inconclusive, though tentatively seemed to point more in one direction, so I decided not to follow your lead – just yet… I’m not good at putting these things in a way that goes down easy, sorry. I have strong opinions, but I don’t hold onto them very fast – unfortunately the former is a lot easier to see than the latter. |
No description provided.