Author Topic: HTTP Stuff  (Read 3709 times)

0 Members and 1 Guest are viewing this topic.

Offline abc

  • Hero Member
  • *****
  • Posts: 576
    • View Profile
HTTP Stuff
« on: August 01, 2008, 09:38:06 pm »
hey uh, I'm trying to setup an automated login for a website and I've been packet logging the login I've been coming across some problems.

I see
Code: [Select]
Host: secure.somesite.com\r\n
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1\r\n
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n
Accept-Language: en-us,en;q=0.5\r\n
Accept-Encoding: gzip,deflate\r\n
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n
Keep-Alive: 300\r\n
Connection: keep-alive\r\n
Referer: http://www.somesite.com
Content-Type: application/x-www-form-urlencoded\r\n
Content-Length: 682

My question is, when sending this information, do I have to send it in the exact order for it to work?

I'm programming in C# using the HttpWebRequest


Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: HTTP Stuff
« Reply #1 on: August 01, 2008, 10:34:55 pm »
These are HTTP headers, so order isn't important.

Use HttpWebRequest.Headers.Add(string name, string value) before you send the request.

Offline abc

  • Hero Member
  • *****
  • Posts: 576
    • View Profile
Re: HTTP Stuff
« Reply #2 on: August 01, 2008, 11:52:48 pm »
thanks for the clarification Sidoh.  :)

Offline MyndFyre

  • Boticulator Extraordinaire
  • x86
  • Hero Member
  • *****
  • Posts: 4540
  • The wait is over.
    • View Profile
    • JinxBot :: the evolution in boticulation
Re: HTTP Stuff
« Reply #3 on: August 02, 2008, 12:04:42 am »
Using HttpWebRequest, you don't need to worry about all that.  You just need to manage the Content-Type and the contents.  You can also hack User-Agent if you want to spoof a browser.
I have a programming folder, and I have nothing of value there

Running with Code has a new home!

Our species really annoys me.

Offline abc

  • Hero Member
  • *****
  • Posts: 576
    • View Profile
Re: HTTP Stuff
« Reply #4 on: August 02, 2008, 12:06:42 am »
Using HttpWebRequest, you don't need to worry about all that.  You just need to manage the Content-Type and the contents.  You can also hack User-Agent if you want to spoof a browser.

alright cool, that's what I've been doing
Code: [Select]
        req.Method = "POST";
            req.UserAgent = "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1";
            req.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
            req.Headers.Add("Accept-Language: en-us,en;q=0.5");
            req.Headers.Add("Accept-Encoding: gzip,deflate");
            req.Headers.Add("Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7");
            req.KeepAlive = true;
            req.Connection = "300";
            req.Referer = "somesite.com/whatever";
            req.ContentType = "application/x-www-form-urlencoded";

Offline MyndFyre

  • Boticulator Extraordinaire
  • x86
  • Hero Member
  • *****
  • Posts: 4540
  • The wait is over.
    • View Profile
    • JinxBot :: the evolution in boticulation
Re: HTTP Stuff
« Reply #5 on: August 02, 2008, 03:07:43 am »
so that would wned up having stuff like:

User-Agent: User-Agent: Mozilla/5.0

Don't be silly ;)
I have a programming folder, and I have nothing of value there

Running with Code has a new home!

Our species really annoys me.

Offline abc

  • Hero Member
  • *****
  • Posts: 576
    • View Profile
Re: HTTP Stuff
« Reply #6 on: August 02, 2008, 03:50:49 am »
so that would wned up having stuff like:

User-Agent: User-Agent: Mozilla/5.0

Don't be silly ;)

ah, silly me!  :D