Help using Base SAS procedures

SAS does not recongnize periods at the end of an encrypted URL.

Reply
Occasional Contributor
Posts: 9

SAS does not recongnize periods at the end of an encrypted URL.

I'm trying to use URL to open an encrypted hyperlink that has two periods at the end of the URL.  The Two periods are necessary for the program on the web server.  It appears that SAS does not recognize the two periods that are in my URL because when I click on the URL Link in my SAS log, the URL that shows in the browser does not have any periods on the end.

Does anyone have any suggestions here?


Thanks,

Tyler B

Trusted Advisor
Posts: 1,300

SAS does not recongnize periods at the end of an encrypted URL.

Can you provide a example for the hyperlink, how you are creating the link in SAS and how you are using it?

Occasional Contributor
Posts: 9

Re: SAS does not recongnize periods at the end of an encrypted URL.

I replaced our proprietary loations with the words DUMMY_URL and DUMMY.

FILENAME JUNK                                                     

URL 'http://DUMMY_URL/DUMMY_URL/ENCRYPTEDURL..'

       DEBUG LRECL=8192                                           

       proxy='http://proxy.DUMMY.com';                              

DATA GETD;                                                        

      INFILE JUNK LENGTH=LEN;                                     

      INPUT RECORD $VARYING8192. LEN;                             

      PUT RECORD $VARYING8192. LEN;                               

RUN;                                                              

ENDSAS;                                                           

The .. at the END Of the URL is part of the encryption schema that our web server uses.  When I paste the real URL into my browser with the .. at the end, it works, when I leave the .. off, it gives a 403 Error.  When I look at this in my SAS log (and in the SAS program) when you click on the link, it opens a browser without the .. on the end and the result is a 403 Error.

Here is an example of the same type of program that actually does work:

filename fetch url                                 

  'http://www.textfiles.com/100/actung.hum' DEBUG  

  lrecl=8192;                                

data pgcnt;                                        

  infile fetch length=len;                         

  input record $varying8192. len;                  

  page=1;                                          

RUN;                                               

PROC PRINT DATA=PGCNT;                             

RUN;                                               

ENDSAS;                 

This is the output of the program that does work:

DEBUG INFO:

NOTE: >>> GET http://www.textfiles.com/100/actung.hum HTTP/1.0    

