LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-12-2012, 08:47 PM   #1
eagle-bear
LQ Newbie
 
Registered: Jan 2012
Posts: 3

Rep: Reputation: Disabled
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
 
Old 01-13-2012, 10:03 AM   #2
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] why local socket does not work if the socket file exist before? golden_boy615 Programming 4 12-14-2011 08:26 AM
Receive a packet from L2 header using socket murugan86 Programming 1 03-26-2009 10:48 PM
listen queue of a socket overflowed, process is not taking new requests bhaskarna Programming 2 07-18-2006 03:06 AM
finding out TCP header details at socket level hari121 Linux - Networking 0 10-25-2005 01:54 AM
Setting DF bit in IP header for Raw socket myself_rajat Linux - Networking 0 06-29-2004 09:06 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:06 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration