URL fails with IdHttp.get, works fine in browser

The following URL works fine when pasted into a Browser:
http://tigerweb.geo.census.gov/ArcGIS/services/tigerWMS/MapServer/WMSServer?&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=Linear%20Hydrography&STYLES=&SRS=EPSG:4326&BBox=-91.64,43.30,-91.36,43.53&WIDTH=542&HEIGHT=671&FORMAT=image/jpeg

But you get "invalid request" from the server when you use this URL in idhttp.get(URL,stream);

Any ideas - I think it may be something in the http header that indy is sending?
soballeAsked:
Who is Participating?
 
soballeConnect With a Mentor Author Commented:
I have pretty much given up on INDY for this specific problem and have gone with an WinInet approach instead using the InternetOpenURL and InternetReadFile functions.  The WinINET approach works fine, but anyone who knows how to fix the INDY problem, I'd really like to hear it for future reference.

Thanks,
0
 
Marco GasiFreelancerCommented:
Try to set Request->UserAgent to Mozilla/3.0 for your idHttp component

Cheers
0
 
soballeAuthor Commented:
Thanks, that's apparently the default, and that's what I've been using - sadly, it doesn't work. Is there another option for the UserAgent?

Added background:
I've left everything in the IdHttp at default settings.
the Actual response I get is "HTTP/1.1 400 Bad Request"
0
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

 
Marco GasiFreelancerCommented:
From Delphi 7 up to Delphi 2010 the default value for that property is "Mozilla/3.0 (compatible; Indy Library)" and this raises a bad request error: setting the value to simply "Mozilla/3.0" solved my problems. Be sure nothing is after "Mozilla/3.0".

If this doesn't helòp you, unfortunately I can't figure out any other solution...

Cheers
0
 
soballeAuthor Commented:
Thanks marqusG, but that didn't do it.
0
 
Marco GasiFreelancerCommented:
I'm very sorry, soballe. Good luck.
0
 
soballeAuthor Commented:
The WinINET approach with Delphi is well documented and there are plenty of examples posted on line that actually work - no more time right now to mess around with Indy's HTTP component.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.