Recent Posts

Pages: [1] 2 3 ... 10
1
HFS ~ HTTP File Server / New version: 2.3m
« Last post by rejetto on August 15, 2018, 05:27:36 PM »
skipped the "l" in the version because it's a letter that can be confused.

For the moment the update must be done manually, at www.rejetto.com/hfs/download
I will change this tomorrow.

what's new
+ initial localization support http://www.rejetto.com/forum/programmers-corner/translations-to-other-languages/
+ {.remove header.}
- fixed error pages' loading problem http://www.rejetto.com/forum/bug-reports/httpauth-challenge-http-headers-bug/
- fixed error with {.load.} with size exceeding real size http://rejetto.com/forum/index.php?topic=12059.msg1062781#msg1062781
- fixed template translation issues http://rejetto.com/forum/index.php?topic=11880.msg1062167#msg1062167
2
HFS ~ HTTP File Server / Re: New version: 2.3k
« Last post by rejetto on August 15, 2018, 04:39:26 PM »
3
HFS ~ HTTP File Server / Re: moving to another pc
« Last post by rejetto on August 15, 2018, 04:38:13 PM »
In order to get this working you need to "Edit resource" and point to the directory where the file is located. The Folder icons are OK, but the files placed in those folders must be edited :(

your main problem is that you used a VIRTUAL folder when probably you needed a REAL folder.
4
HFS ~ HTTP File Server / Re: Unlimited Speed Hang
« Last post by rejetto on August 15, 2018, 04:34:45 PM »
Any progress on this topic? I am currently running with a rate limited wget command "wget -r -nH -l1 --no-verbose --no-parent --limit-rate=8000k" to avoid the hang. Using FileZilla I get much better performance without the hang but using HFS would be my preference.

did you update wget as suggested in my last post?
5
HFS ~ HTTP File Server / Re: A macro-level https redirect ?
« Last post by rejetto on August 15, 2018, 04:30:10 PM »
{.add header|location: https://google.com.}
6
HTML & templates / Re: Introducing: The really fast Throwback (retro) template. Updated.
« Last post by dj on August 15, 2018, 03:48:15 AM »
It would be great if we can use another function compatible with those browsers. I'm not expert on these matters, but perhaps using for loop instead of forEach, could solve this problem (or else using another methods). ???

Yes, I replaced the forEach with a loop in rev2.2.
The problem isn't the Array.forEach, it's the Nodelist.forEach.
7
Programmers corner / Re: HTTP Header Size Problem
« Last post by rejetto on August 15, 2018, 12:46:19 AM »
current version doesn't allow you to remove such headers.
with next version 2.3m you will be able to program this event
Code: [Select]
[+download]
{.remove header|ETag.}
{.remove header|Set-cookie.}

I'm not sure if security problems that have been fixed in time affect 2.2f. Surely most don't. You should make a search yourself, sorry.
8
Programmers corner / HTTP Header Size Problem
« Last post by User21 on August 14, 2018, 01:09:33 PM »
Hallo Forum,

so far I used HFS version 2.2f as a simple binary file server.
If HFS got an HTTP-Request /GET/update.bin, the HTTP-Response Header was

HTTP / 1.1 200 OK
Content-Type: application / octet-stream
Content Length: 75470
Accept-Ranges: bytes
Content-Disposition: attachment; filename = "update.bin";
Last-Modified: Fri, 08 Sep 2017 09:39:43 GMT


For security reasons I wanted to update HFS to the current version.
But version 2.3k now answers with:

HTTP / 1.1 200 OK
Content-Type: application / octet-stream
Content Length: 75470
Accept-Ranges: bytes
Set-Cookie: HFS_SID_ = 0.818251500837505; path = /; HttpOnly
ETag: B0772E23A80C880E27639CEF62C2F1A1
Last-Modified: Fri, 08 Sep 2017 09:39:43 GMT
Content-Disposition: attachment; filename = "update.bin";


That's nearly 100 bytes more information which my (embedded) system does not need and unfortunately creates a buffer overflow because I only provided a 256 bytes buffer for HTTP-Response. The whole HTTP header will be dropped off immediately.

Is there an easy way to turn off Set-Cookie and ETag?

And if not, ist there an security reason not to use 2.2f any longer?

Regards,
Lothar


9
HTML & templates / Re: Simple contact template
« Last post by bmartino1 on August 14, 2018, 02:58:38 AM »
Thank you Leo, here are my final drafts for the codes broken down in there basic forms

The hfs different tpl attached:
Code: [Select]
<html>
<head>
<title>Contact Form using JavaScript</title>   
</head>


<!-- include css file here -->
<!--   <link rel="stylesheet" href="/Contact/form.css"/>   -->
<style type="text/css">
/* below line is write to use google font online  */
@import url(http://fonts.googleapis.com/css?family=Ubuntu);


* {
margin: 0;
padding: 0;
}

body {
font-size: 62.5%;
        font-family: 'Ubuntu', sans-serif;
}

p {
font-size: 1.3em;
margin-bottom: 15px;
}

#page-wrap {
width: 660px;
background: white;
padding: 20px 50px 20px 50px;
margin: 20px auto;
min-height: 300px;
height: auto !important;
height: 300px;
}

#contact-area {
width: 600px;
margin-top: 25px;
}

#contact-area input, #contact-area textarea {
padding: 5px;
width: 471px;
        font-family: 'Ubuntu', sans-serif;
font-size: 1.4em;
margin: 0px 0px 10px 0px;
border: 2px solid #CCC;
}

