1 # ===================================================================== 2 # openid-climb.sed: scan an HTML document for OpenID metadata. 3 # 4 # Copyright (c) 2008 Carlo Strozzi 5 # 6 # This program is free software; you can redistribute it and/or modify 7 # it under the terms of the GNU General Public License as published by 8 # the Free Software Foundation; version 2 dated June, 1991. 9 # 10 # This program is distributed in the hope that it will be useful, 11 # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 # GNU General Public License for more details. 14 # 15 # You should have received a copy of the GNU General Public License 16 # along with this program; if not, write to the Free Software 17 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 # 19 # ===================================================================== 20 21 # Save original pattern space for later. 22 h 23 24 # Look for ]*= *.\(openid\.server\)[^>]\+ [hH][rR][eE][fF] *= *['"]\([hH][tT][tT][pP][sS]\?://[^'"]\+\).*,\1 \2, 27 28 T1 29 30 # Prevent the whole page content to be stuffed in caller's rc(1) variables, 31 # if either no matches are found in the page or the URL is unacceptably 32 # long. 33 34 s,^\(.\{256\}\).*$,\1, 35 36 # Strip any trailing slashes from URL. 37 s,/\+$,, 38 39 # Be somewhat paranoid regarding hostname syntax by requiring that 40 # it be at least a two-component FQDN. See other paranoid HTTP 41 # library implementations for futher suggestions, like Perl's 42 # LWPx::ParanoidAgent among the others. 43 44 /[hH][tT][tT][pP][sS]\?:\/\/[^.]\+\.[^.]\+/p 45 46 b2 47 48 :1 49 g 50 51 # Look for ]\+= *.\(openid\.server\)['"].*,\2 \1, 54 55 T2 56 57 # Prevent the whole page content to be stuffed in caller's rc(1) variables, 58 # if either no matches are found in the page or the URL is unacceptably 59 # long. 60 61 s,^\(.\{256\}\).*$,\1, 62 63 # Strip any trailing slashes from URL. 64 s,/\+$,, 65 66 # Be somewhat paranoid regarding hostname syntax by requiring that 67 # it be at least a two-component FQDN. See other paranoid HTTP 68 # library implementations for futher suggestions, like Perl's 69 # LWPx::ParanoidAgent among the others. 70 71 /[hH][tT][tT][pP][sS]\?:\/\/[^.]\+\.[^.]\+/p 72 73 :2 74 g 75 76 # Look for ]*= *.\(openid\.delegate\)[^>]\+ [hH][rR][eE][fF] *= *['"]\([hH][tT][tT][pP][sS]\?://[^'"]\+\).*,\1 \2, 79 80 T3 81 82 # Prevent the whole page content to be stuffed in caller's rc(1) variables, 83 # if either no matches are found in the page or the URL is unacceptably 84 # long. 85 86 s,^\(.\{256\}\).*$,\1, 87 88 # Strip any trailing slashes from URL. 89 s,/\+$,, 90 91 # Be somewhat paranoid regarding hostname syntax by requiring that 92 # it be at least a two-component FQDN. See other paranoid HTTP 93 # library implementations for futher suggestions, like Perl's 94 # LWPx::ParanoidAgent among the others. 95 96 /[hH][tT][tT][pP][sS]\?:\/\/[^.]\+\.[^.]\+/p 97 b4 98 99 :3 100 g 101 102 # Look for ]\+= *.\(openid\.delegate\)['"].*,\2 \1, 105 106 T4 107 108 # Prevent the whole page content to be stuffed in caller's rc(1) variables, 109 # if either no matches are found in the page or the URL is unacceptably 110 # long. 111 112 s,^\(.\{256\}\).*$,\1, 113 114 # Strip any trailing slashes from URL. 115 s,/\+$,, 116 117 # Be somewhat paranoid regarding hostname syntax by requiring that 118 # it be at least a two-component FQDN. See other paranoid HTTP 119 # library implementations for futher suggestions, like Perl's 120 # LWPx::ParanoidAgent among the others. 121 122 /[hH][tT][tT][pP][sS]\?:\/\/[^.]\+\.[^.]\+/p 123 124 :4 125 126 # EOF