Permalink
Browse files

post user-agent instead of version paramerter

  • Loading branch information...
1 parent 26126b0 commit f383bfef48655c77806d87b75f7814b31e8a616a Isshu Rakusai committed Sep 16, 2010
Showing with 11 additions and 10 deletions.
  1. +11 −10 gyazowin/gyazowin.cpp
View
@@ -816,16 +816,6 @@ BOOL uploadFile(HWND hwnd, LPCTSTR fileName)
buf << idStr;
buf << sCrLf;
- // -- "version" part
- buf << "--";
- buf << sBoundary;
- buf << sCrLf;
- buf << "content-disposition: form-data; name=\"version\"";
- buf << sCrLf;
- buf << sCrLf;
- buf << "WIN 1.0";
- buf << sCrLf;
-
// -- "imagedata" part
buf << "--";
buf << sBoundary;
@@ -885,6 +875,17 @@ BOOL uploadFile(HWND hwnd, LPCTSTR fileName)
szTitle, MB_ICONERROR | MB_OK);
return FALSE;
}
+
+ // User-Agentを指定
+ const TCHAR* ua = _T("User-Agent: Gyazowin/1.0\r\n");
+ BOOL bResult = HttpAddRequestHeaders(
+ hRequest, ua, _tcslen(ua),
+ HTTP_ADDREQ_FLAG_ADD | HTTP_ADDREQ_FLAG_REPLACE);
+ if (FALSE == bResult) {
+ MessageBox(hwnd, _T("Cannot set user agent"),
+ szTitle, MB_ICONERROR | MB_OK);
+ return FALSE;
+ }
// 要求を送信
if (HttpSendRequest(hRequest,

0 comments on commit f383bfe

Please sign in to comment.