Merge pull request #2944 from gavinandresen/acceptheader

Set Accept: application/bitcoin-paymentrequest header
This commit is contained in:
Gavin Andresen 2013-09-03 19:52:38 -07:00
commit 2fee100f03

View file

@ -48,6 +48,8 @@ using namespace boost;
const int BITCOIN_IPC_CONNECT_TIMEOUT = 1000; // milliseconds const int BITCOIN_IPC_CONNECT_TIMEOUT = 1000; // milliseconds
const QString BITCOIN_IPC_PREFIX("bitcoin:"); const QString BITCOIN_IPC_PREFIX("bitcoin:");
const char* BITCOIN_REQUEST_MIMETYPE = "application/bitcoin-paymentrequest";
const char* BITCOIN_PAYMENTACK_MIMETYPE = "application/bitcoin-paymentack";
X509_STORE* PaymentServer::certStore = NULL; X509_STORE* PaymentServer::certStore = NULL;
void PaymentServer::freeCertStore() void PaymentServer::freeCertStore()
@ -505,6 +507,7 @@ PaymentServer::fetchRequest(const QUrl& url)
netRequest.setAttribute(QNetworkRequest::User, "PaymentRequest"); netRequest.setAttribute(QNetworkRequest::User, "PaymentRequest");
netRequest.setUrl(url); netRequest.setUrl(url);
netRequest.setRawHeader("User-Agent", CLIENT_NAME.c_str()); netRequest.setRawHeader("User-Agent", CLIENT_NAME.c_str());
netRequest.setRawHeader("Accept", BITCOIN_REQUEST_MIMETYPE);
netManager->get(netRequest); netManager->get(netRequest);
} }
@ -520,6 +523,7 @@ PaymentServer::fetchPaymentACK(CWallet* wallet, SendCoinsRecipient recipient, QB
netRequest.setUrl(QString::fromStdString(details.payment_url())); netRequest.setUrl(QString::fromStdString(details.payment_url()));
netRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/bitcoin-payment"); netRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/bitcoin-payment");
netRequest.setRawHeader("User-Agent", CLIENT_NAME.c_str()); netRequest.setRawHeader("User-Agent", CLIENT_NAME.c_str());
netRequest.setRawHeader("Accept", BITCOIN_PAYMENTACK_MIMETYPE);
payments::Payment payment; payments::Payment payment;
payment.set_merchant_data(details.merchant_data()); payment.set_merchant_data(details.merchant_data());