NOTE: >>> Accept: */*.                                            

NOTE: >>> Accept-Language: en                                     

NOTE: >>> Accept-Charset: iso-8859-1,*,utf-8                      

NOTE: >>> User-Agent: SAS/URL                                     

NOTE: >>>                                                         

NOTE: <<< HTTP/1.1 200 OK                                         

NOTE: <<< Date: Thu, 23 Feb 2012 19:33:10 GMT.                    

NOTE: <<< Server: Apache/1.3.42 (Unix).                           

NOTE: <<< Last-Modified: Sun, 01 Aug 1999 17:20:50 GMT.           

                     

DATA READ IN FROM THE WEB PAGE:    

3----+----4----+----5----+----6----+----7----+----8----+----9----+-

OBS    record                                                     

                                                                  

1     ...ACHTUNG!                                                

2     ...--------                                                

3     Das machine is nicht fur gerfingerpoken und mittengrabben. 

4        Ist easy schnappen der Sprinngwerk, blowenfusen und     

5     .     poppencorken mit spitzensparken.                     

6     Ist nicht fur gewerken by das Dummkopfen.  Das rubbernecken

7     . sightseeren keepen hands in das Pockets.                 

8     .  Relaxen und watch das blinkenlights...                  

9                                                                

********************* Bottom of Data ******************************

I am running SAS 9.2 on IBM Mainframe running ZOS.

Any help here is appreciated, thanks,

Tyler

Trusted Advisor
Posts: 1,300

SAS does not recongnize periods at the end of an encrypted URL.

Can you provide a slightly more accurate protrail of the part you call ENCRYPTEDURL..

Where does this value come from?  Is it hardcoded as in your example?

Toms' suggesstion about replacing each period with %2E (urlencoded period) really should provide the desired results if it is the only issue, so I suspect you may have other invalid URL charaters somewhere.

You can try something like the following:

%let urlstring=%sysfunc(urlencode(dummy_url/dummy_url/encryptedurl..));

filename junk url "http://&urlstring" debug lrecl=8192 proxy='http://proxy.dummy.com';

Super User
Super User
Posts: 6,502

Re: SAS does not recongnize periods at the end of an encrypted URL.

Did you try replacing each period with %2E ?

Occasional Contributor
Posts: 9

Re: SAS does not recongnize periods at the end of an encrypted URL.

I just did, it does not work on PC SAS or on the Mainframe.  I still get a 403 forbidden error.  The URL does work when I paste it into a browser with 2 %2E's at the end.

Super User
Posts: 10,543

Re: SAS does not recongnize periods at the end of an encrypted URL.

I don't use URL data so this is just a shot in the dark. Have you tested it with the URL in double quotes instead of single?

It shouldn't make a difference but sometimes...

Occasional Contributor
Posts: 9

Re: SAS does not recongnize periods at the end of an encrypted URL.

You bet, tried it with double and single quotes on the mainframe and in PC SAS.

Thanks for the suggestion,

Super User
Super User
Posts: 6,502

SAS does not recongnize periods at the end of an encrypted URL.

Does it work from PC and not from Mainframe?  Not from SAS at all?

Are you sure your website isn't using some super secret authenication method that SAS doesn't support?

Occasional Contributor
Posts: 9

Re: SAS does not recongnize periods at the end of an encrypted URL.

It fails to work on Mainframe SAS and PC SAS.  Have tried using Single Quotes, Double Quotes, replacing periods with %2E, have tried concatenating the URL with the two periods.  I can read in any normal web page URL and write out the contents to a file (which is what any SAS Web-crawler program does), but I cannot for the life of me figure out how to get this URL to work from SAS.

I appreciate all the suggestions.  I've gone back to the developers that own the web server and asked for a different URL, and I have also asked if they can dump the data to a text file that's in a mainframe data set that I have access to.  I can manually download the data and upload it to the mainframe until I find a work around.

Regarding the authentication, I tried passing USER ID and Password parameters, and that still gave me a 403 error.

I'm sure we'll find a way to get this working one way or another.  In the meantime, I'll do the manual work around.


Thanks again,

PROC Star
Posts: 7,364

Re: SAS does not recongnize periods at the end of an encrypted URL.

Do you know of any publicly accessible sites whose url ends in a double period that the rest of us can test?

Occasional Contributor
Posts: 9

Re: SAS does not recongnize periods at the end of an encrypted URL.

I Googled it, did not find any, I'm checking with our Web guys to see if they can give a URL that's formatted that way that does not return confidential data.

Thanks,

PROC Star
Posts: 7,364

Re: SAS does not recongnize periods at the end of an encrypted URL.

I asked because, according to the standard, I don't think they are allowed see: http://www.faqs.org/rfcs/rfc2396.html

Trusted Advisor
Posts: 1,300

Re: SAS does not recongnize periods at the end of an encrypted URL.

Art,

It may not follow a proper standard but it is totally valid, here is a public link you can test and see that a URL ending with a '..' will work, even unencoded, and be picked up by the webserver.

http://www.urbandictionary.com/define.php?term=blah..

blah.. isn't defined yet.

And to confirm SAS can work with this:

filename blah url 'http://www.urbandictionary.com/define.php?term=blah..' debug lrecl=1000;

data _null_;

infile blah length=len;

input line $varying1000. len;

if prxmatch('/<i>blah../',line)>0 then put _n_= line=;

run;

_N_=91 line=<i>blah..</i> isn't defined <a href="/add.php?word=blah..">yet</a>.

Occasional Contributor
Posts: 9

Re: SAS does not recongnize periods at the end of an encrypted URL.

That URL is blocked by our IT policy at work, I'll try it on my home computer later.  Thanks for the URL!


Tyler

Ask a Question
Discussion stats
  • 14 replies
  • 537 views
  • 0 likes
  • 5 in conversation