#contact-area textarea {
height: 90px;
}

#contact-area textarea:focus, #contact-area input:focus {
border: 2px solid #FC0;
}

#contact-area button.submit-button {
width: 100px;
height: 30px;
float: right;
cursor: default;
color: buttontext;
text-align: center;
padding: 2px 6px 3px;
box-sizing: border-box;
align-items: flex-start;
border: 0px outset buttonface;
-webkit-appearance: push-button;
        font-family: 'Ubuntu', sans-serif;
font-size: 1.4em;
white-space: pre;
}

label {
float: left;
text-align: right;
margin-right: 15px;
width: 100px;
padding-top: 5px;
font-size: 1.4em;
}

/* -------------------------------------
    CSS for sidebar (optional)
---------------------------------------- */
div#fugo{
float:right;
}
</style>

<body>

<div id="page-wrap">
<p><h1>&laquo; Contacting the Server Administrator &raquo;</h1></p>

<div id="contact-area">

<form method="GET">
<label for="contact-name">Full Name:</label>
<input type="text" tabindex="1" class="form-control" id="contact-name" name="name" placeholder="Please Enter Your Full Name.." onkeyup='validateName()'>
            <span class='error-message' id='name-error'></span>

<label for="contact-email">Email Address:</label>
            <input type="email" tabindex="2" class="form-control" id="contact-email" name="email" placeholder="Please Enter a valid Email (your@email.com) " onkeyup='validateEmail()'>
            <span class='error-message' id='email-error'></span>

<label for="contact-subject">Subject:</label><br />
            <input type="subject" tabindex="3" class="form-control" id="contact-subject" name="subject" placeholder="Ex: I Have Experienced an Error" onkeyup='validateSubject()'>
            <span class='error-message' id='subject-error'></span>

<label for='contactMessage'>Your Message:</label><br />
            <textarea class="form-control" rows="20" cols="20" id='contact-message' tabindex="4" name='message'  placeholder="Please Detail your needs - Enter a brief message" onkeyup='validateMessage()'></textarea>
            <span class='error-message' id='message-error'></span>
            <br />

<button id="SendMe" name="SubmitMessage" onclick='return validateForm()' class="submit-button" tabindex="5" >Submit</button>
<br />       
<span class='error-message' id='submit-error'></span>
</button>
</form>
</div>
</div>

<!-- include JavaScript file here -->
<!-- <script src="/Contact/form.js"></script> -->

<script type="text/javascript">
//Creates box and validate textbox content for a name
function validateName() {

  var name = document.getElementById('contact-name').value;

  if(name.length == 0) {

    producePrompt('Name is required', 'name-error' , 'red')
    return false;

  }

  if (!name.match(/^[A-Za-z]*\s{1}[A-Za-z]*$/)) {

    producePrompt('First and Last name, please.','name-error', 'red');
    return false;

  }

  producePrompt('Valid', 'name-error', 'green');
  return true;

}

//Creates box and validate textbox content for a Email Subject
function validateSubject() {

  var submessage = document.getElementById('contact-subject').value;
  var required = 2;
  var left = required - submessage.length;

  if (left > 0) {
    producePrompt(left + ' At least 2 characters are required for the Subject','subject-error','red');
    return false;
  }

  producePrompt('Valid', 'subject-error', 'green');
  return true;

}

//Creates box and validate textbox content for a valid Email

function validateEmail () {

  var email = document.getElementById('contact-email').value;

  if(email.length == 0) {

    producePrompt('Email Invalid','email-error', 'red');
    return false;

  }

  if(!email.match(/^[A-Za-z\._\-[0-9]*[@][A-Za-z]*[\.][a-z]{2,4}$/)) {

    producePrompt('Email Invalid', 'email-error', 'red');
    return false;

  }

  producePrompt('Message Valid', 'email-error', 'green');
  return true;

}

//Creates box and validate textbox content for Email Message - Text to save to file later?
function validateMessage() {
  var message = document.getElementById('contact-message').value;
  var required = 10;
  var left = required - message.length;

  if (left > 0) {
    producePrompt(left + ' more characters are required, Please Provide More deails for the server admin','message-error','red');
    return false;
  }

  producePrompt('Valid', 'message-error', 'green');
  return true;

}

//ON button click action:
//Checks form and contents pass validation (NOT working - atleast not displaying) - use later for alert measge sent
function validateForm() {
    if (!validateName() || !validateSubject() || !validateEmail() || !validateMessage())
{
        jsShow('submit-error');
        producePrompt('Please fix errors to submit.', 'submit-error', 'red');
        setTimeout(function(){jsHide('submit-error');}, 5000);
        return false;
    }
else
{
//Change alert for message sent sucesfuly
        //producePrompt('Sent Sucessfuly', 'Submit-error', 'green');
        jsShow('submit-error');
        producePrompt('Mesage Passed Validation and is Sent.', 'submit-error', 'green');
        setTimeout(function(){jsHide('submit-error');}, 2000);
        return true;
    }
}

//??? Secondary Code for JS validation:
function jsShow(id) {
  document.getElementById(id).style.display = 'block';
}

function jsHide(id) {
  document.getElementById(id).style.display = 'none';
}

//Populate HTML Page
function producePrompt(message, promptLocation, color) {

  document.getElementById(promptLocation).innerHTML = message;
  document.getElementById(promptLocation).style.color = color;


}
</script>


<!-- How/What we save is added here -->
<\body>
</html>

with the code above, you get the css form and javascript validation. the only thing that needs to be added is the acutal content to write.

for xml i have this:
Code: [Select]
<!-- Rejeto HFS Macro Commands via LEO sends to hfs via text (XML) -->
<!-- Fix Permission to folder upload access (hfs macro)? -->
{. set item|%folder%|add upload=@anonymous .}

<script>
//disabled as this code should just run after validation...
//document.getElementById("SendMe").onclick = function () {

var Headers = '\n---------------------------\n';
var GetName = '\nName: '+document.getElementById("contact-name").value+'\n';
var GetMail = 'Email: '+document.getElementById("contact-email").value+'\n';
var GetSubject = 'Subject: '+document.getElementById("contact-subject").value+'\n';
var GetMessage = 'Message:\n\n'+document.getElementById("contact-message").value+'\n';

var FullDataString = Headers+'\n'+GetName+'\n'+GetMail+'\n'+GetSubject+'\n'+GetMessage+'\n'+Headers;
//atempt to fix single line text saved to 1 single string???...

//disabled as it is now apart of the javascript
//alert("Message sent!");
//can become the a message on the page instead of an alert box...

var formData = new FormData();

// JavaScript file-like object
var content = FullDataString; // Message content...
var blob = new Blob([content], { type: "text/plain"});

formData.append("webmasterfile", blob, "New-Message-{.time|yyyy.mm.dd'-at-'hh.nn.ss.}.txt");

var request = new XMLHttpRequest();
request.open("POST", "/contact");  //THIS NEEDS TO BE CHAGED VIA THE USER! Folder path MUST BE CORRECT
request.send(formData);

}
</script>

