 |
|
 |
I am using the VS2003 to compile the source code. I got the error message
"c:\Documents and Settings\Guaz Wei Kiat\Desktop\HTTPS\w3csample\w3c.cpp(1158): error C2248: 'W3Client::HTTP_COOKIE' : cannot access private typedef declared in class 'W3Client'"
please help me! thanks
|
|
|
|
 |
|
 |
Hello Yongseon,
While searching for Visual C++ based HTTPS samples on Google, I found the sample code "(WWW (HTTP/HTTPS/FTP) Client using WININET)" posted by you. Thank you very much for your sample as it does what I was looking for. I want to explore the possibility of using your code in my program.
The code has no copyright or licensing information. Following is specified in the License section of the Sample
"License
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below."
I'll appreciate if you can clarify if there are any licensing/copyright restrictions considering that I will be integrating the code in my product and may be required to modify the code.
Thanks and Regards,
Prasanna
|
|
|
|
 |
|
 |
thanks.
license is changed.
;p
|
|
|
|
 |
|
 |
1'st - thanks for the great article. It really helped me a lot.
There is a small issue with cookies: the code does not actually set the cookies for the session. when a cookie is added it is simply placed on the list, and before the connection is started the elements of the list are traversed but not actually used for anything.
I modified the code as follows, and it seems to do the trick:
void W3Client::InitializeCookies() {
if(_listcookies.size()>0){
for(list<HTTP_COOKIE*>::iterator it=_listcookies.begin(); it!=_listcookies.end(); it++){
HTTP_COOKIE *p=reinterpret_cast<HTTP_COOKIE*>(*it);
InternetSetCookie(p->name.c_str(), NULL, p->value.c_str());
delete p;
}
_listcookies.clear();
}
return;
}
|
|
|
|
 |
|
 |
I use AsyncW3Client to try async function like the following code.
AsyncW3Client w;
if(w.Connect("http://atnotes.free.fr/zips/tradchin.zip", __getstatus)){
if(w.Request("/")){
TCHAR buf[1024]="\0";
while( w.Response(reinterpret_cast(buf), 1024))
cout << buf << endl;
}
}
I have some bugs/question on it.
1. The w.Request always reads nothing.
2. No receiving INTERNET_STATUS_REQUEST_COMPLETE event on callback function.
Please help me on this, thank you all very much.
|
|
|
|
 |
|
 |
How to implemente a Timeout with W3C ?
|
|
|
|
 |
|
 |
You POST Method does NOT put in any BOUNDARY for uploading files.
How would you use this to upload files to a server using multipart-form data?
When you upload files from a form in a web page you have to specify a BOUNDARY condition ???
Could you give an example of how to upload a file using POST to upload an image file with a boundary specified?
Thanks!
Great Code!
Bill SerGio
|
|
|
|
 |
|
 |
Any chance you found an answer?
|
|
|
|
 |
|
 |
Hi,
It is fine for compiler. When I included your source code (w3c.cpp and w3c.h) in my project, I got an error on "_szuri = szuri;".
I found _szuri = {???}. Why did it not be initialized?
Do I miss some setting?
It works fine on your sample.
Thank you!
|
|
|
|
 |
|
 |
I'm always running into the "unknow exception" Any ideas?
|
|
|
|
 |
|
 |
Hi all!
File w3c.cpp, Line 205:
...
if(_hOpen || _hOpen!=INVALID_HANDLE_VALUE)
::InternetCloseHandle(_hOpen);
...
(INVALID_HANDLE_VALUE = -1)
Can we replace by ?
if(_hOpen && _hOpen!=INVALID_HANDLE_VALUE)
::InternetCloseHandle(_hOpen);
if _hOpen is NULL, then we will not close it.
Lines 207-208, 212-213, 214-215, ... are same error.
|
|
|
|
 |
|
 |
