Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder3.xlned.com!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.026 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; 'handler': 0.05; 'data:': 0.09; 'instance.': 0.09; 'python': 0.11; 'bits.': 0.16; 'cased': 0.16; 'splitting': 0.16; 'urllib': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'thu,': 0.19; 'seems': 0.21; 'case.': 0.24; 'headers': 0.24; 'versions': 0.24; '(or': 0.24; 'sort': 0.25; "i've": 0.25; 'possibly': 0.26; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; "doesn't": 0.30; 'message-id:@mail.gmail.com': 0.30; 'lines': 0.31; 'apparently': 0.31; 'schemes': 0.31; 'class': 0.32; 'stuff': 0.32; 'supposed': 0.32; 'skip:u 20': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'there': 0.35; 'returning': 0.36; 'subject:data': 0.36; 'doing': 0.36; 'should': 0.36; 'clear': 0.37; 'expected': 0.38; 'handle': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'first': 0.61; 'hang': 0.67; 'default': 0.69; 'special': 0.74; '3.4': 0.84; 'opener': 0.84; 'whereas': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=pmES6GqtztYAM0S6znswTiZXcvRqlojzMSlXNb6xyPY=; b=kjRPritlxKKfp9y1Y9zqEOEzARjgiu5jB8N+ZzOmIkYfVLADWJ8KriJeLIzYyvTM5H RJxr/p+y25Eph5aahf1jJYS/TReGDy7up87cfIf5CucMENhp5VuIzHQF9jRM2vAhQnV4 5zxtOfIcb3GENTDq0F8+COQwmbJ/aIMXgvTxB10/1z7gqUSeE2xye76DYdIQE1R586sQ w7XGHjdNiBGslwLvPdphK9KkGSGr8Gp1EO9doagqcvKpqHH77M3PmkUOwBehGzsxxnId c++rkBMcrTVzxk/2PhyLIjSHsamehcqYgufzziJrYm9BtU8W5x8Zt2zF0a5LYNUUvryo B2TA== X-Received: by 10.66.240.70 with SMTP id vy6mr8709628pac.80.1399561685334; Thu, 08 May 2014 08:08:05 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <536B5D99.1020509@chamonix.reportlab.co.uk> References: <536afe13$0$11109$c3e8da3@news.astraweb.com> <536B5D99.1020509@chamonix.reportlab.co.uk> From: Ian Kelly Date: Thu, 8 May 2014 09:07:25 -0600 Subject: Re: data: protocol To: Python Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 16 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1399561693 news.xs4all.nl 2900 [2001:888:2000:d::a6]:42455 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:71110 On Thu, May 8, 2014 at 4:34 AM, Robin Becker wrote: > Since urllib doesn't always work as expected in 3.3 I've had to write a > small stub for the special data: case. Doing all the splitting off of the > headers seems harder than just doing the special case. > > However, there are a lot of these 'schemes' so should I be doing this sort > of thing? Apparently it's taken 4 versions of python to get urllib in 3.4 to > do this so it's not clear to me whether all schemes are supposed to hang off > urllib.request.urlopen or if instead of special casing the 3.3 data: I > should have special cased a handler for it and injected that into my opener > (or possibly the default opener). Doing the handler means I do have to > handle the headers stuff whereas my stub is just returning the data bits. The DataHandler class in 3.4 is all of 14 lines of code. My first instinct would be to backport that and add it to some OpenerDirector instance.