@@ -479,16 +479,14 @@ class UrlParser(object):
479
479
path can also be set and queried.
480
480
481
481
The class also contains reddit-specific functions for setting,
482
- checking, and getting a path's subreddit. It also can convert
483
- paths between in-frame and out of frame cname'd forms.
482
+ checking, and getting a path's subreddit.
484
483
"""
485
484
486
485
__slots__ = ['scheme' , 'path' , 'params' , 'query' ,
487
486
'fragment' , 'username' , 'password' , 'hostname' , 'port' ,
488
487
'_orig_url' , '_orig_netloc' , '_query_dict' ]
489
488
490
489
valid_schemes = ('http' , 'https' , 'ftp' , 'mailto' )
491
- cname_get = "cnameframe"
492
490
493
491
def __init__ (self , url ):
494
492
u = urlparse (url )
@@ -781,51 +779,6 @@ def netloc(self):
781
779
return self .hostname + ":" + str (self .port )
782
780
return self .hostname
783
781
784
- def mk_cname (self , require_frame = True , subreddit = None , port = None ):
785
- """
786
- Converts a ?cnameframe url into the corresponding cnamed
787
- domain if applicable. Useful for frame-busting on redirect.
788
- """
789
-
790
- # make sure the url is indeed in a frame
791
- if require_frame and not self .query_dict .has_key (self .cname_get ):
792
- return self
793
-
794
- # fetch the subreddit and make sure it
795
- subreddit = subreddit or self .get_subreddit ()
796
- if subreddit and subreddit .domain :
797
-
798
- # no guarantee there was a scheme
799
- self .scheme = self .scheme or "http"
800
-
801
- # update the domain (preserving the port)
802
- self .hostname = subreddit .domain
803
- self .port = getattr (self , 'port' , None ) or port
804
-
805
- # and remove any cnameframe GET parameters
806
- if self .query_dict .has_key (self .cname_get ):
807
- del self ._query_dict [self .cname_get ]
808
-
809
- # remove the subreddit reference
810
- self .path = lstrips (self .path , subreddit .path )
811
- if not self .path .startswith ('/' ):
812
- self .path = '/' + self .path
813
-
814
- return self
815
-
816
- def is_in_frame (self ):
817
- """
818
- Checks if the url is in a frame by determining if
819
- cls.cname_get is present.
820
- """
821
- return self .query_dict .has_key (self .cname_get )
822
-
823
- def put_in_frame (self ):
824
- """
825
- Adds the cls.cname_get get parameter to the query string.
826
- """
827
- self .update_query (** {self .cname_get :random .random ()})
828
-
829
782
def __repr__ (self ):
830
783
return "<URL %s>" % repr (self .unparse ())
831
784
0 commit comments