Article View: borland.public.cppbuilder.internet.socket
Article #3695Re: http 302 error (redirect)
From: Blake Young
Date: Thu, 21 Jul 2005 21:33
Date: Thu, 21 Jul 2005 21:33
42 lines
2581 bytes
2581 bytes
Thanks for the HTTPS vs HTTP explanation. I tried doing what you said, and
in one sense it worked, but in another it didn't. Using the TClientSocket,
I changed the port number to 443, but now the response is a flat-out 404
error. I have confirmed that the file is still in the correct location, so
I'm not sure why it can't be found. For the sake of completeness, I'll post
my complete and updated code. Is this a problem with my coding, or is the
server I'm trying to connect to refusing to let me connect? You can try
downloading the file for yourself and you should find that it exists. I
also tried using the IdHTTP component and I get the same 404 error, so I'm
guessing it's a problem with the server. I'm having the same problem trying
to download this file from a Tripod site that I uploaded it to
(http://winboxer.tripod.com/version.txt).
void __fastcall TForm1::Button2Click(TObject *Sender)
{
if (!ClientSocket1->Active)
{
ClientSocket1->Host = "webspace.utexas.edu";
ClientSocket1->Port = 443;
ClientSocket1->ClientType = ctNonBlocking;
ClientSocket1->Open();
}
}
void __fastcall TForm1::ClientSocket1Connect(TObject *Sender,
TCustomWinSocket *Socket)
{
Memo1->Lines->Add("Connected.");
ClientSocket1->Socket->SendText("GET /youngba2/www/winboxer/version.txt
HTTP/1.0\r\n\r\n");
}
void __fastcall TForm1::ClientSocket1Read(TObject *Sender,
TCustomWinSocket *Socket)
{
Memo1->Lines->Add("Reading...");
AnsiString response = Socket->ReceiveText();
Memo1->Lines->Add("Message: " + response);
}
Technical Details
Message-ID:
<42e014c4@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!212.101.4.254.MISMATCH!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<42e00af1$1@newsgroups.borland.com> <42e00ee5$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,5aca12ad06e8e880 X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Blake Young" <blakeyoung@mail.utexas.edu> Newsgroups: borland.public.cppbuilder.internet.socket References: <42e00af1$1@newsgroups.borland.com> <42e00ee5$1@newsgroups.borland.com> Subject: Re: http 302 error (redirect) Date: Thu, 21 Jul 2005 16:33:52 -0500 Lines: 44 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-RFC2646: Format=Flowed; Original NNTP-Posting-Host: 68.91.216.87 Message-ID: <42e014c4@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1121981636 68.91.216.87 (21 Jul 2005 14:33:56 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!212.101.4.254.MISMATCH!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail