Mercurial Hosting > luan
comparison src/luan/modules/url/LuanUrl.java @ 1151:dbb3cb906482
minor
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sun, 04 Feb 2018 18:50:25 -0700 |
parents | 0842b9b570f8 |
children | 668f29bc52ea |
comparison
equal
deleted
inserted
replaced
1150:0842b9b570f8 | 1151:dbb3cb906482 |
---|---|
66 } | 66 } |
67 } | 67 } |
68 } | 68 } |
69 Map auth = getMap(luan,map,"authorization"); | 69 Map auth = getMap(luan,map,"authorization"); |
70 if( auth != null ) { | 70 if( auth != null ) { |
71 if( headers!=null && headers.containsKey("Authorization") ) | 71 if( headers!=null && headers.containsKey("authorization") ) |
72 throw new LuanException( "can't define authorization with header 'Authorization' defined" ); | 72 throw new LuanException( "can't define authorization with header 'authorization' defined" ); |
73 String user = getString(auth,"user"); | 73 String user = getString(auth,"user"); |
74 String password = getString(auth,"password"); | 74 String password = getString(auth,"password"); |
75 if( !auth.isEmpty() ) | 75 if( !auth.isEmpty() ) |
76 throw new LuanException( "unrecognized authorization options: "+auth ); | 76 throw new LuanException( "unrecognized authorization options: "+auth ); |
77 StringBuilder sb = new StringBuilder(); | 77 StringBuilder sb = new StringBuilder(); |
81 if( password != null ) | 81 if( password != null ) |
82 sb.append(password); | 82 sb.append(password); |
83 String val = "Basic " + Base64.getEncoder().encodeToString(sb.toString().getBytes()); | 83 String val = "Basic " + Base64.getEncoder().encodeToString(sb.toString().getBytes()); |
84 if( headers == null ) | 84 if( headers == null ) |
85 headers = new HashMap(); | 85 headers = new HashMap(); |
86 headers.put("Authorization",val); | 86 headers.put("authorization",val); |
87 } | 87 } |
88 Map params = getMap(luan,map,"parameters"); | 88 Map params = getMap(luan,map,"parameters"); |
89 String enctype = getString(map,"enctype"); | 89 String enctype = getString(map,"enctype"); |
90 if( enctype != null ) { | 90 if( enctype != null ) { |
91 if( !enctype.equals("multipart/form-data") ) | 91 if( !enctype.equals("multipart/form-data") ) |