Questions tagged [server]

Questions about server.c in pset6.

Filter by
Sorted by
Tagged with
0
votes
1answer
282 views

pset6 Internal Server Error

I'm working my way through the web server and am getting behavior I don't understand. I am consistently receiving a 500 error whatever I try to load in Chrome. I've added printf's (yes, I'm one of ...
0
votes
2answers
535 views

PSET 6 Segmentation Fault at strstr

For week8 - pset6, I am having trouble because of the strstr() function. server.c compiles well, but it goes to a segmentation fault with the following message: __GI_strstr (haystack_start=0x0, ...
2
votes
2answers
556 views

How do i check my own implementation of server.c

i have completed server.c and now I want to test it! What command do I type in terminal?
1
vote
0answers
332 views

Pset6 server - 501 Not Implemented error

This is related to my earlier question, but as it turns out that I mistyped the error code in server.c and actually have a 501 Not Implemented error (instead of a 505), I made a new question because ...
0
votes
1answer
259 views

Pset6 - Server.c gives me 505 error (HTTP Version Not Supported)

When trying to access cat.html in pset6 on my local host, I get a 505: HTTP Version Not Supported error in both the browser and the terminal where my server is running. According to my server.c code, ...
1
vote
1answer
324 views

Does the Staff's server.c solution have a small bug?

In pset6 there is the following sentence: if absolute-path does not contain a . (and thus a file extension), respond to the browser with 501 Not Implemented. But when using the Staff's ...
0
votes
1answer
64 views

pset6: strncopy result: sizeof not equal to strlen

I'm trying to extract the request target from the request-line using strncpy. The resulting string contains 3 chars of rubbish on the end of the string and I can't work out why. Any ideas? // grab ...
1
vote
1answer
172 views

pset6 address already in use [duplicate]

I have a problem with pset6 (server). I was debugging server on gdb, using run -p 8080 public and then I quitted. Then I made some changes to server.c, compiled it, and used gdb again. Now if I submit ...
0
votes
1answer
436 views

strcat adding extra characters

I am trying to concatenate root and absolute path for pset6 but i get extra characters at the start of it but am not sure why. This is my code: // concatenate root and absolute-path char path[strlen(...
0
votes
0answers
69 views

What to do in Pset 6 Web Server? [duplicate]

Up until Pset 5, CS50's lectures, shorts and walkthroughs were pretty helpful in not getting me stuck at a problem. However, as we transition to web based programming, I'm entirely clueless about what ...
0
votes
1answer
408 views

Why am I getting a segmentation fault when trying to tokenize the request line?

I am trying to break the request line into separate tokens. gdb shows me segmentation fault on this line strncpy(method, line, SP1 - haystack); Interestingly, in gdb, I can not print line, but ...
0
votes
1answer
1k views

Pset 6 Web Server

This isn't a specific programming question, but having watched and re-watched edx lectures in weeks 6, 7 and 8, I am still completely overwhelmed and confused by pset6 "web server". I've read through ...
0
votes
1answer
49 views

I mistakenly uploaded my problem set 1 files onto the Final Project section. How do I retract?

So, is there any way to delete the files I uploaded? Or if not, can they be ignored by the staff checking it?
0
votes
2answers
603 views

Can't find cause of segmentation fault in server.c pset6

I need help finding cause of the segmentation fault in my server.c. I've been using gdb line by line for this pset and I finally think I can use it. However, it reports the seg fault at the line 130 ...
1
vote
1answer
108 views

Why is the pset6 server loop causing failure after success

I have implemented server up to the point of respond to client. When I make a request for static content from Chrome, I get this: GET /cat.html HTTP/1.1 THE QUERY IS THE ABSOLUTE PATH IS /cat.html ...
1
vote
1answer
381 views

my server pset throws up "505 HTTP Version Not Supported" but i think it should not

Am done with pset6 but want to test if I implemented the server correctly but when I type in the URL (e.g: 192.#.#.#:port#/cat.jpg) into the browser as specified by David, I get the following error "...
0
votes
0answers
147 views

pset6 server: no data received, no errors

I am working on the server pset. I have compiled all my code, and when I put in my IP address and the port number I get no errors. However, my program prints out (in the terminal) the response to ...
0
votes
1answer
253 views

Capitalization in pset6 lookup implementation?

The specs for "lookup" refer, for example, to "html (or any capitalization thereof)." Does this mean just "html or HTML," or does it also include all 14 possible mixed-case combinations?
2
votes
1answer
239 views

strcat: what am i doing wrong?

I'm currently doing the pest, and I'm at the step which I have "to define a string called path that contains the concatenation of root (a global variable) and absolute-path." As suggested, I'm using ...
0
votes
2answers
523 views

Pset6 Undefined index: name in /home/jharvard/Dropbox/pset6/public/hello.php on line 8

I'm almost through the end of debugging my Pset 6 (Server) code. The server now implements cat.jpg and cat.html properly, but I'm still facing trouble when I try to insert anything into hello.html. I ...
0
votes
1answer
536 views

pset6 server.c extract query from request-target

Good afternoon everyone who is reached pset 6 :-) I got error which I could not understand. I'm splitting request target to several sub-strings. During my last operation when I'm validating query in ...
1
vote
1answer
352 views

pset6 Web server responses

in pset6 what should be the response if we make request from telnet program as GET / hello.html HTTP/1.1? The staff solution report the error as "HTTP/1.1 505 HTTP Version Not Supported" even though ...
1
vote
1answer
248 views

why does my server only work when requesting php files from Chrome?

The request headers and response headers in the command line and in Chrome are all fine, but cat.jpg, cat.html, and hello.html do not display anything in Chrome. In the command line, cat.html and ...
1
vote
1answer
639 views

why doesn't strcmp return 0 even though the strings look identical in gdb?

I don't understand why strcmp says these strings are different. In gdb they look identical. I can't figure it out and I have searched the forum and didn't have any luck. Please let me know if I can ...
1
vote
0answers
83 views

Why does chrome not work with server, but firefox does?

I got server (from pset6) working on Firefox, but not Chrome. Chrome will either not show anything, or just show a error message if there's an error. Everything works on Firefox, except it will not ...
1
vote
1answer
867 views

My version of server.c not working

When I use telnet and pass GET /cat.html HTTP/1.1, the server throws four errors all at once. HTTP/1.1 400 Bad Request HTTP/1.1 501 Not Implemented HTTP/1.1 400 Bad Request HTTP/1.1 505 HTTP Version ...
0
votes
0answers
174 views

Error when openening php through html form server.c

My server.c works perfectly. And when i open a php by manually entering for instance /hello.php?name=Mihaly it works. however when using hello.html which opens the php through a form the page doesn't ...
0
votes
1answer
684 views

Pset 6 Web Server, Code works with Telnet but encounters Error 405 on the Browser

I've have been working on this problem set for quite some time now and I thought I have completed it. All of the functions were working fine when I used Telnet to submit the requests. My program is ...
0
votes
0answers
188 views

Problem using a function to manipulate strings in pset6 server

This given code in server.c gets the slice of string up to an appearance of \n. const char* haystack = request; char* needle = strstr(haystack, "\r\n"); if (needle == NULL) { ...
0
votes
2answers
604 views

Variable optimized out eventhough it will be used later

When trying to debug my implementation of server.c, asking gdb to print out the variable line results in a <optimized out>. (gdb) p line (gdb) <optimized out> After doing a bit of ...
2
votes
1answer
249 views

"subtraction" of string in pset6 server.c

In server.c in pset6, there is a line of code where a string is "subtracted" from a string. I tried to find out what this operation does by writing a simple program : char* needle = "needle"; ...
1
vote
1answer
604 views

cat.jpg not displaying in cat.html

I've gotten all functions of server.c to work, including displaying hello.html successfully. However, when I attempt to access cat.html, program is not displaying the image. The chrome developer ...
0
votes
1answer
487 views

Two questions about "respond to client(browser)"

In pset6(server.c), when responding to client(browser), we use the function "dprintf", but why do we put the "dprintf" in the "if" ocndition, and call "continue" when "dprintf" fails? What is the ...
1
vote
1answer
801 views

problems about "respond to client" and "concatenate root and absolute-path" in server.c

What does "respond to client" mean? What should I do to respond to a browser? And, should I use "printf" to print out the response? Another problem is, when I refresh the browser, my program ...
2
votes
1answer
240 views

To ensure the file is readable

In pset6, server.c, what should I do to make sure the file is readable? the problem set guide says it's possible to use "stat" or "access"? since both return 0 on success and -1 if not, how do I ...
0
votes
1answer
977 views

Pset6 Web Server, need help with respond to client and some others

I've been slowly working through this problem set for a couple weeks now, and I think I've hit a brick wall. Giving just a general overview, I believe at this point that I have successfully completed: ...
0
votes
1answer
656 views

pset6 (server.c) content length

I am repeatedly getting ERR_CONTENT_LENGTH_MISMATCH in Chrome's Network Status tab when trying to load any file in the appliance's browser. This is despite the content loading correctly when I run it ...
0
votes
0answers
589 views

pset6 (server.c) strcpy and pointer behaviour

I have come across an interesting little problem in server.c which I hope someone could explain so I can learn from it please. I have been happily defining substrings from the request-line using ...
0
votes
1answer
81 views

Why does server.c's error function not malloc "phrase"?

The error function defines phrase as follows: const char* phrase = NULL; switch (code) { case 400: phrase = "Bad Request"; break; case 403: phrase = "Forbidden"; break; case 404: phrase = ...
1
vote
0answers
976 views

How to run my copy of server.c

I am sure this is a stupid question, but I am struggling to workout how I actually run my version of server.c in pset6. Do I need to compile it? Whenever I try and "make" the file, terminal reports ...
0
votes
0answers
394 views

pset 6, server.c, query sent but hello.php doesn't receive it

Although the spec does not mention to handle .php files, I found that if I do not have my lookup function return "text/html" when it receives a .php extension, then I get a 501 Not Implemented error. ...
0
votes
1answer
466 views

Is it possible to code lookup function without malloc?

I have finally managed to have my WebServer working, but I would like to improve my implementation of the "lookup" function. The only option that avoided segfaults was to malloc a char* and use it as ...
0
votes
1answer
503 views

pset6 2015, server.c, ERR_CONTENT_LENGTH_MISMATCH on cat.jpg

I respond to the client with the following function call: dprintf(cfd, "HTTP/1.1 200 OK\r\nConnection: close\r\nContent-Length: %i\r\nContent-Type: %s\r\n\r\n%s", length, type, body); This works, ...
7
votes
1answer
1k views

having trouble validating request line in server.c

My main issue is doing this without using the heap, I think. I set up arrays for each of the pieces of the request-line (e.g. method, request-target, etc.) and set all of them to be of length = strlen(...
1
vote
2answers
436 views

Can not run staff solution of server.c

I am trying to run the staff solution of server.c but I get an error that I need to install rsplib=legacy-wrappers. What does it mean? I just updated the appliance and restarted it, but problem is ...

1 2 3 4
5