Lines Matching refs:to

144 static void strdecode( char* to, char* from );
146 static void strencode( char* to, int tosize, char* from );
193 ** non-blocking I/O to avoid stalling the server, but when it is called
194 ** from a sub-process it wants to use blocking I/O so that the whole
196 ** of a hack but it seems to do the right thing.
408 /* Bind to it. */
413 poorman_log("can't bind to socket.\n", false, NULL, RED);
418 /* Set the listen file descriptor to no-delay / non-blocking mode. */
423 poorman_log("can't listen to socket.\n", false, NULL, RED);
497 /* Conditional macro to allow two alternate forms for use in the built-in
519 "Your request has bad syntax or is inherently impossible to satisfy.\n";
530 "You do not have permission to get URL '%.80s' from this server.\n";
543 "You do not have legal permission to get URL '%.80s' from this server.\n";
558 /* Append a string to the buffer waiting to be sent as response. */
740 // LOG_ERR, "out of memory reallocating a string to %ld bytes",
778 add_response( hc, "Padding so that MSIE deigns to show this error instead of its own canned one.\n");
915 /* If the request was a POST then there might still be data to be read,
916 ** so we need to do a lingering close.
1242 /* Copies and decodes a string. It's ok for from and to to be the
1246 strdecode( char* to, char* from )
1248 for ( ; *from != '\0'; ++to, ++from )
1252 *to = hexit( from[1] ) * 16 + hexit( from[2] );
1256 *to = *from;
1258 *to = '\0';
1265 strencode( char* to, int tosize, char* from )
1273 *to = *from;
1274 ++to;
1279 (void) sprintf( to, "%%%02x", (int) *from & 0xff );
1280 to += 3;
1284 *to = '\0';
1362 /* For this type of tilde mapping, we want to defeat vhost mapping. */
1400 /* Pound it to lower case. */
1422 ** of `if' for it's possible to have a hostname formed with two
1441 /* Prepend hostdir to the filename. */
1456 ** Returns the expanded path (pointer to static string), or (char*) 0 on
1457 ** errors. Also returns, in the string pointed to by restP, any trailing
1467 ** is set to NULL.
1485 ** since it's impossible to get out of the tree. However, we still
1486 ** need to do the pathinfo check, and the existing symlink expansion
1487 ** code is a pretty reasonable way to do this. So, what we do is
1490 ** fall through to the existing code.
1492 ** One side-effect of this is that users can't symlink to central
1493 ** approved CGIs any more. The workaround is to use the central
1534 /* While there are still components to check... */
1543 /* Grab one component from r and transfer it to checked. */
1800 /* Checks hc->read_buf to see whether a complete request has been read so far;
2304 /* If the client wants to do keep-alives, it might also be doing
2305 ** pipelining. There's no way for us to tell. Since we don't
2307 ** might be unread pipelined requests waiting. So, we have to
2318 /* Copy original filename to expanded filename. */
2401 ERROR_FORM( err403form, "The requested URL '%.80s' resolves to a file outside the permitted web server directory tree.\n" ),
2580 ** which they were applied to the file.
2806 ** to worry about double closes or file descriptor leaks cause
2931 ** are not of interest to web clients.
2939 ** also not of interest to web clients. Plus if we're
2941 ** of /etc/passwd and /etc/group, which we want to avoid.
3068 /* Set up environment variables. Be real careful here to avoid
3070 ** to worry about freeing stuff since we're a sub-process.
3161 /* Set up argument vector. Again, we don't have to worry about freeing stuff
3174 ** one for the filename and one for the NULL, we are guaranteed to
3188 /* According to the CGI spec at http://hoohoo.ncsa.uiuc.edu/cgi/cl.html,
3190 ** character to determine if the command line is to be used, if it finds
3191 ** one, the command line is not to be used."
3218 ** from the request and sends it to the child process. The only reason
3219 ** we need to do it this way instead of just letting the child read
3254 /* Special hack to deal with broken browsers that send a LF or CRLF
3256 ** to 2 bytes. Unfortunately this doesn't fix the problem for CGIs
3257 ** which avoid the interposer process due to their POST data being
3272 /* And read up to 2 bytes. */
3279 ** change the return status of the response. Since the return status has to
3280 ** be the very first line written out, we have to accumulate all the headers
3282 ** out the saved headers and proceed to echo the rest of the response.
3333 ** default to 200.
3409 ** be necessary, according to POSIX a dup()'d file descriptor does
3411 ** However, Linux messes this up and does copy the flag to the
3412 ** dup()'d descriptor, so we have to clear it. This could be
3420 ** fd, and all of those are set to close-on-exec, so we don't
3421 ** have to close anything else.
3425 /* If the socket happens to be using one of the stdin/stdout/stderr
3426 ** descriptors, move it to another descriptor so that the dup2 calls
3448 /* Set up stdin. For POSTs we may have to set up a pipe from an
3479 /* Need to schedule a kill for process r; but in the main process! */
3524 /* Need to schedule a kill for process r; but in the main process! */
3542 /* At this point we would like to set close-on-exec again for hc->conn_fd
3544 ** and dup.) Unfortunately there seems to be another Linux problem, or
3549 ** file descriptor gets passed to the child process. Since the child
3561 ** to the program's own directory. This isn't in the CGI 1.1
3672 ** of just trying to open it, so that no one ever gets surprised by
3680 // "%.80s URL \"%.80s\" resolves to a non world-readable file",
3684 ERROR_FORM( err403form, "The requested URL '%.80s' resolves to a file that is not world-readable.\n" ),
3744 // "%.80s URL \"%.80s\" tried to index a directory with indexing disabled",
3748 ERROR_FORM( err403form, "The requested URL '%.80s' resolves to a directory that has indexing disabled.\n" ),
3765 // LOG_INFO, "%.80s URL \"%.80s\" tried to index a directory",
3794 // "%.80s URL \"%.80s\" resolves to a non-world-readable index file",
3798 ERROR_FORM( err403form, "The requested URL '%.80s' resolves to an index file that is not world-readable.\n" ),
3823 // "%.80s URL \"%.80s\" tried to retrieve an auth file",
3838 // "%.80s URL \"%.80s\" tried to retrieve an auth file",
3859 ** trying to either serve or run a non-CGI file as CGI. Either case
3869 ERROR_FORM( err403form, "The requested URL '%.80s' resolves to a file which is marked executable but is not a CGI file; retrieving it is forbidden.\n" ),
3880 ERROR_FORM( err403form, "The requested URL '%.80s' resolves to a file plus CGI-style pathinfo, but the file is not a valid CGI file.\n" ),
3963 /* If we're vhosting, prepend the hostname to the url. This is
4007 /* Probably have to add something about daylight time here. */
4038 /* Returns 1 if ok to serve the url, 0 if not. */
4064 ERROR_FORM( err403form, "You must supply a local referrer to get URL '%.80s' from this server.\n" ),
4071 /* Returns 1 if ok to serve the url, 0 if not. */
4203 ** vsnprintf(), it is probably vulnerable to buffer overruns.