-
Notifications
You must be signed in to change notification settings - Fork 250
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added onion_handler_opack, easy use of opack results. Fixed bug when …
…sending data and break in the middle of send. oterm now uses internal resources instead of external, for !__DEBUG__. Added README.rst to oterm. onion_handler_opack can be used to easy use opack results, only needs the opack writer and a path. Actually it can be used with your own writers, check onion_opack_render signature and do a funtion like that. There was a bug when sending on SSL a big file, as it send max 16kB. Now it tries harder. Opack now when compiled in non-debug mode returns the internal resources, that is, internal files, instead of using the directory handler. The oterm README.rst file gives insight on how to use oterm, and where to find more information.
- Loading branch information
1 parent
b101d81
commit 000c0ee
Showing
9 changed files
with
189 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
Onion web-based GNU/Linux terminal | ||
================================== | ||
|
||
With Oterm you can acces with a standard compilant browser to a remote terminal, | ||
using SSL and authenticated. | ||
|
||
It has a server component, that is as light as possible, that is the container of | ||
the processes, and redirects all inforamtion to the web based terminal. | ||
|
||
The terminal uses HTML/Javascript to emulate all the terminal commands and | ||
control characters, and serves all that as if it were a web page. | ||
|
||
Usage | ||
----- | ||
|
||
You need the libonion http web server library, and compile it all. To execute it | ||
just run the command oterm, and connect to the given address. | ||
|
||
More help is provided with --help. | ||
|
||
Current features | ||
---------------- | ||
|
||
* Understand most linux terminal commands, and allow to use many terminal based | ||
programs as htop, atop, mc, vi, emacs | ||
|
||
Planned features | ||
---------------- | ||
|
||
* Make it behave like a screen for web, allowing to create new sessions, recover | ||
old ones... | ||
* Make it multiuser, each with its own sessions. | ||
* Make it RESTfull, now it does polling, so its not as efficient as could be. | ||
* More terminal functionalities: It does not do yet all that a xterm do, for example | ||
it does not resize yet. | ||
* Fix bugs. | ||
|
||
Contact | ||
------- | ||
|
||
There is a github page at https://github.com/davidmoreno/onion, where you can fill new | ||
issues and feature request. Also you can send emails to dmoreno (works at) coralbits.com. | ||
|
||
Last if you need prefesional guidance about oterm or onion, you can contact the upper | ||
email address to ask for more information about consulting. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
Onion HTTP server library | ||
Copyright (C) 2010 David Moreno Montero | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as | ||
published by the Free Software Foundation, either version 3 of the | ||
License, or (at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include <string.h> | ||
#include <malloc.h> | ||
#include <unistd.h> | ||
#include <regex.h> | ||
|
||
#include <onion_handler.h> | ||
#include <onion_response.h> | ||
|
||
#include "onion_handler_opack.h" | ||
|
||
struct onion_handler_opack_data_t{ | ||
char *path; | ||
onion_opack_renderer render; | ||
}; | ||
|
||
typedef struct onion_handler_opack_data_t onion_handler_opack_data; | ||
|
||
int onion_handler_opack_handler(onion_handler_opack_data *d, onion_request *request){ | ||
if (strcmp(d->path, onion_request_get_path(request))!=0) | ||
return 0; | ||
|
||
onion_response *res=onion_response_new(request); | ||
onion_response_write_headers(res); | ||
|
||
d->render(res); | ||
|
||
onion_response_free(res); | ||
return 1; | ||
} | ||
|
||
|
||
void onion_handler_opack_delete(onion_handler_opack_data *data){ | ||
free(data->path); | ||
free(data); | ||
} | ||
|
||
/** | ||
* @short Creates an path handler. If the path matches the regex, it reomves that from the regexp and goes to the inside_level. | ||
* | ||
* If on the inside level nobody answers, it just returns NULL, so ->next can answer. | ||
*/ | ||
onion_handler *onion_handler_opack(const char *path, onion_opack_renderer render){ | ||
onion_handler_opack_data *priv_data=malloc(sizeof(onion_handler_opack_data)); | ||
|
||
priv_data->path=strdup(path); | ||
priv_data->render=render; | ||
|
||
onion_handler *ret=onion_handler_new((onion_handler_handler)onion_handler_opack_handler, | ||
priv_data, (onion_handler_private_data_free) onion_handler_opack_delete); | ||
return ret; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
Onion HTTP server library | ||
Copyright (C) 2010 David Moreno Montero | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as | ||
published by the Free Software Foundation, either version 3 of the | ||
License, or (at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#ifndef __ONION_HANDLER_OPACK__ | ||
#define __ONION_HANDLER_OPACK__ | ||
|
||
#include <onion_types.h> | ||
|
||
#ifdef __cplusplus | ||
extern "C"{ | ||
#endif | ||
|
||
typedef void (*onion_opack_renderer)(onion_response *res); | ||
|
||
/// Creates an path handler. If the path matches the regex, it reomves that from the regexp and goes to the inside_level. | ||
onion_handler *onion_handler_opack(const char *path, onion_opack_renderer opack); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters