python - Suspected csrf error in Django view using google protocol buffers -
here link proto file.
spent long time trying figure out finer points of how info beingness encoded realise if commented out httpresponse line still received same internal server error message in bitcoin-qt client when sending test deposits:
from django.views.decorators.csrf import csrf_exempt project import payments_pb2 @csrf_exempt def protoresponse(request): x = payments_pb2 xpo = x.payment.fromstring(request.body) xpa = x.paymentack() xpa.payment = xpo xpa.memo = 'success' homecoming httpresponse(xpa.serializetostring(), content_type="application/bitcoin-paymentack") i can see nil wrong code communication error remains, server error "post /protoresponse/ http/1.1" 500 58538.
i placed debug code script check if variables beingness set , worked fine way downwards xpa.memo = ''success' looks error occurring in httpresponse() method. either or getting in way of response.
suspect has csrf, without @csrf_exempt decorator presented "post /protoresponse/ http/1.1" 403 2282 error instead.
any input appreciated :)
i don't know if there csrf error well, have 1 obvious bug here: don't instantiate protobuff object.
xpa = x.paymentack() # note parens there other errors too: showed in my previous answer, xpa.payment supposed protobuff, of type payment, not raw http body. don't know why changed answer.
python django protocol-buffers bitcoin django-csrf
No comments:
Post a Comment