Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

URL fails with IdHttp.get, works fine in browser

Posted on 2012-08-15
7
Medium Priority
?
1,736 Views
Last Modified: 2013-11-19
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?
0
Comment
Question by:soballe
  • 4
  • 3
7 Comments
 
LVL 31

Expert Comment

by:Marco Gasi
ID: 38296423
Try to set Request->UserAgent to Mozilla/3.0 for your idHttp component

Cheers
0
 

Author Comment

by:soballe
ID: 38296497
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
 
LVL 31

Expert Comment

by:Marco Gasi
ID: 38296549
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:soballe
ID: 38296587
Thanks marqusG, but that didn't do it.
0
 
LVL 31

Expert Comment

by:Marco Gasi
ID: 38296607
I'm very sorry, soballe. Good luck.
0
 

Accepted Solution

by:
soballe earned 0 total points
ID: 38306476
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
 

Author Closing Comment

by:soballe
ID: 38319698
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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
The viewer will learn how to dynamically set the form action using jQuery.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses
Course of the Month21 days, 7 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question