Hello!
First at all thank you for this classes, i like to use it
But it looks like it is a bug here. I founded it, when i
install IE 7 beta (with new version of wininet.dll in there).
In methods RequestGet, RequestPost and RequestPost2
you use ::HttpOpenRequest with wrong param szAcceptType:
static LPCTSTR szAcceptType=TEXT(__HTTP_ACCEPT_TYPE);
...
...
_hRequest=::HttpOpenRequest( _hConnection, __HTTP_VERB_GET, // HTTP Verb szuri, // Object Name HTTP_VERSION, // Version szref, // Reference &szAcceptType, // Accept Type INTERNET_FLAG_NO_CACHE_WRITE | https? INTERNET_FLAG_SECURE ), NULL); // context call-back point.
But "Accept Type"-parameter must be (from MSDN)
lplpszAcceptTypes
[in] Long pointer to a null-terminated (!!!) array of string pointers indicating content types accepted by the client. If this parameter is NULL, no types are accepted by the client. Servers interpret a lack of accept types to indicate that the client accepts only documents of type "text/*" (that is, only text documents, and not pictures or other binary files).
So, i think - right will be something, like this:
LPCTSTR szAcceptTypes[]={TEXT(__HTTP_ACCEPT_TYPE),
NULL};
...
...
_hRequest=::HttpOpenRequest( _hConnection, __HTTP_VERB_GET, // HTTP Verb szuri, // Object Name HTTP_VERSION, // Version szref, // Reference szAcceptTypes, // Accept Type INTERNET_FLAG_NO_CACHE_WRITE | https? INTERNET_FLAG_SECURE ), NULL); // context call-back point.
Sorry for my bad English, i learned German )
Wbr, Kirill Sbytov.
-- modified at 5:56 Thursday 29th June, 2006
|
|
|
|
 |
|
 |
I am recieving error 12006 when the ::HttpOpenRequest is called
with wininet.dll (7.0.5450.4) installed
ERROR_INTERNET_UNRECOGNIZED_SCHEME
12006
The URL scheme could not be recognized, or is not supported.
Does anyone have a clue how to fix this?
|
|
|
|
 |
|
 |
Thanks to the author for very useful classes. Thanks to Kirill Sbytov for solution of the HttpOpenRequest call.
|
|
|
|
 |
|
 |
now i can login in yahoo email use this class(i send data to the another web,it will help me login in ).
but now i don't know how to login out the yahoo email?
|
|
|
|
 |
|
 |
I keep getting that IWORKERTHREAD is an undefined identifier and it can't find wt.h in VC6 and VC7. Any ideas?
-- modified at 13:37 Tuesday 20th June, 2006
|
|
|
|
 |
|
 |
nevermind I don't need to use asynchronous.
|
|
|
|
 |
|
|
 |
|
 |
The Dialog and String Table are all in KOREAN
Could someone tell me How do I convert it to English ?
Many Thanks In advance
|
|
|
|
 |
|
 |
How do i use sessions with this client? What i have is a login page that redirects me to an upload page
|
|
|
|
 |
|
 |
sessions are Server's Values.
after connect your server, if you have don't close(), you should be use sessions.
good luck.
|
|
|
|
 |
|
 |
W3Client w3;
CString szheader;
CString szsource;
w3.SetAskInstallCert(m_bAskInstallCert);
if(w3.Connect((const char*)m_sUrl)){
if(w3.Request(w3.GetURI())){
unsigned char buf[1024]="\0";
unsigned char buf2[1025]="\0";// 1025 is "\0"
w3.QueryRawHeader(buf, 1024);
szheader=buf;
memset(buf, 0x00, 1024);
int read = 0;
while(read = w3.Response(buf, 1024)){
memset(buf2, 0x00, 1025);
memset(buf2, 65, read);
szsource+=buf2;
memcpy(szsource.GetBuffer(szsource.GetLength()) + szsource.GetLength() - read, buf, read);
memset(buf, 0x00, 1024);
}
HANDLE file=(HANDLE)::CreateFile(m_sFileDownload, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
unsigned long nw=0;
WriteFile(file, (const char*)szsource, szsource.GetLength(), &nw, NULL);
::CloseHandle(file);
}
w3.Close();
}
--------------------------
ERP VN: www.erpvn.net
|
|
|
|
 |
|
 |
Sorry but the #include header: afx.h, necessary for CString is sucks! the original exe generated file length is more less 195KB (so big but respetable) if we include your code sounds around 1.30 MB, so this is so big implementation for a single use of buffering on CString.
so, i change your code unless afx.h and his result length is 138 KB (1 MB less)
so, here the code:
usage:
{HOST} {REMOTE_FILE} {LOCAL_FILE}
if(w3.Connect(argv[1])){
if(w3.Request(argv[2])){
unsigned char buf[1024]="\0";
w3.QueryRawHeader(buf, 1024);
memset(buf, 0x00, 1024);
int read = 0;
HANDLE file=(HANDLE)::CreateFile(argv[3], GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
unsigned long nw=0;
while(read = w3.Response(buf, 1024)){
WriteFile(file, buf, read, &nw, NULL);
memset(buf, 0x00, 1024);
}
::CloseHandle(file);
}
w3.Close();
}
return 0;
unless the fatty exe than thin exe!
cheers
dark_alex
|
|
|
|
 |
|
 |
Hello,
I am new in WWW programming. I am trying to post xml data to a web server with your useful class, but I have some problems using the W3Client::RequestPost2 method. I wrote xml data into a file, but I cannot send the file to the server. The server always replay with this:
falseunsupportedMediaType
I also used Ethereal SW to trace the ethernet packets and it seems that in the packets there is no data belonging to the file containing the xml data.
For sure I am doing something wrong. Could you please help me in understanding what is going wrong ?
Thank you in advance for your help
Best regards
tino55
|
|
|
|
 |
|
 |
Hello, there.
I have a question.
I try to update a jpeg file(3kb)
upload is succeeded...
but...
the origin file is different to uploaded file.
Origin : FF D8 FF E0 00 10 4A 46 49 46 00 01 02 00 00 64 ; ??.JFIF.....d
Uploaded : (10 bytes missed..) 00 01 02 00 00 64
Why?
let me know, what i mistake...
please~
Best regards,...
------------------
Yail Kim
|
|
|
|
 |