Commit 2321f353 authored by tywldx's avatar tywldx

remove rub

parent e745f343

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

File added
{
"Code": "0",
"Result": {
"Count": 1,
"Hotels": [
{
"HotelId": "50101472",
"LowRate": 1000,
"CurrencyCode": "RMB",
"Distance": 0,
"BookingRules": [
{
"BookingRuleId": 89551,
"TypeCode": "PerRoomPerName",
"DateType": "BookDay",
"StartDate": "2014-01-03T00:00:00+08:00",
"EndDate": "2038-01-19T00:00:00+08:00",
"StartHour": "00:00:00",
"EndHour": "23:59:00",
"Description": "酒店要求每个房间至少提供一名入住客人的姓名"
}
],
"GuaranteeRules": [],
"PrepayRules": [],
"ValueAdds": [
{
"ValueAddId": "51030_05_183827",
"TypeCode": "05",
"IsInclude": true,
"Amount": 0,
"CurrencyCode": "RMB",
"PriceOption": "Percent",
"Price": 15,
"IsExtAdd": false,
"ExtOption": "Money",
"ExtPrice": 0,
"Description": "附加服务:包含服务费;"
}
],
"DrrRules": [],
"Rooms": [
{
"RoomId": "1048",
"Name": "行政楼层豪华间.",
"RatePlans": [
{
"Status": true,
"CustomerType": "All",
"CurrentAlloment": 0,
"InstantConfirmation": false,
"IsLastMinuteSale": false,
"StartTime": "00:00:00",
"EndTime": "23:59:00",
"TotalRate": 1000,
"AverageRate": 1000,
"CurrencyCode": "RMB",
"Coupon": -1,
"NightlyRates": [
{
"Member": 1000,
"Cost": -1,
"Status": false,
"AddBed": -1,
"Date": "2016-08-15T00:00:00+08:00"
}
],
"BookingRuleIds": "89551",
"GuaranteeRuleIds": "",
"ValueAddIds": "51030_05_183827",
"RoomTypeId": "1040",
"HotelCode": "50101472",
"InvoiceMode": "Hotel",
"RatePlanId": 183827,
"RatePlanName": "不 含 早",
"MinAmount": 1,
"MinDays": 1,
"MaxDays": 365,
"PaymentType": "SelfPay"
}
]
}
],
"Gifts": [],
"HAvailPolicys": []
}
]
},
"Guid": "508c2abc-db69-4e50-af84-f1ba1bf88005"
}
\ No newline at end of file
This diff is collapsed.
{
"msg":"NOT FOUND VALID JSON FILE"
}
\ No newline at end of file
{"data":"mkkwzj9eZ5Djt7Nc5AjT3VcWADFUnwgmEH/DLBOvHUDKZ+lQuIZiCDYZXonzzTN1b2XDFnlaXPBEs73v+zWB/HahFRhfCa0RCZwlCLlD0nNMO8JoAcbezNn1clDN9r7N4K9Oj75uK0O1Spj7XRpuT6H7U/G4wbNaFQqE9cPO9eo9sEh7r6Xvs9af5dmg3nxr+Pz1iJys9Ju3IlHvc40XUAMk8h7wnBhEedfh2b3Iub/McCbW+GH5UGSVWO/Q7ruw8cIzokk8OKim6TkedWMgyXhKRyK/d/afR90vhR4tHlSCdPf1eF4Q7czjJemxwH15pHsBvd+nJSndkTW4bYIEilqIrs7K8v7y/qCNgAhSK4g4m/xDP8oUO+TFFSHSIRRrI4wymgaIqoV0dh82wYzAj7avOLm6FP80BxmjixuCj7g=","encryptkey":"UT61C9FWJEo65HWRDkiC+c/y9wmuFLWwLDl2k2O6402zlMfQMvmtS9edaq/aEw/5jDV5HPDLmo8ITcD8nCeOms9fLRmhCVUzRFL3QJLgy/L4nX/knLzS++lX1SmnpWuyERsO/x6Ffep/J8DSdqQEp8d8oPoW95RTCAkwgTlWxOE="}
\ No newline at end of file
{"data":"rqTp08JqRJ6PLUSO7vAF2mK1KRsUeEkw3f44MflK/v6SwSYg/G4ZPARm9fhX182aAeDPiCXaFYPwh1S11yJZKh5eYc1cPnF5K8EP6Ia7LDLjekVKzN+BPnlbGlP6rTUBsVsJRuiLQW1fg+jXfkvv5ZDbpxnlKg/++3cD9aruYhALvw/WevgQArXy8BRXHEJywrzFh4AxAfJq2wLXOApaWRaGS0DtYeKhibcxJ7Dy8JmCZ336Tv6PcuqSbeMFSI5envTFDBvD/95oW3gwETH4fyCe3aFYhOtjKlchC17EUytDiRu4ypZNti2mCvINjIdhxXHlnvbb2cduLTqgK6soB7wi6suh0nGIPGugFSPWFyhRdKRs5udner4FSiWSpl/reOEDFNFu3Md7eBruynpk8w==","encryptkey":"faT4I5xbcajX4txNjZmlgaYWYmCZY1eVN6ZgO6R31C2iIcTkYHEbkm6Qz0vhjAHiAjISFFsMo+5Hkm+11a2grBJBfjNLE84BmVA9h14Ax5Xq1VFVNzXJWnz12PKcUy41ZnLMq0yDrEku+8Qu5V0y59A4yttfPyO3uxoLhieO5oI="}
\ No newline at end of file
{"data":"Rm/G6WgIpmShaIZrT94MABQJvei1v3ENnGaYOXANjzi9NcfBycHowLyoZXg0R6WyP5lBR3+IXhcpE9oayOiuGdgRTPyzCWsZKT/mdAd46i59FQ1GE0K7l6tznyxBWgSB3vuFuZG5K7V/vHMCo1qS0zewMbMv9Wph8/YZwwvMwbYDQ7XRWFypp4kZjVYGuSOhaxD3R/CCrXtmBUvojlVmwHS/QmeRfR8RqvQOopi1sdRemmD3sPSlLBpifcc66A2uVBI+gvf3hAsmVJun0ZV50chaclSU7Ae0Yqa98OEtg5JsKV7ct5b9jthDisnmns3s","encryptkey":"c8ebBbMlBizYDY5qsK/se1vPoXhkiPmVzuBrE8+30mHJlwQBeUJ18dgku9kQ6Gjmlw3KisYBawosO7na7iz8XWMvAXrMOXbq4W0Ml85zQbMrhJPsPyqwLX2v9/Trq7zLo9BAdDwDR5RdJThu7pDsd6d5H5lpPwvULeq05Loqpx0="}
\ No newline at end of file
{
"msg":"NOT FOUND VALID JSON FILE"
}
\ No newline at end of file
{"data":"s7NATmIpP42mgK3ycM9PKmOTQAMMeGVXZFV6N3sDRna/SjGC9/WdXO0WLnU/awB3gBJq5eu35UXkVeVcvjWqU4MKwbnaJzi+4+vaTalSBuP7+Y3GKaFT0h3jbTinT4zXl8XK9o7DyoLUD8LO3a+fbZDgU488POYtcWqWY5h4TpounQW/Ia9JjBye27rX1Jvc7jx19tY2XmFyd+EhWNxE4ES4DEpgIDYxNF6MpnLOwl2KXhmKCUNcxQLLW7oRiHuYlSXMAKGJrMblHrOQjTEPdl0h+zazf+OlP28molylcXk9gJYeG96rNdy4MAq+BLylH0YB/q34+2eGDrCvaKqHI3M1n/kkvnVH7LR5B35iALQidJa5eMTRzdKDRV9z+6QMob4nh54kXZiw9OGxmlTztluLAQzBoWGl0XiPvWy97P+NU5O4dWMyT0e9ZJuro73s59iCMfFXgjY2UOJ5QbhFtHfCSjQUiYui4rrU9K9QPVd3jW4L63D5BvRLH6xYbHh/","encryptkey":"ctEzYqNThpG3vAFmgohqC31KB2Zyr4xEfPE3Mbn+XDBJ3QVBrL49Ix8ywew0Wf+SYMUi4FTzfE4DRXj9vA7Mua4GmPmGy1QxoREGakI+icGvfFs6dqc+9fwGZ6sRbDuLk0e0/R04ILsPX2rTCnr8b+FXEQJ7Coe14CNES3U1MQo="}
\ No newline at end of file
{
"msg":"NOT FOUND VALID JSON FILE"
}
\ No newline at end of file
{"data":"jaEY2KrB1OwAUR+2rqPuMJAdblcgBz5MZD1BMXnzz41Brxh7zjGyf8WpLkk61ScuT2JV9BX3PMPZoaQ+6K+sfFkijJVRFxa2w75wdNPejjt6by9WuLMvRN0QO3wxSdiHuoCyvlfIwvh8HxPqxOhLxUMJJAxfh+8OagnZLuT98X0JIRoy7xnsdcBqvjTtHvkKxjJk5rRdcXZT1c9aPJWvb7bKan3C13zCcbUWONubmZ8JT6Q8+hjyELkBg5MwLzp1ysUUqD7ILgxMXlCPaM6AabtiSiNOQQlua+r73mESMebJZbDkXOPuCxkgBDG10LuNB8I1BBMZ3dWe4EoZAY0pJEXezn4b3uYQ77dZAPVUpxQ=","encryptkey":"N1nsBerhhvpxC6U4+yd4Y2+1Dksl+HZi37z1vGQGXbqLWUGDEw6zizxW9sp5epXaWEX3v0ny1cO5SPGXrFsgaPI+5CJT1cQ6MYMjbdeIo99Mujj3i7tIm6rnlBDDybRDS0gSaB4CR508nhRsaAiDrXGn/MfhNwK/Uv3mwFZ9QUg="}
\ No newline at end of file
{"data":"0UaDh9LblxMz7O+hFr9tgnGHSJQpgMEQh32//XOFrve5aZ3w2/BRWz3yPm0WjYysB25HSzGDjK7bUHLOqD9SeE8LFVuVOxePlUUXyhpeSUS6i8HJ18C9UHqXosh94+ThYSB1QxgDZy3CdvjUpXRpAX2+c/Qfzjmd0ER6OcC7RMlcH4BRa6h7vOJsTfzzI/mMDQrEOetxkAq7YmgqQpVmVE7rsl+y6VBsGIOw7639FpHvGFw7gyTuXJb13rDHuGPiFkbWAtL9suDLOQLUZ43wOD5jWVRawZWlHZPlkMii4c0V6byJwPOomhlx3bXH2HnvHNpFcVXZmtZdv1R/7IJDWS1SLwIwNHSmhKVgAsFLl/bT3bPtEaaWz+37V0AH6YyE","encryptkey":"JdKTwA5Iz9enRGKjtdiov/irYdX6D47S8r8L0tnmUBRF8cEI3B9b1w85k9xIsbhrwvc63JSSkEirIUPdm3CrznW4g6hLpaZ4PTbcxfr65Zf2/oPwdo55GEGkFpRYzX6XGliUPFb8pPm29tkJGj3w7XwajGaLlpDnQkiXTQBsDaQ="}
\ No newline at end of file
{
"msg":"NOT FOUND VALID JSON FILE"
}
\ No newline at end of file
{"data":"DUpT9ZVdGdFtkiDwkV5FBy0M4R4z4YcwHIKcBteYyGNiep1RoYFvDQ9xshRkD4z74KBoKRZYJgyRdyeGnlHiR4JEpPvAkZDNhtLuj+HTJy40GcL4h4FYkZThXg/T/D6UoXavPPhz+AzZzGVEwzlW7181rOHRFtqzbfb22L3TFSrhXKDU9zOJFXwaTfH9+WHKODHHoVOjzmBgx8XqVrr1Qgq7k7GPl/rCH8zOdtl6A2wHyn5bN0/O2uWF23HbMfrhLmSzjEwkYO88rVrpol9cwNvwERmlvTpHNkimIk0bV00iE/D85tLfSW7WMjZaSqXIg8WCBQYphmGauE6WzSLunI+Mt/DsEwIEXupKbpCe9viATqrZVJ14qDUH9GPbuQ6JdSgca+GLPCPh9gCIFPx/J+BbpPdRRD7goEtOGplN8jl3DaqXvXSXeaQuZRuE93tkCsJXCZxLF1bb2lxj5Di/VlKyBj2/DMRrTVAFHq6g/gQDQ0yyifKxMc0S7S2Ei2Ib9zV47RrzEMm49viYv8dUxJs5uu/0mQ1SiCHjOc3tJvoXaXv6kjj4AGH88n4twEj6azdx4rEkjjIYZZKHX6tx+n8Ptx16zpXQywRIBjK+CVDRO40Xr02VqsRxYXoukCIZ","encryptkey":"Z9PTP1QBVuKyrGZCGlyA6cA/FHTLfew4kxay51TnjuoZIf/AQq32gScIbGKE5a2Hnie28WOFl0NZlRJMpbfS/zgR62oHI5SjaTjU4nwjrkTwPqLhqhqpjKItT8wTzcfPNIVlxz1Xb1VlO+0QV5CvN3GPM4MT3+6zGQdXkPVJS8g="}
\ No newline at end of file
{"data":"rXKvZtISfL3C3ZMER6JukgtkBwwFn9DoqJ5f69OEnK1ESrNa8cNEwvnxGxrniEK27O3+VL5qmd/eGeg9Lanjfy8VuatsorCsWxlDmWYtE9WzJDtbL0Hh3dswNUUnJ7eKRtkIPonYwqeoMS1zIyaljSBbNgg6xmyGZAIsRxQALcDPSmEeslhN2nTqI1qi/2wFHqgYqaCQH60XgBkpQwqmC1zsN71/rO6gRBENXZxDstiQ5k/MT4oveTYeI2rqJzMpcnlDCoUbLkP+uRPWDZBYu0wrCsbshNhbquQwpIGtElxRL8WCL+bSWnJcLm5XxnqjWMqYh5Uew0CvG7BwXxwyevJ/xS+TKDYok27OAZhcz9M8VBK8BtBBUPvTtooMZxvs","encryptkey":"eePwoo7DuL4q87sLI8giIAkuBe9T3Wyn9M3hsLK+Uh2vvg8rDauEXxkyb+9Nl+dK9/RTsjC7tAXHjVlVNOwVlczlVLguRhbg1a+6nkwkNmCVhM/3lGyBYSqWOs7ktNSZfBcqK6/JbujtsAWFpFRTShj8S14uPMXRWEjHB+wyHg0="}
\ No newline at end of file
{"data":"3Pp1DPPH/u4CmcQzrj/XnafpJtGiDEXMfSzcrrhG/okUSl0VjtdMq3Kz+BVOcxmDLQ2WCLyLIb16+gR+Yy/Bj9FwuoAwHNljTqRMZeI/5ODmVKep2g1q6c5x9r2eykFJy+H6QcaUXeuwB89tAM11GfnFU0L8KELLGhqJz3chzU4dtkXXX7+flotCuK/OxT8MFhsGuYrzzAfwIXIO8d+NTQNTLpIV+KQ299yVeLUzfd9CznuyVor7gODdVphhM2h37kxAgcgbpgeg0SzXlq8zpRHXxC+aqzORauW2dU7pAt+Ty25K36AjTA/r3RDpoFY/D1+juhdBXF6ZGoT9lWq56UOe8yuOOOzXpWXC5tDr2i/6OU4ffCq6jolI2uxGMqrIeClugd1GI4Ts1i5dORdSMJq7kN5vgZ77lA0KQRjN2ymVHHl6l3RGobsXKB1VhVEmQDs8DcIic0IuckDT+D9MMy566LRgJbvKzPLzmnjMjKabyncTPTMrswN3uY5H1/Sx","encryptkey":"OWOpx7Jtc2lagKPNu8d519rvEIsO4ydcEf7PubQAXsNryxsL5r08oxpN1GjMTbvW9yHPi9k22UbZD2BHThLDophkHC+s9Kd6Nd5LXGKwknkeS7JzYR8LEO80iQvxYkclkKp/FWvbgMUNvd7t4p7tVx40xq6krEH34tpUevzMX9c="}
\ No newline at end of file
{
"msg": "用户已经成功授权过",
"code": "0000",
"businessCode": "0000",
"data": true,
"success": true
}
# from . import elong_mocker
\ No newline at end of file
#-*- coding: UTF-8 -*-
import sys
sys.path.append("..")
import os
from flask import Flask, jsonify, request,json
from utils.crossdomain import crossdomain
app = Flask(__name__)
mockdir = os.path.dirname(os.path.realpath(__file__))
print mockdir
# ***
# *** 艺龙接口
# ***
# /payapi/rest
@app.route("/payapi/rest", methods=['GET'])
@crossdomain(origin='*')
def login():
if request.method == 'GET':
method = request.args.get('method')
if method == 'hotel.list':
json_data = open(mockdir+'/../json/elong_hotel-list.json')
elif method == 'hotel.detail':
json_data = open(mockdir+'/../json/elong_hotel-detail.json')
else:
print 'Error: method does not exit!'
return jsonify(json.load(json_data))
if __name__ == '__main__':
# 内部监听使用127.0.0.1
# app.run(debug=True, host="127.0.0.1", port=9000)
# 公开IP监听
app.run(debug=True, host="0.0.0.0", port=9001)
#-*- coding: UTF-8 -*-
import sys
sys.path.append("..")
import os
from flask import Flask, jsonify, request,json
from utils.crossdomain import crossdomain
# from OpenSSL import OpenSSL
app = Flask(__name__)
mockdir = os.path.dirname(os.path.realpath(__file__))
# ***
# *** *** *** 1 *** ***
# *** 绑卡请求接口
# *** https://ok.yeepay.com/payapi/api/tzt/invokebindbankcard
# *** HTTP 请求方式:POST
# ***
@app.route("/payapi/api/tzt/invokebindbankcard", methods=['POST', 'OPTIONS'])
@crossdomain(origin='*')
def invokebindbankcard():
if request.method == 'OPTIONS': return ''
if request.method == 'POST':
json_data = open(mockdir+'/../json/yeepay_invokebindbankcard.json')
return jsonify(json.load(json_data))
# ***
# *** *** *** 2 *** ***
# *** 确定绑卡接口
# *** https://ok.yeepay.com/payapi/api/tzt/confirmbindbankcard
# *** HTTP 请求方式:POST
# ***
@app.route("/payapi/api/tzt/confirmbindbankcard", methods=['POST', 'OPTIONS'])
@crossdomain(origin='*')
def confirmbindbankcard():
if request.method == 'OPTIONS': return ''
if request.method == 'POST':
json_data = open(mockdir+'/../json/yeepay_confirmbindbankcard.json')
return jsonify(json.load(json_data))
# ***
# *** *** *** 3: not sure whether be used *** ***
# *** 查询绑卡信息列表
# *** https://ok.yeepay.com/payapi/api/bankcard/authbind/list
# *** HTTP 请求方式:GET
# *** 请求参数:merchantaccount,identityid,identitytype,sign
# ***
@app.route("/payapi/api/bankcard/authbind/list", methods=['GET'])
@crossdomain(origin='*')
def bankcard_authbind_list():
if request.method == 'GET':
json_data = open(mockdir+'/../json/yeepay_bankcard_authbind_list.json')
return jsonify(json.load(json_data))
# ***
# *** *** *** 4 *** ***
# *** 银行卡信息查询
# *** https://ok.yeepay.com/payapi/api/bankcard/check
# *** HTTP 请求方式:POST
# *** 请求参数:merchantaccount,cardno,sign
# ***
@app.route("/payapi/api/bankcard/check", methods=['POST'])
@crossdomain(origin='*')
def bankcard_check():
if request.method == 'POST':
json_data = open(mockdir+'/../json/yeepay_bankcard_check.json')
return jsonify(json.load(json_data))
# ***
# *** *** *** 5 *** ***
# *** 支付请求接口
# *** https://ok.yeepay.com/payapi/api/tzt/pay/bind/reuqest
# *** HTTP 请求方式:POST
# *** 请求参数:merchantaccount,orderid,transtime,currency,currency,productname,productname,identityid,identitytype,card_top
# *** card_last,orderexpdate,callbackurl,imeiuserip,ua,sign
# ***
@app.route("/payapi/api/tzt/pay/bind/reuqest", methods=['POST'])
@crossdomain(origin='*')
def pay_bind_request():
if request.method == 'POST':
json_data = open(mockdir+'/../json/yeepay_pay_bind_request.json')
return jsonify(json.load(json_data))
# ***
# *** *** *** 6 *** ***
# *** 发送短信验证码接口
# *** https://ok.yeepay.com/payapi/api/tzt/pay/validatecode/send
# *** HTTP 请求方式:POST
# *** 请求参数:merchantaccount,orderid,sign
# ***
@app.route("/payapi/api/tzt/pay/validatecode/send", methods=['POST'])
@crossdomain(origin='*')
def validatecode_send():
if request.method == 'POST':
json_data = open(mockdir+'/../json/yeepay_validatecode_send.json')
return jsonify(json.load(json_data))
# ***
# *** *** *** 7 *** ***
# *** 确认支付
# *** https://ok.yeepay.com/payapi/api/tzt/pay/confirm/validatecode
# *** HTTP 请求方式:POST
# *** 请求参数:merchantaccount,orderid,validatecode,sign
# ***
@app.route("/payapi/api/tzt/pay/confirm/validatecode", methods=['POST'])
@crossdomain(origin='*')
def confirm_validatecode():
if request.method == 'POST':
json_data = open(mockdir+'/../json/yeepay_confirm_validatecode.json')
return jsonify(json.load(json_data))
# ***
# *** *** *** 8 *** ***
# *** 支付结果查询
# *** https://ok.yeepay.com/payapi/api/query/order
# *** HTTP 请求方式:GET
# *** 请求参数:merchantaccount,orderid,sign
# ***
@app.route("/payapi/api/query/order", methods=['GET'])
@crossdomain(origin='*')
def query_order():
if request.method == 'GET':
json_data = open(mockdir+'/../json/yeepay_query_order.json')
return jsonify(json.load(json_data))
# ***
# *** *** *** 9 *** ***
# *** 提现接口
# *** https://ok.yeepay.com/payapi/api/tzt/withdraw
# *** HTTP 请求方式:POST
# *** 请求参数: TBD
# ***
@app.route("/payapi/api/tzt/withdraw", methods=['GET'])
@crossdomain(origin='*')
def withdraw():
if request.method == 'GET':
json_data = open(mockdir+'/../json/yeepay_withdraw.json')
return jsonify(json.load(json_data))
# ***
# *** *** *** 10 *** ***
# *** 提现查询接口
# *** https://ok.yeepay.com/payapi/api/tzt/drawrecord
# *** HTTP 请求方式:GET
# *** 请求参数:TBD
# ***
@app.route("/payapi/api/tzt/drawrecord", methods=['GET'])
@crossdomain(origin='*')
def drawrecord():
if request.method == 'GET':
json_data = open(mockdir+'/../json/yeepay_drawrecord.json')
return jsonify(json.load(json_data))
# ***
# *** *** *** 11 *** ***
# *** 可提现余额接口
# *** https://ok.yeepay.com/payapi/api/tzt/drawvalidamount
# *** HTTP 请求方式:GET
# *** 请求参数:TBD
# ***
@app.route("/payapi/api/tzt/drawvalidamount", methods=['GET'])
@crossdomain(origin='*')
def drawvalidamount():
if request.method == 'GET':
json_data = open(mockdir+'/../json/yeepay_drawvalidamount.json')
return jsonify(json.load(json_data))
# ***
# *** *** *** 12: not sure whether used *** ***
# *** 支付接口--不发送短验
# *** https://ok.yeepay.com/payapi/api/tzt/directbindpay
# *** HTTP 请求方式:POST
# *** 请求参数:TBD
# ***
@app.route("/payapi/api/tzt/directbindpay", methods=['GET'])
@crossdomain(origin='*')
def directbindpay():
if request.method == 'GET':
json_data = open(mockdir+'/../json/yeepay_directbindpay.json')
return jsonify(json.load(json_data))
# ***
# *** *** *** 13 *** ***
# *** 交易记录查询
# *** https://ok.yeepay.com/merchant/query_server/pay_single
# *** HTTP 请求方式:GET
# *** 请求参数:merchantaccount,orderid,yborderid,sign
# ***
@app.route("/merchant/query_server/pay_single", methods=['GET'])
@crossdomain(origin='*')
def pay_single():
if request.method == 'GET':
json_data = open(mockdir+'/../json/yeepay_pay_single.json')
return jsonify(json.load(json_data))
# ***
# *** *** *** 14: not used in pay-center *** ***
# *** 获取消费清算对账单记录
# *** https://ok.yeepay.com/merchant/query_server/pay_clear_data
# *** HTTP 请求方式:GET
# *** 请求参数:merchantaccount,startdate,enddate,sign
# ***
# @app.route("/merchant/query_server/pay_clear_data", methods=['GET'])
# @crossdomain(origin='*')
# def pay_clear_data():
# if request.method == 'GET':
# json_data = open(mockdir+'/../json/yeepay_pay_clear_data.json')
# return jsonify(json.load(json_data))
# ***
# *** *** *** 15: not used in pay-center *** ***
# *** 退货退款
# *** https://ok.yeepay.com/merchant/query_server/direct_refund
# *** HTTP 请求方式 :POST
# *** 请求参数:amount,currency,cause,merchantaccount,orderid,origyborderid,sign
# ***
# @app.route("/merchant/query_server/direct_refund", methods=['POST'])
# @crossdomain(origin='*')
# def direct_refund():
# if request.method == 'POST':
# json_data = open(mockdir+'/../json/yeepay_direct_refund.json')
# return jsonify(json.load(json_data))
# ***
# *** *** *** 16: not used in pay-center *** ***
# *** 退货退款记录查询
# *** https://ok.yeepay.com/merchant/query_server/refund_single
# *** HTTP 请求方式:GET
# *** 请求参数:merchantaccount,orderid,yborderid,sign
# ***
# @app.route("/merchant/query_server/refund_single", methods=['GET'])
# @crossdomain(origin='*')
# def refund_single():
# if request.method == 'GET':
# json_data = open(mockdir+'/../json/yeepay_refund_single.json')
# return jsonify(json.load(json_data))
# ***
# *** *** *** 17: not used in pay-center *** ***
# *** 获取退款清算对账记录
# *** ttps://ok.yeepay.com/merchant/query_server/refund_clear_data
# *** HTTP 请求方式:GET
# *** 请求参数:merchantaccount,startdate,enddate,sign
# ***
# @app.route("/merchant/query_server/refund_clear_data", methods=['GET'])
# @crossdomain(origin='*')
# def refund_clear_data():
# if request.method == 'GET':
# json_data = open(mockdir+'/../json/yeepay_refund_clear_data.json')
# return jsonify(json.load(json_data))
if __name__ == '__main__':
# 内部监听使用127.0.0.1
# app.run(debug=True, host="127.0.0.1", port=9000)
# 公开IP监听
app.run(debug=True, host="0.0.0.0", port=9002)
#-*- coding: UTF-8 -*-
import sys
sys.path.append("..")
import os
from flask import Flask, jsonify, request,json
from utils.crossdomain import crossdomain
app = Flask(__name__)
mockdir = os.path.dirname(os.path.realpath(__file__))
# ***
# *** *** *** 1 *** ***
# *** 绑卡请求接口
# *** https://ok.yeepay.com/payapi/api/tzt/invokebindbankcard
# *** HTTP 请求方式:POST
# ***
@app.route("/payapi/api/tzt/invokebindbankcard", methods=['POST', 'OPTIONS'])
@crossdomain(origin='*')
def invokebindbankcard():
if request.method == 'OPTIONS': return ''
if request.method == 'POST':
json_data = open(mockdir+'/../json/yeepay_invokebindbankcard.json')
return jsonify(json.load(json_data))
# ***
# *** *** *** 2 *** ***
# *** 确定绑卡接口
# *** https://ok.yeepay.com/payapi/api/tzt/confirmbindbankcard
# *** HTTP 请求方式:POST
# ***
@app.route("/payapi/api/tzt/confirmbindbankcard", methods=['POST', 'OPTIONS'])
@crossdomain(origin='*')
def confirmbindbankcard():
if request.method == 'OPTIONS': return ''
if request.method == 'POST':
json_data = open(mockdir+'/../json/yeepay_confirmbindbankcard.json')
return jsonify(json.load(json_data))
# ***
# *** *** *** 3: not sure whether be used *** ***
# *** 查询绑卡信息列表
# *** https://ok.yeepay.com/payapi/api/bankcard/authbind/list
# *** HTTP 请求方式:GET
# *** 请求参数:merchantaccount,identityid,identitytype,sign
# ***
@app.route("/payapi/api/bankcard/authbind/list", methods=['GET'])
@crossdomain(origin='*')
def bankcard_authbind_list():
if request.method == 'GET':
json_data = open(mockdir+'/../json/yeepay_bankcard_authbind_list.json')
return jsonify(json.load(json_data))
# ***
# *** *** *** 4 *** ***
# *** 银行卡信息查询
# *** https://ok.yeepay.com/payapi/api/bankcard/check
# *** HTTP 请求方式:POST
# *** 请求参数:merchantaccount,cardno,sign
# ***
@app.route("/payapi/api/bankcard/check", methods=['POST'])
@crossdomain(origin='*')
def bankcard_check():
if request.method == 'POST':
json_data = open(mockdir+'/../json/yeepay_bankcard_check.json')
return jsonify(json.load(json_data))
# ***
# *** *** *** 5 *** ***
# *** 支付请求接口
# *** https://ok.yeepay.com/payapi/api/tzt/pay/bind/reuqest
# *** HTTP 请求方式:POST
# *** 请求参数:merchantaccount,orderid,transtime,currency,currency,productname,productname,identityid,identitytype,card_top
# *** card_last,orderexpdate,callbackurl,imeiuserip,ua,sign
# ***
@app.route("/payapi/api/tzt/pay/bind/reuqest", methods=['POST'])
@crossdomain(origin='*')
def pay_bind_request():
if request.method == 'POST':
json_data = open(mockdir+'/../json/yeepay_pay_bind_request.json')
return jsonify(json.load(json_data))
# ***
# *** *** *** 6 *** ***
# *** 发送短信验证码接口
# *** https://ok.yeepay.com/payapi/api/tzt/pay/validatecode/send
# *** HTTP 请求方式:POST
# *** 请求参数:merchantaccount,orderid,sign
# ***
@app.route("/payapi/api/tzt/pay/validatecode/send", methods=['POST'])
@crossdomain(origin='*')
def validatecode_send():
if request.method == 'POST':
json_data = open(mockdir+'/../json/yeepay_validatecode_send.json')
return jsonify(json.load(json_data))
# ***
# *** *** *** 7 *** ***
# *** 确认支付
# *** https://ok.yeepay.com/payapi/api/tzt/pay/confirm/validatecode
# *** HTTP 请求方式:POST
# *** 请求参数:merchantaccount,orderid,validatecode,sign
# ***
@app.route("/payapi/api/tzt/pay/confirm/validatecode", methods=['POST'])
@crossdomain(origin='*')
def confirm_validatecode():
if request.method == 'POST':
json_data = open(mockdir+'/../json/yeepay_confirm_validatecode.json')
return jsonify(json.load(json_data))
# ***
# *** *** *** 8 *** ***
# *** 支付结果查询
# *** https://ok.yeepay.com/payapi/api/query/order
# *** HTTP 请求方式:GET
# *** 请求参数:merchantaccount,orderid,sign
# ***
@app.route("/payapi/api/query/order", methods=['GET'])
@crossdomain(origin='*')
def query_order():
if request.method == 'GET':
json_data = open(mockdir+'/../json/yeepay_query_order.json')
return jsonify(json.load(json_data))
# ***
# *** *** *** 9 *** ***
# *** 提现接口
# *** https://ok.yeepay.com/payapi/api/tzt/withdraw
# *** HTTP 请求方式:POST
# *** 请求参数: TBD
# ***
@app.route("/payapi/api/tzt/withdraw", methods=['GET'])
@crossdomain(origin='*')
def withdraw():
if request.method == 'GET':
json_data = open(mockdir+'/../json/yeepay_withdraw.json')
return jsonify(json.load(json_data))
# ***
# *** *** *** 10 *** ***
# *** 提现查询接口
# *** https://ok.yeepay.com/payapi/api/tzt/drawrecord
# *** HTTP 请求方式:GET
# *** 请求参数:TBD
# ***
@app.route("/payapi/api/tzt/drawrecord", methods=['GET'])
@crossdomain(origin='*')
def drawrecord():
if request.method == 'GET':
json_data = open(mockdir+'/../json/yeepay_drawrecord.json')
return jsonify(json.load(json_data))
# ***
# *** *** *** 11 *** ***
# *** 可提现余额接口
# *** https://ok.yeepay.com/payapi/api/tzt/drawvalidamount
# *** HTTP 请求方式:GET
# *** 请求参数:TBD
# ***
@app.route("/payapi/api/tzt/drawvalidamount", methods=['GET'])
@crossdomain(origin='*')
def drawvalidamount():
if request.method == 'GET':
json_data = open(mockdir+'/../json/yeepay_drawvalidamount.json')
return jsonify(json.load(json_data))
# ***
# *** *** *** 12: not sure whether used *** ***
# *** 支付接口--不发送短验
# *** https://ok.yeepay.com/payapi/api/tzt/directbindpay
# *** HTTP 请求方式:POST
# *** 请求参数:TBD
# ***
@app.route("/payapi/api/tzt/directbindpay", methods=['GET'])
@crossdomain(origin='*')
def directbindpay():
if request.method == 'GET':
json_data = open(mockdir+'/../json/yeepay_directbindpay.json')
return jsonify(json.load(json_data))
# ***
# *** *** *** 13 *** ***
# *** 交易记录查询
# *** https://ok.yeepay.com/merchant/query_server/pay_single
# *** HTTP 请求方式:GET
# *** 请求参数:merchantaccount,orderid,yborderid,sign
# ***
@app.route("/merchant/query_server/pay_single", methods=['GET'])
@crossdomain(origin='*')
def pay_single():
if request.method == 'GET':
json_data = open(mockdir+'/../json/yeepay_pay_single.json')
return jsonify(json.load(json_data))
# ***
# *** *** *** 14: not used in pay-center *** ***
# *** 获取消费清算对账单记录
# *** https://ok.yeepay.com/merchant/query_server/pay_clear_data
# *** HTTP 请求方式:GET
# *** 请求参数:merchantaccount,startdate,enddate,sign
# ***
# @app.route("/merchant/query_server/pay_clear_data", methods=['GET'])
# @crossdomain(origin='*')
# def pay_clear_data():
# if request.method == 'GET':
# json_data = open(mockdir+'/../json/yeepay_pay_clear_data.json')
# return jsonify(json.load(json_data))
# ***
# *** *** *** 15: not used in pay-center *** ***
# *** 退货退款
# *** https://ok.yeepay.com/merchant/query_server/direct_refund
# *** HTTP 请求方式 :POST
# *** 请求参数:amount,currency,cause,merchantaccount,orderid,origyborderid,sign
# ***
# @app.route("/merchant/query_server/direct_refund", methods=['POST'])
# @crossdomain(origin='*')
# def direct_refund():
# if request.method == 'POST':
# json_data = open(mockdir+'/../json/yeepay_direct_refund.json')
# return jsonify(json.load(json_data))
# ***
# *** *** *** 16: not used in pay-center *** ***
# *** 退货退款记录查询
# *** https://ok.yeepay.com/merchant/query_server/refund_single
# *** HTTP 请求方式:GET
# *** 请求参数:merchantaccount,orderid,yborderid,sign
# ***
# @app.route("/merchant/query_server/refund_single", methods=['GET'])
# @crossdomain(origin='*')
# def refund_single():
# if request.method == 'GET':
# json_data = open(mockdir+'/../json/yeepay_refund_single.json')
# return jsonify(json.load(json_data))
# ***
# *** *** *** 17: not used in pay-center *** ***
# *** 获取退款清算对账记录
# *** ttps://ok.yeepay.com/merchant/query_server/refund_clear_data
# *** HTTP 请求方式:GET
# *** 请求参数:merchantaccount,startdate,enddate,sign
# ***
# @app.route("/merchant/query_server/refund_clear_data", methods=['GET'])
# @crossdomain(origin='*')
# def refund_clear_data():
# if request.method == 'GET':
# json_data = open(mockdir+'/../json/yeepay_refund_clear_data.json')
# return jsonify(json.load(json_data))
if __name__ == '__main__':
# 内部监听使用127.0.0.1
# app.run(debug=True, host="127.0.0.1", port=9000)
# 公开IP监听
app.run(debug=True, host="0.0.0.0", port=9002)
#-*- coding: UTF-8 -*-
import os
from flask import Flask, jsonify, request,json
import mockers
from utils.crossdomain import crossdomain
from mockers.elong_mocker import login
app = Flask(__name__)
mockdir = os.path.dirname(os.path.realpath(__file__))
# ***
# *** 信用钱包:mocker server
# ***
@app.route("/run", methods=['GET'])
@crossdomain(origin='*')
def loan():
if request.method == 'GET':
return jsonify(msg='mocker server is started!', success=True)
if __name__ == '__main__':
app.run(debug=True, host="0.0.0.0", port=9000)
# from . import crossdomain
\ No newline at end of file
from datetime import timedelta
from flask import make_response, request, current_app
from functools import update_wrapper
def crossdomain(origin=None, methods=None, headers=None,
max_age=3600, attach_to_all=True,
automatic_options=True):
if methods is not None:
methods = ', '.join(sorted(x.upper() for x in methods))
if headers is not None and not isinstance(headers, basestring):
headers = ', '.join(x.upper() for x in headers)
if not isinstance(origin, basestring):
origin = ', '.join(origin)
if isinstance(max_age, timedelta):
max_age = max_age.total_seconds()
def get_methods():
if methods is not None:
return methods
options_resp = current_app.make_default_options_response()
return options_resp.headers['allow']
def decorator(f):
def wrapped_function(*args, **kwargs):
if automatic_options and request.method == 'OPTIONS':
resp = current_app.make_default_options_response()
else:
resp = make_response(f(*args, **kwargs))
if not attach_to_all and request.method != 'OPTIONS':
return resp
h = resp.headers
h['Server'] = 'Apache-Coyote/1.1'
h['Access-Control-Allow-Origin'] = origin
h['Access-Control-Allow-Methods'] = get_methods()
h['Access-Control-Max-Age'] = str(max_age)
if headers is not None:
h['Access-Control-Allow-Headers'] = headers
else:
h['Access-Control-Allow-Headers'] = 'Origin, No-Cache, x-auth-token, X-Requested-With, If-Modified-Since, Pragma, Last-Modified, Cache-Control, Expires, Content-Type,Authorization'
return resp
f.provide_automatic_options = False
return update_wrapper(wrapped_function, f)
return decorator
\ No newline at end of file
File added
import sys
import paramiko
'''
a wrapper for remote shell
usage:
python rsh.py user host password 'commands'
e.g.
python rsh.py root 192.168.192.206 123456 'cd home/quant_group;ls -a'
'''
if __name__ == '__main__':
recv_nbytes = 1024
args = sys.argv
host, port, user, password = args[1], int(args[2]), args[3], args[4]
command_begin = 4
if '--tag=' in args[4]:
tag = args[4][6:] + ":"
command_begin += 1
else:
tag = ''
remain_args = ''
for arg in args[command_begin:]:
if ' ' not in arg:
remain_args += ' ' + arg
else:
remain_args += ' "' + arg + '" '
print tag + remain_args
def print_err(str_value):
sys.stderr.write(tag + str_value)
sys.stderr.flush()
def print_out(str_value):
sys.stdout.write(tag + str_value)
sys.stdout.flush()
client = paramiko.SSHClient()
client.load_system_host_keys()
client.get_transport()
client.set_missing_host_key_policy(paramiko.WarningPolicy())
client.connect(host, port, user, password)
transport = client.get_transport()
channel = transport.open_session(None)
channel.settimeout(None)
channel.exec_command(remain_args)
while True:
if channel.recv_ready():
ret_str = channel.recv(recv_nbytes)
if len(ret_str) == 0:
break
print_out(ret_str)
if channel.recv_stderr_ready():
ret_str = channel.recv_stderr(recv_nbytes)
if len(ret_str) == 0:
break
print_err(ret_str)
if channel.exit_status_ready():
ret_str = channel.recv(recv_nbytes)
if len(ret_str) != 0:
print_out(ret_str)
ret_str = channel.recv_stderr(recv_nbytes)
if len(ret_str) != 0:
print_err(ret_str)
client.close()
sys.exit(channel.recv_exit_status())
__author__ = 'Miraculous'
import sys
import paramiko
'''
a wrapper for remote scp
usage:
python rscp.py user host password remote_path current_file
'''
if __name__ == '__main__':
try:
args = sys.argv
host, port, user, password = args[1], args[2], args[3], args[4]
file_to_upload = args[5]
remote_path = args[6]
print 'scp: from'+file_to_upload+' to '+remote_path
client = paramiko.SSHClient()
client.load_system_host_keys()
client.get_transport()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect(host, port, user, password)
sftp = client.open_sftp()
sftp.put(file_to_upload, remote_path)
sftp.close()
client.close()
exit(0)
except Exception, e:
sys.stderr.write(e.message)
sys.stderr.flush()
exit(1)
This diff is collapsed.
.PHONY: all install clean
all:
cd /home/qa-deploy-utils/qa_shell_script/TEMP/openresty-1.9.15.1/build/LuaJIT-2.1-20160517 && $(MAKE) TARGET_STRIP=@: CCDEBUG=-g CC=cc PREFIX=/usr/local/openresty/luajit
cd /home/qa-deploy-utils/qa_shell_script/TEMP/openresty-1.9.15.1/build/lua-cjson-2.1.0.4 && $(MAKE) DESTDIR=$(DESTDIR) LUA_INCLUDE_DIR=/home/qa-deploy-utils/qa_shell_script/TEMP/openresty-1.9.15.1/build/luajit-root/usr/local/openresty/luajit/include/luajit-2.1 LUA_CMODULE_DIR=/usr/local/openresty/lualib LUA_MODULE_DIR=/usr/local/openresty/lualib CJSON_CFLAGS="-g -fpic" CC=cc
cd /home/qa-deploy-utils/qa_shell_script/TEMP/openresty-1.9.15.1/build/lua-redis-parser-0.12 && $(MAKE) DESTDIR=$(DESTDIR) LUA_INCLUDE_DIR=/home/qa-deploy-utils/qa_shell_script/TEMP/openresty-1.9.15.1/build/luajit-root/usr/local/openresty/luajit/include/luajit-2.1 LUA_LIB_DIR=/usr/local/openresty/lualib CC=cc
cd /home/qa-deploy-utils/qa_shell_script/TEMP/openresty-1.9.15.1/build/lua-rds-parser-0.06 && $(MAKE) DESTDIR=$(DESTDIR) LUA_INCLUDE_DIR=/home/qa-deploy-utils/qa_shell_script/TEMP/openresty-1.9.15.1/build/luajit-root/usr/local/openresty/luajit/include/luajit-2.1 LUA_LIB_DIR=/usr/local/openresty/lualib CC=cc
cd /home/qa-deploy-utils/qa_shell_script/TEMP/openresty-1.9.15.1/build/nginx-1.9.15 && $(MAKE)
install: all
cd /home/qa-deploy-utils/qa_shell_script/TEMP/openresty-1.9.15.1/build/LuaJIT-2.1-20160517 && $(MAKE) install TARGET_STRIP=@: CCDEBUG=-g CC=cc PREFIX=/usr/local/openresty/luajit DESTDIR=$(DESTDIR)
cd /home/qa-deploy-utils/qa_shell_script/TEMP/openresty-1.9.15.1/build/lua-cjson-2.1.0.4 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_INCLUDE_DIR=/home/qa-deploy-utils/qa_shell_script/TEMP/openresty-1.9.15.1/build/luajit-root/usr/local/openresty/luajit/include/luajit-2.1 LUA_CMODULE_DIR=/usr/local/openresty/lualib LUA_MODULE_DIR=/usr/local/openresty/lualib CJSON_CFLAGS="-g -fpic" CC=cc
cd /home/qa-deploy-utils/qa_shell_script/TEMP/openresty-1.9.15.1/build/lua-redis-parser-0.12 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_INCLUDE_DIR=/home/qa-deploy-utils/qa_shell_script/TEMP/openresty-1.9.15.1/build/luajit-root/usr/local/openresty/luajit/include/luajit-2.1 LUA_LIB_DIR=/usr/local/openresty/lualib CC=cc
cd /home/qa-deploy-utils/qa_shell_script/TEMP/openresty-1.9.15.1/build/lua-rds-parser-0.06 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_INCLUDE_DIR=/home/qa-deploy-utils/qa_shell_script/TEMP/openresty-1.9.15.1/build/luajit-root/usr/local/openresty/luajit/include/luajit-2.1 LUA_LIB_DIR=/usr/local/openresty/lualib CC=cc
cd /home/qa-deploy-utils/qa_shell_script/TEMP/openresty-1.9.15.1/build/lua-resty-dns-0.16 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_LIB_DIR=/usr/local/openresty/lualib INSTALL=/home/qa-deploy-utils/qa_shell_script/TEMP/openresty-1.9.15.1/build/install
cd /home/qa-deploy-utils/qa_shell_script/TEMP/openresty-1.9.15.1/build/lua-resty-memcached-0.14 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_LIB_DIR=/usr/local/openresty/lualib INSTALL=/home/qa-deploy-utils/qa_shell_script/TEMP/openresty-1.9.15.1/build/install
cd /home/qa-deploy-utils/qa_shell_script/TEMP/openresty-1.9.15.1/build/lua-resty-redis-0.24 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_LIB_DIR=/usr/local/openresty/lualib INSTALL=/home/qa-deploy-utils/qa_shell_script/TEMP/openresty-1.9.15.1/build/install
cd /home/qa-deploy-utils/qa_shell_script/TEMP/openresty-1.9.15.1/build/lua-resty-mysql-0.16 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_LIB_DIR=/usr/local/openresty/lualib INSTALL=/home/qa-deploy-utils/qa_shell_script/TEMP/openresty-1.9.15.1/build/install
cd /home/qa-deploy-utils/qa_shell_script/TEMP/openresty-1.9.15.1/build/lua-resty-string-0.09 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_LIB_DIR=/usr/local/openresty/lualib INSTALL=/home/qa-deploy-utils/qa_shell_script/TEMP/openresty-1.9.15.1/build/install
cd /home/qa-deploy-utils/qa_shell_script/TEMP/openresty-1.9.15.1/build/lua-resty-upload-0.09 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_LIB_DIR=/usr/local/openresty/lualib INSTALL=/home/qa-deploy-utils/qa_shell_script/TEMP/openresty-1.9.15.1/build/install
cd /home/qa-deploy-utils/qa_shell_script/TEMP/openresty-1.9.15.1/build/lua-resty-websocket-0.05 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_LIB_DIR=/usr/local/openresty/lualib INSTALL=/home/qa-deploy-utils/qa_shell_script/TEMP/openresty-1.9.15.1/build/install
cd /home/qa-deploy-utils/qa_shell_script/TEMP/openresty-1.9.15.1/build/lua-resty-lock-0.04 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_LIB_DIR=/usr/local/openresty/lualib INSTALL=/home/qa-deploy-utils/qa_shell_script/TEMP/openresty-1.9.15.1/build/install
cd /home/qa-deploy-utils/qa_shell_script/TEMP/openresty-1.9.15.1/build/lua-resty-lrucache-0.04 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_LIB_DIR=/usr/local/openresty/lualib INSTALL=/home/qa-deploy-utils/qa_shell_script/TEMP/openresty-1.9.15.1/build/install
cd /home/qa-deploy-utils/qa_shell_script/TEMP/openresty-1.9.15.1/build/lua-resty-core-0.1.6 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_LIB_DIR=/usr/local/openresty/lualib INSTALL=/home/qa-deploy-utils/qa_shell_script/TEMP/openresty-1.9.15.1/build/install
cd /home/qa-deploy-utils/qa_shell_script/TEMP/openresty-1.9.15.1/build/lua-resty-upstream-healthcheck-0.04 && $(MAKE) install DESTDIR=$(DESTDIR) LUA_LIB_DIR=/usr/local/openresty/lualib INSTALL=/home/qa-deploy-utils/qa_shell_script/TEMP/openresty-1.9.15.1/build/install
cd /home/qa-deploy-utils/qa_shell_script/TEMP/openresty-1.9.15.1/build/resty-cli-0.12 && /home/qa-deploy-utils/qa_shell_script/TEMP/openresty-1.9.15.1/build/install bin/* $(DESTDIR)/usr/local/openresty/bin/
cp /home/qa-deploy-utils/qa_shell_script/TEMP/openresty-1.9.15.1/build/resty.index $(DESTDIR)/usr/local/openresty/
cp -r /home/qa-deploy-utils/qa_shell_script/TEMP/openresty-1.9.15.1/build/pod $(DESTDIR)/usr/local/openresty/
cd /home/qa-deploy-utils/qa_shell_script/TEMP/openresty-1.9.15.1/build/nginx-1.9.15 && $(MAKE) install DESTDIR=$(DESTDIR)
clean:
rm -rf build
Name
README-win32 - README for the Windows 32-bit build of OpenResty
Description
The binary distributions of OpenResty can be downloaded from the
following web page:
https://openresty.org/#Download
To start the NGINX server of the nginx server of the Win32 binary
distribution of OpenResty:
start nginx
You can also specify the "-p PATH/" option to override the default
server prefix, as in
cd /path/to/my/openresty/app/
start nginx -p $PWD
Then you can use the "tasklist" command to check the nginx processes
running in the background:
C:\> tasklist /fi "imagename eq nginx.exe"
Image Name PID Session Name Session# Mem Usage
========================= ======== ================ =========== ============
nginx.exe 4616 Console 1 7,412 K
nginx.exe 5836 Console 1 7,800 K
One of the two processes is the master process while the other is the
worker.
If you are using the MSYS bash instead of the "cmd.exe" console, then
you should replace the "/fi" option with "-fi" in the command above
instead.
You can quickly shut down the server like this:
nginx -s stop
or gracefully shut it down like this:
nginx -s quit
You can also forcibly kill the nginx processes via their PIDs with
"taskkill", as in
C:\> taskkill /pid 5488 /F
where the PID (5488 in this example) can be found via the aforementioned
"tasklist" command.
Again, you should use the form "-pid" and "-F" for the options if you
are in an MSYS bash session.
Similarly, you can use the "nginx -s reload" command to reload nginx
configurations without stopping the server. And you can use "nginx -s
reopen" to instruct nginx to re-open all the log files.
You can run the "resty" script like this:
C:\> resty -e "ngx.say('Hello, OpenResty!')"
Hello, OpenResty!
The "resty" command-line utility requires a Perl interpreter installed
in your system and visible to your PATH environment. Any perl
distributions should work, including StrawberryPerl, ActivePerl, and
MSYS perl (the former two are recommended though).
Debugging
Debug symbosl are enabled even in release builds. So that when things go
very wrong, one can still debug things with tools like MSYS GDB.
Inclusion of debug symbols make the binary files (".exe" and ".dll"
files) much larger, but it generally will not load into memory during
normal execution on a modern operating system.
Caveats
The Win32 port of the NGINX core supports the good old "select" IO
multiplexing mechanism only. The I/O Completion Ports (IOCP) feature is
*not* supported (yet). So do not use this build for production
environments with very high concurrency levels.
This Win32 build of OpenResty is mainly for developers who want to
develop their applications in native Windows environment (though they
eventually push the finished work onto a Linux or *BSD box, most of the
time).
TODO
* Add support for more than one NGINX worker processes.
* Add support for concurrent connections more than 1024.
* Switch to the Microsoft Visual Studio compiler toolchain for better
performance and easier binary package redistribution.
* Bundle StrawberryPerl to make command-line utilities like "resty"
work out of the box (without manually installing a Perl).
* Deliver an alternative Win32 binary package built with best debuggin
capabilities (like enabling NGINX debugging logs, disabling C
compiler optimizations, and enabling all the assertions and checks).
* Deliver binary packages for 64-bit Windows (Win64).
Details About The Building Process
Usually you do not need to worry about how the Win32 binaries were built
on the maintainers'' side. But if you do, please read on.
The Win32 build of OpenResty is currently built via the MinGW/MSYS
toolchain, including MinGW gcc 4.8.1, MSYS perl, MSYS bash, MSYS make,
and etc. Basically, it is currently built via the following cmmands:
mkdir -p objs/lib || exit 1
cd objs/lib || exit 1
ls ../../..
tar -xf ../../../openssl-1.0.2d.tar.gz
tar -xf ../../../zlib-1.2.8.tar.gz
tar -xf ../../../pcre-8.37.tar.gz
cd ../..
./configure --with-cc=gcc \
--prefix= \
--with-cc-opt='-DFD_SETSIZE=1024' \
--with-select_module \
--with-ipv6 \
--sbin-path=nginx.exe \
--with-pcre-jit \
--with-luajit-xcflags="-DLUAJIT_NUMMODE=2 -DLUAJIT_ENABLE_LUA52COMPAT" \
--with-pcre=objs/lib/pcre-8.37 \
--with-zlib=objs/lib/zlib-1.2.8 \
--with-openssl=objs/lib/openssl-1.0.2d \
-j5
make
make install
where the dependency library source tarballs for OpenSSL, Zlib, and PCRE
are downloaded from their official sites, respectively.
We automate these commands in a dedicated shell script named
build-win32.sh
<https://github.com/openresty/openresty/blob/master/util/build-win32.sh>
.
Furthermore, we automate the packaging process of the resulting binaries
and supporting files with this package-win32.sh
<https://github.com/openresty/openresty/blob/master/util/package-win32.s
h> script.
Usually you can just download and use the binary distribution of
OpenResty without installing the build toolchain.
Author
Yichun "agentzh" Zhang <agentzh@gmail.com>, CloudFlare Inc.
Copyright & License
This module is licensed under the BSD license.
Copyright (C) 2015-2016, by Yichun "agentzh" Zhang (章亦春)
<agentzh@gmail.com>, CloudFlare Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Name
====
OpenResty - Turning Nginx into a Full-Fledged Scriptable Web Platform
Table of Contents
=================
* [Name](#name)
* [Description](#description)
* [For Users](#for-users)
* [For Bundle Maintainers](#for-bundle-maintainers)
* [Mailing List](#mailing-list)
* [Report Bugs](#report-bugs)
* [Copyright & License](#copyright--license)
Description
===========
OpenResty is a full-fledged web application server by bundling the standard nginx core,
lots of 3rd-party nginx modules, as well as most of their external dependencies.
This bundle is maintained Yichun Zhang (agentzh).
Because most of the nginx modules are developed by the bundle maintainers, it can ensure
that all these modules are played well together.
The bundled software components are copyrighted by the respective copyright holders.
The homepage for this project is http://openresty.org.
For Users
---------
Visit http://openresty.org/#Download to download the latest bundle tarball, and
follow the installation instructions in the page http://openresty.org/#Installation.
For Bundle Maintainers
----------------------
The bundle's source is at the following git repository:
https://github.com/openresty/openresty
To reproduce the bundle tarball, just do
```bash
make
```
at the top of the bundle source tree.
Please note that you may need to install some extra dependencies, like `perl` and `dos2unix`.
On Fedora 22, for example, installing the dependencies
is as simple as running the following commands:
```bash
sudo dnf install perl dos2unix
```
[Back to TOC](#table-of-contents)
Mailing List
============
You're very welcome to join the English OpenResty mailing list hosted on Google Groups:
https://groups.google.com/group/openresty-en
The Chinese mailing list is here:
https://groups.google.com/group/openresty
[Back to TOC](#table-of-contents)
Report Bugs
===========
You're very welcome to report issues on GitHub:
https://github.com/openresty/openresty/issues
[Back to TOC](#table-of-contents)
Copyright & License
===================
The bundle itself is licensed under the 2-clause BSD license.
Copyright (c) 2011-2016, Yichun "agentzh" Zhang (章亦春) <agentzh@gmail.com>, CloudFlare Inc.
This module is licensed under the terms of the BSD license.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
[Back to TOC](#table-of-contents)
*.[oa]
*.so
*.obj
*.lib
*.exp
*.dll
*.exe
*.manifest
*.dmp
*.swp
.tags
*~
tags
*.swo
===============================================================================
LuaJIT -- a Just-In-Time Compiler for Lua. http://luajit.org/
Copyright (C) 2005-2016 Mike Pall. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
[ MIT license: http://www.opensource.org/licenses/mit-license.php ]
===============================================================================
[ LuaJIT includes code from Lua 5.1/5.2, which has this license statement: ]
Copyright (C) 1994-2012 Lua.org, PUC-Rio.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
===============================================================================
[ LuaJIT includes code from dlmalloc, which has this license statement: ]
This is a version (aka dlmalloc) of malloc/free/realloc written by
Doug Lea and released to the public domain, as explained at
http://creativecommons.org/licenses/publicdomain
===============================================================================
##############################################################################
# LuaJIT top level Makefile for installation. Requires GNU Make.
#
# Please read doc/install.html before changing any variables!
#
# Suitable for POSIX platforms (Linux, *BSD, OSX etc.).
# Note: src/Makefile has many more configurable options.
#
# ##### This Makefile is NOT useful for Windows! #####
# For MSVC, please follow the instructions given in src/msvcbuild.bat.
# For MinGW and Cygwin, cd to src and run make with the Makefile there.
#
# Copyright (C) 2005-2016 Mike Pall. See Copyright Notice in luajit.h
##############################################################################
MAJVER= 2
MINVER= 1
RELVER= 0
PREREL= -beta2
VERSION= $(MAJVER).$(MINVER).$(RELVER)$(PREREL)
ABIVER= 5.1
##############################################################################
#
# Change the installation path as needed. This automatically adjusts
# the paths in src/luaconf.h, too. Note: PREFIX must be an absolute path!
#
export PREFIX= /usr/local
export MULTILIB= lib
##############################################################################
DPREFIX= $(DESTDIR)$(PREFIX)
INSTALL_BIN= $(DPREFIX)/bin
INSTALL_LIB= $(DPREFIX)/$(MULTILIB)
INSTALL_SHARE= $(DPREFIX)/share
INSTALL_INC= $(DPREFIX)/include/luajit-$(MAJVER).$(MINVER)
INSTALL_LJLIBD= $(INSTALL_SHARE)/luajit-$(VERSION)
INSTALL_JITLIB= $(INSTALL_LJLIBD)/jit
INSTALL_LMODD= $(INSTALL_SHARE)/lua
INSTALL_LMOD= $(INSTALL_LMODD)/$(ABIVER)
INSTALL_CMODD= $(INSTALL_LIB)/lua
INSTALL_CMOD= $(INSTALL_CMODD)/$(ABIVER)
INSTALL_MAN= $(INSTALL_SHARE)/man/man1
INSTALL_PKGCONFIG= $(INSTALL_LIB)/pkgconfig
INSTALL_TNAME= luajit-$(VERSION)
INSTALL_TSYMNAME= luajit
INSTALL_ANAME= libluajit-$(ABIVER).a
INSTALL_SOSHORT1= libluajit-$(ABIVER).so
INSTALL_SOSHORT2= libluajit-$(ABIVER).so.$(MAJVER)
INSTALL_SONAME= $(INSTALL_SOSHORT2).$(MINVER).$(RELVER)
INSTALL_DYLIBSHORT1= libluajit-$(ABIVER).dylib
INSTALL_DYLIBSHORT2= libluajit-$(ABIVER).$(MAJVER).dylib
INSTALL_DYLIBNAME= libluajit-$(ABIVER).$(MAJVER).$(MINVER).$(RELVER).dylib
INSTALL_PCNAME= luajit.pc
INSTALL_STATIC= $(INSTALL_LIB)/$(INSTALL_ANAME)
INSTALL_DYN= $(INSTALL_LIB)/$(INSTALL_SONAME)
INSTALL_SHORT1= $(INSTALL_LIB)/$(INSTALL_SOSHORT1)
INSTALL_SHORT2= $(INSTALL_LIB)/$(INSTALL_SOSHORT2)
INSTALL_T= $(INSTALL_BIN)/$(INSTALL_TNAME)
INSTALL_TSYM= $(INSTALL_BIN)/$(INSTALL_TSYMNAME)
INSTALL_PC= $(INSTALL_PKGCONFIG)/$(INSTALL_PCNAME)
INSTALL_DIRS= $(INSTALL_BIN) $(INSTALL_LIB) $(INSTALL_INC) $(INSTALL_MAN) \
$(INSTALL_PKGCONFIG) $(INSTALL_JITLIB) $(INSTALL_LMOD) $(INSTALL_CMOD)
UNINSTALL_DIRS= $(INSTALL_JITLIB) $(INSTALL_LJLIBD) $(INSTALL_INC) \
$(INSTALL_LMOD) $(INSTALL_LMODD) $(INSTALL_CMOD) $(INSTALL_CMODD)
RM= rm -f
MKDIR= mkdir -p
RMDIR= rmdir 2>/dev/null
SYMLINK= ln -sf
INSTALL_X= install -m 0755
INSTALL_F= install -m 0644
UNINSTALL= $(RM)
LDCONFIG= ldconfig -n
SED_PC= sed -e "s|^prefix=.*|prefix=$(PREFIX)|" \
-e "s|^multilib=.*|multilib=$(MULTILIB)|"
FILE_T= luajit
FILE_A= libluajit.a
FILE_SO= libluajit.so
FILE_MAN= luajit.1
FILE_PC= luajit.pc
FILES_INC= lua.h lualib.h lauxlib.h luaconf.h lua.hpp luajit.h
FILES_JITLIB= bc.lua bcsave.lua dump.lua p.lua v.lua zone.lua \
dis_x86.lua dis_x64.lua dis_arm.lua dis_ppc.lua \
dis_mips.lua dis_mipsel.lua vmdef.lua
ifeq (,$(findstring Windows,$(OS)))
HOST_SYS:= $(shell uname -s)
else
HOST_SYS= Windows
endif
TARGET_SYS?= $(HOST_SYS)
ifeq (Darwin,$(TARGET_SYS))
INSTALL_SONAME= $(INSTALL_DYLIBNAME)
INSTALL_SOSHORT1= $(INSTALL_DYLIBSHORT1)
INSTALL_SOSHORT2= $(INSTALL_DYLIBSHORT2)
LDCONFIG= :
endif
##############################################################################
INSTALL_DEP= src/luajit
default all $(INSTALL_DEP):
@echo "==== Building LuaJIT $(VERSION) ===="
$(MAKE) -C src
@echo "==== Successfully built LuaJIT $(VERSION) ===="
install: $(INSTALL_DEP)
@echo "==== Installing LuaJIT $(VERSION) to $(PREFIX) ===="
$(MKDIR) $(INSTALL_DIRS)
cd src && $(INSTALL_X) $(FILE_T) $(INSTALL_T)
cd src && test -f $(FILE_A) && $(INSTALL_F) $(FILE_A) $(INSTALL_STATIC) || :
$(RM) $(INSTALL_DYN) $(INSTALL_SHORT1) $(INSTALL_SHORT2)
cd src && test -f $(FILE_SO) && \
$(INSTALL_X) $(FILE_SO) $(INSTALL_DYN) && \
$(LDCONFIG) $(INSTALL_LIB) && \
$(SYMLINK) $(INSTALL_SONAME) $(INSTALL_SHORT1) && \
$(SYMLINK) $(INSTALL_SONAME) $(INSTALL_SHORT2) || :
cd etc && $(INSTALL_F) $(FILE_MAN) $(INSTALL_MAN)
cd etc && $(SED_PC) $(FILE_PC) > $(FILE_PC).tmp && \
$(INSTALL_F) $(FILE_PC).tmp $(INSTALL_PC) && \
$(RM) $(FILE_PC).tmp
cd src && $(INSTALL_F) $(FILES_INC) $(INSTALL_INC)
cd src/jit && $(INSTALL_F) $(FILES_JITLIB) $(INSTALL_JITLIB)
$(SYMLINK) $(INSTALL_TNAME) $(INSTALL_TSYM)
@echo "==== Successfully installed LuaJIT $(VERSION) to $(PREFIX) ===="
uninstall:
@echo "==== Uninstalling LuaJIT $(VERSION) from $(PREFIX) ===="
$(UNINSTALL) $(INSTALL_T) $(INSTALL_STATIC) $(INSTALL_DYN) $(INSTALL_SHORT1) $(INSTALL_SHORT2) $(INSTALL_MAN)/$(FILE_MAN) $(INSTALL_PC)
for file in $(FILES_JITLIB); do \
$(UNINSTALL) $(INSTALL_JITLIB)/$$file; \
done
for file in $(FILES_INC); do \
$(UNINSTALL) $(INSTALL_INC)/$$file; \
done
$(LDCONFIG) $(INSTALL_LIB)
$(RMDIR) $(UNINSTALL_DIRS) || :
@echo "==== Successfully uninstalled LuaJIT $(VERSION) from $(PREFIX) ===="
##############################################################################
amalg:
@echo "Building LuaJIT $(VERSION)"
$(MAKE) -C src amalg
clean:
$(MAKE) -C src clean
.PHONY: all install amalg clean
##############################################################################
README for LuaJIT 2.1.0-beta2
-----------------------------
LuaJIT is a Just-In-Time (JIT) compiler for the Lua programming language.
Project Homepage: http://luajit.org/
LuaJIT is Copyright (C) 2005-2016 Mike Pall.
LuaJIT is free software, released under the MIT license.
See full Copyright Notice in the COPYRIGHT file or in luajit.h.
Documentation for LuaJIT is available in HTML format.
Please point your favorite browser to:
doc/luajit.html
/* Copyright (C) 2004-2016 Mike Pall.
*
* You are welcome to use the general ideas of this design for your own sites.
* But please do not steal the stylesheet, the layout or the color scheme.
*/
body {
font-family: serif;
font-size: 11pt;
margin: 0 3em;
padding: 0;
border: none;
}
a:link, a:visited, a:hover, a:active {
text-decoration: none;
background: transparent;
color: #0000ff;
}
h1, h2, h3 {
font-family: sans-serif;
font-weight: bold;
text-align: left;
margin: 0.5em 0;
padding: 0;
}
h1 {
font-size: 200%;
}
h2 {
font-size: 150%;
}
h3 {
font-size: 125%;
}
p {
margin: 0 0 0.5em 0;
padding: 0;
}
ul, ol {
margin: 0.5em 0;
padding: 0 0 0 2em;
}
ul {
list-style: outside square;
}
ol {
list-style: outside decimal;
}
li {
margin: 0;
padding: 0;
}
dl {
margin: 1em 0;
padding: 1em;
border: 1px solid black;
}
dt {
font-weight: bold;
margin: 0;
padding: 0;
}
dt sup {
float: right;
margin-left: 1em;
}
dd {
margin: 0.5em 0 0 2em;
padding: 0;
}
table {
table-layout: fixed;
width: 100%;
margin: 1em 0;
padding: 0;
border: 1px solid black;
border-spacing: 0;
border-collapse: collapse;
}
tr {
margin: 0;
padding: 0;
border: none;
}
td {
text-align: left;
margin: 0;
padding: 0.2em 0.5em;
border-top: 1px solid black;
border-bottom: 1px solid black;
}
tr.separate td {
border-top: double;
}
tt, pre, code, kbd, samp {
font-family: monospace;
font-size: 75%;
}
kbd {
font-weight: bolder;
}
blockquote, pre {
margin: 1em 2em;
padding: 0;
}
img {
border: none;
vertical-align: baseline;
margin: 0;
padding: 0;
}
img.left {
float: left;
margin: 0.5em 1em 0.5em 0;
}
img.right {
float: right;
margin: 0.5em 0 0.5em 1em;
}
.flush {
clear: both;
visibility: hidden;
}
.hide, .noprint, #nav {
display: none !important;
}
.pagebreak {
page-break-before: always;
}
#site {
text-align: right;
font-family: sans-serif;
font-weight: bold;
margin: 0 1em;
border-bottom: 1pt solid black;
}
#site a {
font-size: 1.2em;
}
#site a:link, #site a:visited {
text-decoration: none;
font-weight: bold;
background: transparent;
color: #ffffff;
}
#logo {
color: #ff8000;
}
#head {
clear: both;
margin: 0 1em;
}
#main {
line-height: 1.3;
text-align: justify;
margin: 1em;
}
#foot {
clear: both;
font-size: 80%;
text-align: center;
margin: 0 1.25em;
padding: 0.5em 0 0 0;
border-top: 1pt solid black;
page-break-before: avoid;
page-break-after: avoid;
}
/* Copyright (C) 2004-2016 Mike Pall.
*
* You are welcome to use the general ideas of this design for your own sites.
* But please do not steal the stylesheet, the layout or the color scheme.
*/
/* colorscheme:
*
* site | head #4162bf/white | #6078bf/#e6ecff
* ------+------ ----------------+-------------------
* nav | main #bfcfff | #e6ecff/black
*
* nav: hiback loback #c5d5ff #b9c9f9
* hiborder loborder #e6ecff #97a7d7
* link hover #2142bf #ff0000
*
* link: link visited hover #2142bf #8122bf #ff0000
*
* main: boxback boxborder #f0f4ff #bfcfff
*/
body {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10pt;
margin: 0;
padding: 0;
border: none;
background: #e0e0e0;
color: #000000;
}
a:link {
text-decoration: none;
background: transparent;
color: #2142bf;
}
a:visited {
text-decoration: none;
background: transparent;
color: #8122bf;
}
a:hover, a:active {
text-decoration: underline;
background: transparent;
color: #ff0000;
}
h1, h2, h3 {
font-weight: bold;
text-align: left;
margin: 0.5em 0;
padding: 0;
background: transparent;
}
h1 {
font-size: 200%;
line-height: 3em; /* really 6em relative to body, match #site span */
margin: 0;
}
h2 {
font-size: 150%;
color: #606060;
}
h3 {
font-size: 125%;
color: #404040;
}
p {
max-width: 600px;
margin: 0 0 0.5em 0;
padding: 0;
}
b {
color: #404040;
}
ul, ol {
max-width: 600px;
margin: 0.5em 0;
padding: 0 0 0 2em;
}
ul {
list-style: outside square;
}
ol {
list-style: outside decimal;
}
li {
margin: 0;
padding: 0;
}
dl {
max-width: 600px;
margin: 1em 0;
padding: 1em;
border: 1px solid #bfcfff;
background: #f0f4ff;
}
dt {
font-weight: bold;
margin: 0;
padding: 0;
}
dt sup {
float: right;
margin-left: 1em;
color: #808080;
}
dt a:visited {
text-decoration: none;
color: #2142bf;
}
dt a:hover, dt a:active {
text-decoration: none;
color: #ff0000;
}
dd {
margin: 0.5em 0 0 2em;
padding: 0;
}
div.tablewrap { /* for IE *sigh* */
max-width: 600px;
}
table {
table-layout: fixed;
border-spacing: 0;
border-collapse: collapse;
max-width: 600px;
width: 100%;
margin: 1em 0;
padding: 0;
border: 1px solid #bfcfff;
}
tr {
margin: 0;
padding: 0;
border: none;
}
tr.odd {
background: #f0f4ff;
}
tr.separate td {
border-top: 1px solid #bfcfff;
}
td {
text-align: left;
margin: 0;
padding: 0.2em 0.5em;
border: none;
}
tt, code, kbd, samp {
font-family: Courier New, Courier, monospace;
line-height: 1.2;
font-size: 110%;
}
kbd {
font-weight: bolder;
}
blockquote, pre {
max-width: 600px;
margin: 1em 2em;
padding: 0;
}
pre {
line-height: 1.1;
}
pre.code {
line-height: 1.4;
margin: 0.5em 0 1em 0.5em;
padding: 0.5em 1em;
border: 1px solid #bfcfff;
background: #f0f4ff;
}
pre.mark {
padding-left: 2em;
}
span.codemark {
position:absolute;
left: 16em;
color: #4040c0;
}
span.mark {
color: #4040c0;
font-family: Courier New, Courier, monospace;
line-height: 1.1;
}
img {
border: none;
vertical-align: baseline;
margin: 0;
padding: 0;
}
img.left {
float: left;
margin: 0.5em 1em 0.5em 0;
}
img.right {
float: right;
margin: 0.5em 0 0.5em 1em;
}
.indent {
padding-left: 1em;
}
.flush {
clear: both;
visibility: hidden;
}
.hide, .noscreen {
display: none !important;
}
.ext {
color: #ff8000;
}
.new {
font-size: 6pt;
vertical-align: middle;
background: #ff8000;
color: #ffffff;
}
#site {
clear: both;
float: left;
width: 13em;
text-align: center;
font-weight: bold;
margin: 0;
padding: 0;
background: transparent;
color: #ffffff;
}
#site a {
font-size: 200%;
}
#site a:link, #site a:visited {
text-decoration: none;
font-weight: bold;
background: transparent;
color: #ffffff;
}
#site span {
line-height: 3em; /* really 6em relative to body, match h1 */
}
#logo {
color: #ffb380;
}
#head {
margin: 0;
padding: 0 0 0 2em;
border-left: solid 13em #4162bf;
border-right: solid 3em #6078bf;
background: #6078bf;
color: #e6ecff;
}
#nav {
clear: both;
float: left;
overflow: hidden;
text-align: left;
line-height: 1.5;
width: 13em;
padding-top: 1em;
background: transparent;
}
#nav ul {
list-style: none outside;
margin: 0;
padding: 0;
}
#nav li {
margin: 0;
padding: 0;
}
#nav a {
display: block;
text-decoration: none;
font-weight: bold;
margin: 0;
padding: 2px 1em;
border-top: 1px solid transparent;
border-bottom: 1px solid transparent;
background: transparent;
color: #2142bf;
}
#nav a:hover, #nav a:active {
text-decoration: none;
border-top: 1px solid #97a7d7;
border-bottom: 1px solid #e6ecff;
background: #b9c9f9;
color: #ff0000;
}
#nav a.current, #nav a.current:hover, #nav a.current:active {
border-top: 1px solid #e6ecff;
border-bottom: 1px solid #97a7d7;
background: #c5d5ff;
color: #2142bf;
}
#nav ul ul a {
padding: 0 1em 0 1.7em;
}
#nav ul ul ul a {
padding: 0 0.5em 0 2.4em;
}
#main {
line-height: 1.5;
text-align: left;
margin: 0;
padding: 1em 2em;
border-left: solid 13em #bfcfff;
border-right: solid 3em #e6ecff;
background: #e6ecff;
}
#foot {
clear: both;
font-size: 80%;
text-align: center;
margin: 0;
padding: 0.5em;
background: #6078bf;
color: #ffffff;
}
#foot a:link, #foot a:visited {
text-decoration: underline;
background: transparent;
color: #ffffff;
}
#foot a:hover, #foot a:active {
text-decoration: underline;
background: transparent;
color: #bfcfff;
}
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Contact</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Author" content="Mike Pall">
<meta name="Copyright" content="Copyright (C) 2005-2016, Mike Pall">
<meta name="Language" content="en">
<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
</head>
<body>
<div id="site">
<a href="http://luajit.org"><span>Lua<span id="logo">JIT</span></span></a>
</div>
<div id="head">
<h1>Contact</h1>
</div>
<div id="nav">
<ul><li>
<a href="luajit.html">LuaJIT</a>
<ul><li>
<a href="http://luajit.org/download.html">Download <span class="ext">&raquo;</span></a>
</li><li>
<a href="install.html">Installation</a>
</li><li>
<a href="running.html">Running</a>
</li></ul>
</li><li>
<a href="extensions.html">Extensions</a>
<ul><li>
<a href="ext_ffi.html">FFI Library</a>
<ul><li>
<a href="ext_ffi_tutorial.html">FFI Tutorial</a>
</li><li>
<a href="ext_ffi_api.html">ffi.* API</a>
</li><li>
<a href="ext_ffi_semantics.html">FFI Semantics</a>
</li></ul>
</li><li>
<a href="ext_jit.html">jit.* Library</a>
</li><li>
<a href="ext_c_api.html">Lua/C API</a>
</li><li>
<a href="ext_profiler.html">Profiler</a>
</li></ul>
</li><li>
<a href="status.html">Status</a>
<ul><li>
<a href="changes.html">Changes</a>
</li></ul>
</li><li>
<a href="faq.html">FAQ</a>
</li><li>
<a href="http://luajit.org/performance.html">Performance <span class="ext">&raquo;</span></a>
</li><li>
<a href="http://wiki.luajit.org/">Wiki <span class="ext">&raquo;</span></a>
</li><li>
<a href="http://luajit.org/list.html">Mailing List <span class="ext">&raquo;</span></a>
</li></ul>
</div>
<div id="main">
<p>
Please send general questions to the
<a href="http://luajit.org/list.html"><span class="ext">&raquo;</span>&nbsp;LuaJIT mailing list</a>.
You can also send any questions you have directly to me:
</p>
<script type="text/javascript">
<!--
var xS="@-:\" .0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ<abc>defghijklmnopqrstuvwxyz";function xD(s)
{var len=s.length;var r="";for(var i=0;i<len;i++)
{var c=s.charAt(i);var n=xS.indexOf(c);if(n!=-1)c=xS.charAt(69-n);r+=c;}
document.write("<"+"p>"+r+"<"+"/p>\n");}
//-->
</script>
<script type="text/javascript">
<!--
xD("fyZKB8xv\"FJytmz8.KAB0u52D")
//--></script>
<noscript>
<p><img src="img/contact.png" alt="Contact info in image" width="170" height="13">
</p>
</noscript>
<h2>Copyright</h2>
<p>
All documentation is
Copyright &copy; 2005-2016 Mike Pall.
</p>
<br class="flush">
</div>
<div id="foot">
<hr class="hide">
Copyright &copy; 2005-2016 Mike Pall
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>
</span>
</div>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Lua/C API Extensions</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Author" content="Mike Pall">
<meta name="Copyright" content="Copyright (C) 2005-2016, Mike Pall">
<meta name="Language" content="en">
<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
</head>
<body>
<div id="site">
<a href="http://luajit.org"><span>Lua<span id="logo">JIT</span></span></a>
</div>
<div id="head">
<h1>Lua/C API Extensions</h1>
</div>
<div id="nav">
<ul><li>
<a href="luajit.html">LuaJIT</a>
<ul><li>
<a href="http://luajit.org/download.html">Download <span class="ext">&raquo;</span></a>
</li><li>
<a href="install.html">Installation</a>
</li><li>
<a href="running.html">Running</a>
</li></ul>
</li><li>
<a href="extensions.html">Extensions</a>
<ul><li>
<a href="ext_ffi.html">FFI Library</a>
<ul><li>
<a href="ext_ffi_tutorial.html">FFI Tutorial</a>
</li><li>
<a href="ext_ffi_api.html">ffi.* API</a>
</li><li>
<a href="ext_ffi_semantics.html">FFI Semantics</a>
</li></ul>
</li><li>
<a href="ext_jit.html">jit.* Library</a>
</li><li>
<a class="current" href="ext_c_api.html">Lua/C API</a>
</li><li>
<a href="ext_profiler.html">Profiler</a>
</li></ul>
</li><li>
<a href="status.html">Status</a>
<ul><li>
<a href="changes.html">Changes</a>
</li></ul>
</li><li>
<a href="faq.html">FAQ</a>
</li><li>
<a href="http://luajit.org/performance.html">Performance <span class="ext">&raquo;</span></a>
</li><li>
<a href="http://wiki.luajit.org/">Wiki <span class="ext">&raquo;</span></a>
</li><li>
<a href="http://luajit.org/list.html">Mailing List <span class="ext">&raquo;</span></a>
</li></ul>
</div>
<div id="main">
<p>
LuaJIT adds some extensions to the standard Lua/C API. The LuaJIT include
directory must be in the compiler search path (<tt>-I<i>path</i></tt>)
to be able to include the required header for C code:
</p>
<pre class="code">
#include "luajit.h"
</pre>
<p>
Or for C++ code:
</p>
<pre class="code">
#include "lua.hpp"
</pre>
<h2 id="luaJIT_setmode"><tt>luaJIT_setmode(L, idx, mode)</tt>
&mdash; Control VM</h2>
<p>
This is a C API extension to allow control of the VM from C code. The
full prototype of <tt>LuaJIT_setmode</tt> is:
</p>
<pre class="code">
LUA_API int luaJIT_setmode(lua_State *L, int idx, int mode);
</pre>
<p>
The returned status is either success (<tt>1</tt>) or failure (<tt>0</tt>).
The second argument is either <tt>0</tt> or a stack index (similar to the
other Lua/C API functions).
</p>
<p>
The third argument specifies the mode, which is 'or'ed with a flag.
The flag can be <tt>LUAJIT_MODE_OFF</tt> to turn a feature on,
<tt>LUAJIT_MODE_ON</tt> to turn a feature off, or
<tt>LUAJIT_MODE_FLUSH</tt> to flush cached code.
</p>
<p>
The following modes are defined:
</p>
<h3 id="mode_engine"><tt>luaJIT_setmode(L, 0, LUAJIT_MODE_ENGINE|flag)</tt></h3>
<p>
Turn the whole JIT compiler on or off or flush the whole cache of compiled code.
</p>
<h3 id="mode_func"><tt>luaJIT_setmode(L, idx, LUAJIT_MODE_FUNC|flag)</tt><br>
<tt>luaJIT_setmode(L, idx, LUAJIT_MODE_ALLFUNC|flag)</tt><br>
<tt>luaJIT_setmode(L, idx, LUAJIT_MODE_ALLSUBFUNC|flag)</tt></h3>
<p>
This sets the mode for the function at the stack index <tt>idx</tt> or
the parent of the calling function (<tt>idx = 0</tt>). It either
enables JIT compilation for a function, disables it and flushes any
already compiled code or only flushes already compiled code. This
applies recursively to all sub-functions of the function with
<tt>LUAJIT_MODE_ALLFUNC</tt> or only to the sub-functions with
<tt>LUAJIT_MODE_ALLSUBFUNC</tt>.
</p>
<h3 id="mode_trace"><tt>luaJIT_setmode(L, trace,<br>
&nbsp;&nbsp;LUAJIT_MODE_TRACE|LUAJIT_MODE_FLUSH)</tt></h3>
<p>
Flushes the specified root trace and all of its side traces from the cache.
The code for the trace will be retained as long as there are any other
traces which link to it.
</p>
<h3 id="mode_wrapcfunc"><tt>luaJIT_setmode(L, idx, LUAJIT_MODE_WRAPCFUNC|flag)</tt></h3>
<p>
This mode defines a wrapper function for calls to C functions. If
called with <tt>LUAJIT_MODE_ON</tt>, the stack index at <tt>idx</tt>
must be a <tt>lightuserdata</tt> object holding a pointer to the wrapper
function. From now on all C functions are called through the wrapper
function. If called with <tt>LUAJIT_MODE_OFF</tt> this mode is turned
off and all C functions are directly called.
</p>
<p>
The wrapper function can be used for debugging purposes or to catch
and convert foreign exceptions. But please read the section on
<a href="extensions.html#exceptions">C++&nbsp;exception interoperability</a>
first. Recommended usage can be seen in this C++ code excerpt:
</p>
<pre class="code">
#include &lt;exception&gt;
#include "lua.hpp"
// Catch C++ exceptions and convert them to Lua error messages.
// Customize as needed for your own exception classes.
static int wrap_exceptions(lua_State *L, lua_CFunction f)
{
try {
return f(L); // Call wrapped function and return result.
} catch (const char *s) { // Catch and convert exceptions.
lua_pushstring(L, s);
} catch (std::exception& e) {
lua_pushstring(L, e.what());
} catch (...) {
lua_pushliteral(L, "caught (...)");
}
return lua_error(L); // Rethrow as a Lua error.
}
static int myinit(lua_State *L)
{
...
// Define wrapper function and enable it.
lua_pushlightuserdata(L, (void *)wrap_exceptions);
luaJIT_setmode(L, -1, LUAJIT_MODE_WRAPCFUNC|LUAJIT_MODE_ON);
lua_pop(L, 1);
...
}
</pre>
<p>
Note that you can only define <b>a single global wrapper function</b>,
so be careful when using this mechanism from multiple C++ modules.
Also note that this mechanism is not without overhead.
</p>
<br class="flush">
</div>
<div id="foot">
<hr class="hide">
Copyright &copy; 2005-2016 Mike Pall
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>
</span>
</div>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Status</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Author" content="Mike Pall">
<meta name="Copyright" content="Copyright (C) 2005-2016, Mike Pall">
<meta name="Language" content="en">
<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
<style type="text/css">
ul li { padding-bottom: 0.3em; }
</style>
</head>
<body>
<div id="site">
<a href="http://luajit.org"><span>Lua<span id="logo">JIT</span></span></a>
</div>
<div id="head">
<h1>Status</h1>
</div>
<div id="nav">
<ul><li>
<a href="luajit.html">LuaJIT</a>
<ul><li>
<a href="http://luajit.org/download.html">Download <span class="ext">&raquo;</span></a>
</li><li>
<a href="install.html">Installation</a>
</li><li>
<a href="running.html">Running</a>
</li></ul>
</li><li>
<a href="extensions.html">Extensions</a>
<ul><li>
<a href="ext_ffi.html">FFI Library</a>
<ul><li>
<a href="ext_ffi_tutorial.html">FFI Tutorial</a>
</li><li>
<a href="ext_ffi_api.html">ffi.* API</a>
</li><li>
<a href="ext_ffi_semantics.html">FFI Semantics</a>
</li></ul>
</li><li>
<a href="ext_jit.html">jit.* Library</a>
</li><li>
<a href="ext_c_api.html">Lua/C API</a>
</li><li>
<a href="ext_profiler.html">Profiler</a>
</li></ul>
</li><li>
<a class="current" href="status.html">Status</a>
<ul><li>
<a href="changes.html">Changes</a>
</li></ul>
</li><li>
<a href="faq.html">FAQ</a>
</li><li>
<a href="http://luajit.org/performance.html">Performance <span class="ext">&raquo;</span></a>
</li><li>
<a href="http://wiki.luajit.org/">Wiki <span class="ext">&raquo;</span></a>
</li><li>
<a href="http://luajit.org/list.html">Mailing List <span class="ext">&raquo;</span></a>
</li></ul>
</div>
<div id="main">
<p>
<span style="color: #0000c0;">LuaJIT&nbsp;2.0</span> is the current
<span style="color: #0000c0;">stable branch</span>. This branch is in
feature-freeze &mdash; new features will only be added to LuaJIT&nbsp;2.1.
</p>
<h2>Current Status</h2>
<p>
LuaJIT ought to run all Lua&nbsp;5.1-compatible source code just fine.
It's considered a serious bug if the VM crashes or produces unexpected
results &mdash; please report this.
</p>
<p>
Known incompatibilities and issues in LuaJIT&nbsp;2.0:
</p>
<ul>
<li>
There are some differences in <b>implementation-defined</b> behavior.
These either have a good reason, are arbitrary design choices
or are due to quirks in the VM. The latter cases may get fixed if a
demonstrable need is shown.
</li>
<li>
The Lua <b>debug API</b> is missing a couple of features (return
hooks for non-Lua functions) and shows slightly different behavior
in LuaJIT (no per-coroutine hooks, no tail call counting).
</li>
<li>
Some checks are missing in the JIT-compiled code for obscure situations
with <b>open upvalues aliasing</b> one of the SSA slots later on (or
vice versa). Bonus points, if you can find a real world test case for
this.
</li>
<li>
Currently some <b>out-of-memory</b> errors from <b>on-trace code</b> are not
handled correctly. The error may fall through an on-trace
<tt>pcall</tt> or it may be passed on to the function set with
<tt>lua_atpanic</tt> on x64. This issue will be fixed with the new
garbage collector.
</li>
</ul>
<br class="flush">
</div>
<div id="foot">
<hr class="hide">
Copyright &copy; 2005-2016 Mike Pall
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>
</span>
</div>
</body>
</html>
------------------------------------------------------------------------------
-- DynASM x64 module.
--
-- Copyright (C) 2005-2016 Mike Pall. All rights reserved.
-- See dynasm.lua for full copyright notice.
------------------------------------------------------------------------------
-- This module just sets 64 bit mode for the combined x86/x64 module.
-- All the interesting stuff is there.
------------------------------------------------------------------------------
x64 = true -- Using a global is an ugly, but effective solution.
return require("dasm_x86")
# Package information for LuaJIT to be used by pkg-config.
majver=2
minver=1
relver=0
version=${majver}.${minver}.${relver}-beta2
abiver=5.1
prefix=/usr/local
multilib=lib
exec_prefix=${prefix}
libdir=${exec_prefix}/${multilib}
libname=luajit-${abiver}
includedir=${prefix}/include/luajit-${majver}.${minver}
INSTALL_LMOD=${prefix}/share/lua/${abiver}
INSTALL_CMOD=${prefix}/${multilib}/lua/${abiver}
Name: LuaJIT
Description: Just-in-time compiler for Lua
URL: http://luajit.org
Version: ${version}
Requires:
Libs: -L${libdir} -l${libname}
Libs.private: -Wl,-E -lm -ldl
Cflags: -I${includedir}
luajit
lj_bcdef.h
lj_ffdef.h
lj_libdef.h
lj_recdef.h
lj_folddef.h
lj_vm.[sS]
The files in this directory are only used during the build process of LuaJIT.
For cross-compilation, they must be executed on the host, not on the target.
These files should NOT be installed!
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment