Software /
code /
prosody
Comparison
net/http.lua @ 4972:1777271a1ec0
net.http: Use base64 from util.encodings instead of luasocket
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 07 Jul 2012 23:22:15 +0200 |
parent | 4865:9171dc2357e0 |
child | 4977:7006ccbf22a9 |
comparison
equal
deleted
inserted
replaced
4944:72a2eec4204a | 4972:1777271a1ec0 |
---|---|
5 -- This project is MIT/X11 licensed. Please see the | 5 -- This project is MIT/X11 licensed. Please see the |
6 -- COPYING file in the source package for more information. | 6 -- COPYING file in the source package for more information. |
7 -- | 7 -- |
8 | 8 |
9 local socket = require "socket" | 9 local socket = require "socket" |
10 local mime = require "mime" | 10 local b64 = require "util.encodings".base64.encode; |
11 local url = require "socket.url" | 11 local url = require "socket.url" |
12 local httpstream_new = require "util.httpstream".new; | 12 local httpstream_new = require "util.httpstream".new; |
13 | 13 |
14 local server = require "net.server" | 14 local server = require "net.server" |
15 | 15 |
152 ["Host"] = req.host; | 152 ["Host"] = req.host; |
153 ["User-Agent"] = "Prosody XMPP Server"; | 153 ["User-Agent"] = "Prosody XMPP Server"; |
154 }; | 154 }; |
155 | 155 |
156 if req.userinfo then | 156 if req.userinfo then |
157 headers["Authorization"] = "Basic "..mime.b64(req.userinfo); | 157 headers["Authorization"] = "Basic "..b64(req.userinfo); |
158 end | 158 end |
159 | 159 |
160 if ex then | 160 if ex then |
161 req.onlystatus = ex.onlystatus; | 161 req.onlystatus = ex.onlystatus; |
162 body = ex.body; | 162 body = ex.body; |