For Hfs macro saving i have this:
Code: [Select]

<!-- Rejeto HFS Macro Commands via LEO sends to hfs via text-->

<script>
//disabled as this code should just run after validation...
//document.getElementById("SendMe").onclick = function () {

//disabled as it is now apart of the javascript
//alert("Message sent!");
//can become the a message on the page instead of an alert box...

//}
</script>

{.if |{.?Message.}|{:
{.set|nombre|{.?name.}.}
{.set|correo|{.?email.}.}
{.set|asunto|{.?subject.}.}
{.set|mensaje|{.?message.}.}

{.save|/%folder%/Private-Message-{.time|yyyy.mm.dd'-at-'hh.nn.ss.}.txt|
{.force ansi|{.!-----[ BEGIN MESSAGE ]-----.}.}

Name: {.^nombre.}
From: {.^correo.}
IP: %ip% (User: %user%)
Date: {.time|yyyy/mm/dd '@' hh:nn:ss.}
Subject: {.^asunto.}

Message:

{.force ansi|{.^mensaje.}.}

{.force ansi|{.!-----[ END MESSAGE ]-----.}.}
.}

{.add to log|You've received a new message!.}

:}
.}
   

Hope this helps :)
10
@DJ: It looks like the 'forEach' function is not recognized. I've tested several not-so-updated browsers:

In Chrome 31 (old version), the console shows this error:
Code: [Select]
Uncaught TypeError: Object #<NodeList> has no method 'forEach' (index):130
In Firefox 24 ESR (old version), the console shows this error:
Code: [Select]
TypeError: document.querySelectorAll(...).forEach is not a function
In Firefox (another old version), the console shows this error:
Code: [Select]
Error: document.querySelectorAll(".option_button").forEach is not a function
In KMeleon (an old fork of Firefox), the console shows this error:
Code: [Select]
Error: TypeError: document.querySelectorAll(...).forEach is not a function
On QtWeb (an old fork of Chrome), the console shows this error:
Code: [Select]
TypeError: 'undefined' is not a function (evaluating 'document.querySelectorAll(".option_button").forEach(function(o){o.onclick=function(){window.alert(o.value)}})')
Differences:

In Throwback7rev2.tpl there is no modal dialog at all (and the 'Uncaught TypeError' shows up on the console only once, when loading the page).

In Throwback7rev2.2.tpl the modal dialog shows up, but the file doesn't get deleted (it asks: 'Delete filename.xxx?', but when clicking on 'OK' the 'Uncaught TypeError' shows up again on the console (this error also appears when loading the page).

It would be great if we can use another function compatible with those browsers. I'm not expert on these matters, but perhaps using for loop instead of forEach, could solve this problem (or else using another methods). ???

or setup if statement to check if it can run then run if it can
https://www.w3.org/community/webed/wiki/Optimizing_content_for_different_browsers:_the_RIGHT_way

Why feature detection is better
Feature detection is a much better way to do things — instead of seeing what browser is accessing the content and serving appropriate code, the idea here is to query the browser to detect whether it supports the features our content relies on, and then serve content as appropriate. Let's take HTML5 video as an example. You could detect support using some simple code such as this:

javascript code:
Code: [Select]
if(!!document.createElement('video').canPlayType === true) {
  // run some code that relies on HTML5 video
} else {
  // do something else
}

This is much more future proof, because existing browsers that support HTML5 video will run the correct code, and future browsers that support HTML5 video will do as well. You don't have to keep updating your code each time a new browser is released.
Pages: [1] 2 3 ... 10