Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account


Photo

HTTP Requests

- - - - -

  • Please log in to reply
3 replies to this topic

#1
Glenn9999

Glenn9999

    Senior Member

  • Member
  • PipPipPipPip
  • 669 posts
  • Joined 23-April 07
  • OS:Windows 8 x64
  • Country: Country Flag
(I'm not sure where the best place would be to ask this, and this seems best) Are there any generally accepted rules for HTTP requests that are consistent with most sites? I ask because I've been trying to work (code-wise) on downloading a file pointed to by a valid fully qualified URL. Where I have it now is trying to handle "strange" URLs where valid files aren't necessarily specified. But I get stopped connection-wise if I try a main site link (like http://www.msfn.org/). So this got me wondering, and I'm not finding any good pages on it.

What's the proper HTTP headers to be sending besides the obvious GET to download the file, in terms of what most sites will accept?


How to remove advertisement from MSFN

#2
CoffeeFiend

CoffeeFiend

    Coffee Aficionado

  • Super Moderator
  • 5,399 posts
  • Joined 14-July 04
  • OS:Windows 7 x64
  • Country: Country Flag
Usually it's pretty straightforward. For msfn it surely is. You can even try using plain old telnet:

telnet 67.19.16.68 80
GET /board/ HTTP/1.1
Host: www.msfn.org
(followed by enter twice)

Works fine (you can see the markup fly by). Some sites require a few extras (e.g. "User-Agent: cloned-user-agent-string-here") but most of the time this is all you need. Obviously, some sites require authentication to download files.
Coffee: \ˈkȯ-fē, ˈkä-\. noun. Heaven in a cup. Life's only treasure. The meaning of life. Kaffee ist wunderbar. C8H10N4O2 FTW.

#3
Glenn9999

Glenn9999

    Senior Member

  • Member
  • PipPipPipPip
  • 669 posts
  • Joined 23-April 07
  • OS:Windows 8 x64
  • Country: Country Flag

Usually it's pretty straightforward. For msfn it surely is.


Thanks. It does seem so. The problem usually is to figure out what to expect. My problem that prompted this turned out to be that I was expecting a content length and that isn't valid for HTML. But still a good question, since I want what I'm working on to not be too "strange".

#4
Glenn9999

Glenn9999

    Senior Member

  • Member
  • PipPipPipPip
  • 669 posts
  • Joined 23-April 07
  • OS:Windows 8 x64
  • Country: Country Flag

Thanks. It does seem so. The problem usually is to figure out what to expect.


Moreso again. I keep hitting this downloader code I have (I got it to resume now), and found a site that sends HTML *as* the HTTP headers. So I'm still wondering if there's some kind of universal standard (there has to be I would think or the browsers won't work right).

Any ideas on this one?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users



How to remove advertisement from MSFN