LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   socket header requests problems. some work some do not (https://www.linuxquestions.org/questions/programming-9/socket-header-requests-problems-some-work-some-do-not-923520/)

eagle-bear 01-12-2012 08:47 PM

socket header requests problems. some work some do not
 
Hello Memebers

I am wondering if you could help me.

I am having a problem and with some sites be able to issue
header requests and others not being able to issuse requests.

I am writing a socket programming checking for any redirection
urls.

Program works but I have a problem:

a) Can connect to urls like www.url.com:80 and
send header requests and receive a 200 Ok.

b) Can connect to www.alexa.com and send header
request by receive 400 BAD_REQUEST.
Using wget or curl or telnet
the requests goes through. Why?

I have tested the program on the forture 500 companies.
I will later add SSL to the program.

Any help would greatly appreciated.

Sincerely
eagle-bear

theNbomr 01-13-2012 10:03 AM

Set up netcat as a listener on some port (say, 12345). Issue a request to that port using wget or curl, and also using your hand-coded client.
Code:

wget http://localhost:12345/some/file
See what netcat reports and compare the makeup of your code's request to what the other HTTP clients use. HTTP requests are generally not complex.

--- rod.


All times are GMT -5. The time now is 07:44 AM.