Explorar el Código

Bug fixes to the HTTP protocol code

tags/v0.9.3
Derek Pryor hace 18 años
padre
commit
0f88703019
Se han modificado 1 ficheros con 3 adiciones y 4 borrados
  1. 3
    4
      src/net/tcp/http.c

+ 3
- 4
src/net/tcp/http.c Ver fichero

@@ -1,4 +1,5 @@
1 1
 #include <stddef.h>
2
+#include <stdlib.h>
2 3
 #include <string.h>
3 4
 #include <vsprintf.h>
4 5
 #include <assert.h>
@@ -158,13 +159,11 @@ static void http_newdata ( struct tcp_connection *conn, void *data,
158 159
  */
159 160
 static void http_senddata ( struct tcp_connection *conn, void *buf, size_t len ) {
160 161
 	struct http_request *http = tcp_to_http ( conn );
161
-	char buf[66]; // 16 request + 50 for filename
162
-	size_t len;
163 162
 
164 163
 	switch ( http->state ){
165 164
 	case HTTP_REQUEST_FILE:
166
-		len = snprintf(buf,66,"GET %s HTTP/1.0\r\n\r\n",http->filename);
167
-		printf("%s\n",buf);
165
+		len = snprintf(buf,len,"GET %s HTTP/1.0\r\n\r\n",http->filename);
166
+		printf("%s\n",(char *)buf);
168 167
         	// string is: GET <file> HTTP/1.0\r\n\r\n
169 168
 
170 169
 		tcp_send ( conn, buf, len);

Loading…
Cancelar
Guardar