News for hackers. Stuff that matters.
Re:HTTP 402 – Payment Required by user24 on Friday June 06, 2014 @09:21AM (#7857673)
Uh, before we all start getting our payment APIs to return 402s in a million different and incompatible scenarios, I'd urge everyone to remember what "reserved" means". It means "don't use this until we've defined it properly".
Re:HTTP 402 – Payment Required by 3pt14159 on Friday June 06, 2014 @05:03PM (#7860259)
Meh. Just start doing things. Apple uses this code, YouTube uses this code (in the wrong way, I might add), it isn't the end of the world.
Re:HTTP 402 – Payment Required by elros on Saturday June 07, 2014 @05:42PM (#7863192)
I don't know how Apple uses it, but at $dayjob we use it with the same semantics as YouTube: When we determine there's need to display a CAPTCHA.
Re:HTTP 402 – Payment Required by nilsjuenemann on Friday June 06, 2014 @10:26AM (#7858037)
It's in RFC 2068 since 1997.

http://www.ietf.org/rfc/rfc2068.txt

Nothing new here.

Re:HTTP 402 – Payment Required by alex_duf on Friday June 06, 2014 @02:41PM (#7859619)
Nothing new, but still interesting to read. A little bit like HTTP 418 https://en.wikipedia.org/wiki/HTTP_code#418
Re:HTTP 402 – Payment Required by fenesiistvan on Friday June 06, 2014 @09:16AM (#7857651)
This code is used a lot in SIP as a call disconnect reason when the caller doesn't have enough credit (SIP disconnect codes maps with http codes).
Re:HTTP 402 – Payment Required by MichaelGG on Friday June 06, 2014 @01:26PM (#7859191)
Actually, it's not used that much on high-volume systems. That's because a LOT of platforms treat 4xx as "user error" and will treat them as fatal.

So call goes from TelcoA, to Reseller1. Reseller1 cleverly returns 402. TelcoA stops and doesn't failover, returns error to customer. TelcoA is unhappy, because they wanted to continue the call to Reseller2.

Source: I work in wholesale telecom and this is exactly what every larger customer asks for. They must get a 5xx error (sometimes a 503 specifically), or their side won't continue hunting the call.

402 and all the other fun stuff might be used in a more pure SIP environment, but I doubt it's used in any sort of significant % of actual SIP deployments. Actually, just like most of the spec. It's either confusing, useless ("Retry-After: 300 (I'm in a meeting)", or a security hole.

Re:HTTP 402 – Payment Required by drsim on Friday June 06, 2014 @10:21AM (#7858008)
Shopify return 402 for a client's site when they haven't paid. I'm not sure of the exact criteria (grace period etc.).

It's very helpful as a provider of services to Shopify stores to know 'this prospect may not pay'. The average shopper doesn't know HTTP codes too, so it avoids tarnishing the shop's reputation if it was just an oversight.

Re:HTTP 402 – Payment Required by spindritf on Friday June 06, 2014 @08:34AM (#7857481)
Not really useful until there's an integrated way for paying for a piece of content. Which most people probably won't use anyway, see: http auth.
Re:HTTP 402 – Payment Required by jakio on Friday June 06, 2014 @08:49AM (#7857540)
Still useful for API's with mixed (paid & free) content, so you can keep a uniform URL structure.
Re:HTTP 402 – Payment Required by NathanKP on Friday June 06, 2014 @09:14AM (#7857642)
This is exactly what I've used the 402 code for. Some API routes are available to all users, but others require paid access. If a freemium user attempts to access API routes behind the "paywall" I return the 402 code.
Re:HTTP 402 – Payment Required by michaelmior on Friday June 06, 2014 @08:49AM (#7857538)
This gives more information than a 401 or 403, but agreed that it's use is still limited. Would make sense to return a 402 along with a redirect to a payment page.
Re:HTTP 402 – Payment Required by mhurron on Friday June 06, 2014 @09:31AM (#7857722)
> return a 402 along with a redirect

So a 3xx error.

Re:HTTP 402 – Payment Required by garfij on Friday June 06, 2014 @10:02AM (#7857891)
I think a 402 with a typed "Link" response header field of "payment" (per http://tools.ietf.org/html/rfc5988) would probably be the most appropriate no?
Re:HTTP 402 – Payment Required by wprl on Friday June 06, 2014 @11:51AM (#7858607)
Excellent observation.
Re:HTTP 402 – Payment Required by ivoras on Friday June 06, 2014 @11:01AM (#7858249)
> Not really useful until there's an integrated way for paying for a piece of content.

Bitcoins could be the solution here.

Re:HTTP 402 – Payment Required by kevinpet on Friday June 06, 2014 @01:03PM (#7859068)
As originally designed, HTTP was envisioned as much more an application level protocol rather than the transport layer we now use it as.
Re:HTTP 402 – Payment Required by guard-of-terra on Friday June 06, 2014 @09:19AM (#7857663)
Allofmp3.com used 402 when you batch-downloaded music and your credit ran out.

When it still was all rage :)

Re:HTTP 402 – Payment Required by currysausage on Friday June 06, 2014 @09:54AM (#7857852)
Speaking of little-known status codes: 503 Service Unavailable should always be used in maintenance scenarios. 404s tell users to delete the bookmark and Google to remove the page from the index.
Re:HTTP 402 – Payment Required by chrismorgan on Friday June 06, 2014 @10:28AM (#7858051)
You meant 410 (Gone), not 404 (Not Found). Also people should bear in mind that 410 should be used cautiously.
Re:HTTP 402 – Payment Required by sbierwagen on Friday June 06, 2014 @11:44AM (#7858559)
On bbot.org I return 410 on robots.txt, for tedious ideological reasons. Doesn't stop spiders requesting it, of course, since that check is probably hard-coded.
Re:HTTP 402 – Payment Required by currysausage on Friday June 06, 2014 @01:23PM (#7859173)
I did mean 404. When people or spiders encounter a 404 twice, they will assume the resource is Gone (although a 404 doesn't technically tell them that it is, sure, sorry I didn't make that clearer: "No indication is given of whether the condition is temporary or permanent.")

A real 410 would obviously be even worse, but that won't usually happen by accident. When my server/app crashes and I'm working on restoring the configuration, in the meantime, it will usually show a 404. And that's bad.

Re:HTTP 402 – Payment Required by chrismorgan on Saturday June 07, 2014 @07:09AM (#7861820)
404 does not instruct users to delete bookmarks, whereas 410 is the code with approximately those semantics.
Re:HTTP 402 – Payment Required by ivank on Friday June 06, 2014 @09:53AM (#7857847)
YouTube responds with a 402 whenever they show a CAPTCHA.
Re:HTTP 402 – Payment Required by Cthulhu_ on Friday June 06, 2014 @10:08AM (#7857927)
You could say some effort on the user's part is payment, yeah. Makes sense.
Re:HTTP 402 – Payment Required by dfc on Friday June 06, 2014 @03:00PM (#7859734)
If you download too many videos with youtube-dl you can get this response from yt.com. Currently there is an open bug to handle this gracefully:

Handle youtube CAPTCHAs (402 errors) gracefully: https://github.com/rg3/youtube-dl/issues/154

Re:HTTP 402 – Payment Required by grn on Friday June 06, 2014 @11:27AM (#7858447)
I once led a scraping proxy project that required users to be registered in order to access it. When someone unauthorised tried to use it 402 was returned with a message body giving a bank account number that was a concatenation of consecutive prime numbers. I wonder whether I made someone rich by accident.
Re:HTTP 402 – Payment Required by jayd16 on Friday June 06, 2014 @02:58PM (#7859717)
If your IT director forgets to pay Artifactory, you'll have to turn on verbose logging in maven to see that they're returning a 402 when you try to build your code.

Speaking from experience... -_-;

Re:HTTP 402 – Payment Required by brbcoding on Friday June 06, 2014 @01:01PM (#7859061)
Funny this should show up today. Just got this error yesterday on one of our properties from maxmind, and sure enough, it was a payment issue. First time I'd seen it in use.
Re:HTTP 402 – Payment Required by doki_pen on Friday June 06, 2014 @02:50PM (#7859664)
If you are writing web applications and haven't at least skimmed through the HTTP RFCs, then you worry me deeply.
Re:HTTP 402 – Payment Required by harrisonpowers on Friday June 06, 2014 @09:05AM (#7857612)
Would be great to use in APIs, but some networks truncate 4xx status codes.
Re:HTTP 402 – Payment Required by chrismorgan on Friday June 06, 2014 @09:15AM (#7857647)
Really? Can you give a concrete example of the behaviour observed? (I care as I’m writing the HTTP libraries for Rust.)
Re:HTTP 402 – Payment Required by hnatt on Friday June 06, 2014 @01:25PM (#7859185)