title: C Socket write HTTP GET request: error 400
body: <p>I am writing a small program to read finance data from download.finance.yahoo.com using sockets in C. The socket connection seem to work fine.</p>
  
  <p>I can't seem to get the correct GET command to read the data from yahoo. The program reads fine from google.com, where I can read the about pages for example. </p>
  
  <p>The request:</p>
  
  <pre><code>char resource[STR_SIZE];
  strcpy(resource, "GET ");
  strcat(resource, argv[3]);  //argv[3]=="/d/quotes.csv?s=GOOG&amp;f=nsl1op"
  strcat(resource, "\r\n");
  ...
  write(fd, resource, strlen(resource));
  </code></pre>
  
  <p>This information is in the body of the page i receive when trying to request from Yahoo:</p>
  
  <pre><code>status code : 400
  Host Header Required
  host machine: r04.ycpi.ams.yahoo.net
  timestamp: 1413383465.000
  url: http:///d/quotes.csv?s=GOOG
  </code></pre>
  
  <p>How should the GET string be formated to work with Yahoo?</p>