Open2300 - Weather Underground Submit

Fix submission to Weather Underground

Introduction

Currently wu2300.c doesn't seem to be able to communicate with Weather Underground. Weather data doesn't get posted, and submitting by hand the text to port 80 generates a 404 error.

Description of Patch

The patch modifies the way the request is sent, so that a "sucess" result is sent back.

Installation of Patch

Put the patch text in a text file

Put it in the source directory of open2300

Run patch < patch-filename

Recompile

Patch

--- linux2300.c   2006/12/10 05:19:39   1.1
+++ linux2300.c   2007/02/13 08:21:01
@@ -272,7 +274,8 @@
       perror("Cannot connect to host");
       return(-1);
    }
-   sprintf(buffer, "GET %s\nHTTP/1.0\n\n", urlline);
+   sprintf(buffer, "GET %s HTTP/1.0\r\nHost: %s\r\n\r\n", urlline, WEATHER_UNDERGROUND_BASEURL);
+   if (DEBUG) printf("send [%s]\n", urlline);
    send(sockfd, buffer, strlen(buffer), 0);
 
    /* While there's data, read and print it */
--- wu2300.c   2007/02/13 08:15:38   1.1
+++ wu2300.c   2007/02/13 08:18:48
@@ -38,8 +38,8 @@
    
    /* START WITH URL, ID AND PASSWORD */
 
-   sprintf(urlline, "http://%s%s?ID=%s&PASSWORD=%s",
-         WEATHER_UNDERGROUND_BASEURL,WEATHER_UNDERGROUND_PATH,
+   sprintf(urlline, "%s?ID=%s&PASSWORD=%s",
+         WEATHER_UNDERGROUND_PATH,
          config.weather_underground_id,config.weather_underground_password);
 
    /* GET DATE AND TIME FOR URL */

Discussion and Comments

This will not be merged in.

The problem has been fixed in a similar way on the Subversion code.

-- KennethLavrsen - 19 Jul 2007


Topic revision: r2 - 19 Jul 2007, KennethLavrsen
Copyright © 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
This website only use harmless session cookies. See Cookie Policy for details. By using this website you accept the use of these cookies.